ABAP – To get the day of the date

To get the day like Sunday, Monday etc of a particular date we can use the following function.

 

DATA: V_DATE(10) type c.

CALL FUNCTION ‘DATE_TO_DAY’
EXPORTING
DATE          =  sy-datum
IMPORTING
WEEKDAY       = v_date
.

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: ‘Today is’, V_DATE.

 

This will displays today’s day

0 Comments

Leave A Reply