Google Search - Blog...........

ABAP - Fetch First And Last Date For Any Year

report zdates.

parameters: p_year type T009B-BDATJ.

data: fday type sy-datum ,
lday type sy-datum .


CALL FUNCTION '/IBS/RB_FI_FIRST_LAST_DAY'
EXPORTING
i_gjahr = p_year
i_periv = '01'
IMPORTING
E_FIRST_DAY = fday
E_LAST_DAY = lday
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


write:/ 'this is the first date of the year', fday .

write:/ 'this is the last date of the year', lday .

No comments:

Post a Comment