Register Login

How to use function DATE_GET_WEEK

Updated May 18, 2018

A sample using function DATE_GET_WEEK

Report try05.

DATA: xweek(6) TYPE n,
xdt TYPE d.

xdt = '20050101'.

CALL FUNCTION 'DATE_GET_WEEK'
EXPORTING
DATE = xdt
IMPORTING
WEEK = xweek
EXCEPTIONS
DATE_INVALID = 1
* OTHERS = 2
.

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:/ xdt.
WRITE:/ xweek.


×