Skip to Content
author's profile photo Former Member
Former Member

Finding 'Day' via date

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 09:22 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 09:08 AM

    Hi,

    Use FM BKK_GET_DAY_OF_WEEK

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 09:09 AM

    hI AL,

    TRY DATE_TO_DAY FUNCTION MODULE.....

    Regards,

    Kaveri

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 09:10 AM

    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.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 09:20 AM

    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)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.