Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Finding 'Day' via date

Former Member
0 Likes
902

Hello all,

I have an ABAP task for which I have to find that the day behind the date is 'Sunday' or 'Saturday'.

How can I do that? For example : today is 3.12.2007. How can i check via ABAP that today is saturday or not?

Please respond.

Regards,

Aisha Ishrat

ICI Pakistan Ltd.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
863

Hi,

Use this code

DATA : DATE like SCAL-DATE,

DAY LIKE SCAL-INDICATOR.

DATE = '20050728'.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = DATE

IMPORTING

DAY = DAY.

CASE DAY.

WHEN 1.

WRITE 😕 'MONDAY'.

WHEN 2.

WRITE 😕 'TUESDAY'.

WHEN 3.

WRITE 😕 'WEDNESDAY'.

WHEN 4.

WRITE 😕 'THURSDAY'.

WHEN 5.

WRITE 😕 'FRIDAY'.

WHEN 6.

WRITE 😕 'SATURDAY'.

WHEN 7.

WRITE 😕 'SUNDAY'.

ENDCASE.

IF HELP FULL REWARD

Hello all,

I have an ABAP task for which I have to find that the day behind the date is 'Sunday' or 'Saturday'.

How can I do that? For example : today is 3.12.2007. How can i check via ABAP that today is saturday or not?

Please respond.

Regards,

Aisha Ishrat

ICI Pakistan Ltd.

5 REPLIES 5
Read only

former_member386202
Active Contributor
0 Likes
863

Hi,

Use FM BKK_GET_DAY_OF_WEEK

Regards,

Prashant

Read only

Former Member
0 Likes
863

hI AL,

TRY DATE_TO_DAY FUNCTION MODULE.....

Regards,

Kaveri

Read only

Former Member
0 Likes
863

Hi

try this code...


DATA : day TYPE p.

CALL FUNCTION 'DAY_IN_WEEK'
  EXPORTING
    datum = sy-datum
  IMPORTING
    wotnr = day.
IF  day EQ '7' .
  WRITE :/ 'Sunday'.
ELSEIF day EQ '6'.
  WRITE :/ 'Saturday'.

ENDIF.

Read only

Former Member
0 Likes
863

Simple method....

The system variable SY-FDAYW will have the day numbers from 0 to 6...(i.e. Sunday to Saturday)

0 - sunday

1- monday

2- tuesday

like above....

check sy-fdayw = 6...(for saturday)

Read only

Former Member
0 Likes
864

Hi,

Use this code

DATA : DATE like SCAL-DATE,

DAY LIKE SCAL-INDICATOR.

DATE = '20050728'.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = DATE

IMPORTING

DAY = DAY.

CASE DAY.

WHEN 1.

WRITE 😕 'MONDAY'.

WHEN 2.

WRITE 😕 'TUESDAY'.

WHEN 3.

WRITE 😕 'WEDNESDAY'.

WHEN 4.

WRITE 😕 'THURSDAY'.

WHEN 5.

WRITE 😕 'FRIDAY'.

WHEN 6.

WRITE 😕 'SATURDAY'.

WHEN 7.

WRITE 😕 'SUNDAY'.

ENDCASE.

IF HELP FULL REWARD