Hi Naveen,
The formula actually demands the value in DATE variable and it do not accept blank values.
Right formula should be -
IF( DATE0 = '0000/00/00', '', DATE_WEEKDAY( SYST-DATUM ) )
or could be
IF( IS_INITIAL( DATE0 ), '', DATE_WEEKDAY( SYST-DATUM ) )
Now, if you have blank values in your date variable I suggest you go for routine.
In routine you can check if the date is blank or not, similar like below:
This will include calling of 2 FMs
------
DATA: date1 TYPE sy-datum.
DATA: weekday_text TYPE LANGT.
*data declare for DATE_COMPUTE_DAY
DATA: day LIKE scal-indicator.
* data declare for WEEKDAY_GET
DATA: return_code LIKE sy-subrc,
weekday TYPE STANDARD TABLE OF t246,
s_weekday LIKE LINE OF weekday.
* compute day text -
* call this one first and only one time to get all texts
s_weekday-sprsl = sy-langu.
APPEND s_weekday TO weekday.
CALL FUNCTION 'WEEKDAY_GET'
EXPORTING
language = sy-langu
IMPORTING
return_code = return_code
TABLES
weekday = weekday
EXCEPTIONS
weekday_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
date1 = sy-datum.
IF date1 NE ' '.
* compute day
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = date1
IMPORTING
day = day.
IF day NE ' '.
CLEAR: s_weekday.
READ TABLE weekday INTO s_weekday WITH KEY WOTNR = day.
IF sy-subrc EQ 0.
weekday_text = s_weekday-LANGT.
ENDIF.
ENDIF.
ENDIF.
WRITE: weekday_text.
------
You will have to fit this code in your routine and it will work fine.
Unfortunately FM 'DATE_TO_DAY' I could not find in my BW system so I had to use other FM's ![]()
Thanks
Amit