Code: Alles auswählen.
DATA: lv_datefield(15) TYPE c,
lv_time_stmp TYPE crmt_date_timestamp_to.
DATA date_inv LIKE sy-datum.
CONVERT DATE sy-datum INTO TIME STAMP lv_time_stmp TIME ZONE sy-zonlo .
lv_datefield = lv_time_stmp.
IF NOT lv_datefield+4(2) = 12.
lv_datefield+5(1) = lv_datefield+5(1) + 1.
ELSE.
lv_datefield+4(2) = '01'.
lv_datefield(4) = lv_datefield(4) + 1.
ENDIF.
lv_time_stmp = lv_datefield.
convert time stamp lv_time_stmp TIME ZONE sy-zonlo into date date_inv.
WRITE: 'Before: ', sy-datum.
WRITE: 'After: ', date_inv.
Code: Alles auswählen.
*data
DATA: L_DATE LIKE SY-DATUM.
data month type t247-mnr.
*calculate previous month
L_DATE = SY-DATLO.
MOVE '01' TO L_DATE+6(2).
L_DATE = L_DATE - 1.
month = L_DATE+4(2).
* get name
select single * from t247
where spras = sy-langu
and mnr = month.