Skip to Content
-2

read out calendar day ?

Hi,

i have a simple requirment, but can't find any solution for it: is there any function module or class/method to read a calendar ? I need it in the form that i have input parameter "date from" and "date to" -> as output i need a table with day of the week like:

30.07.2020 Thursday

31.07.2020 Friday

01.08.2020 Saturday

I cant find anything, any solution for that ?

br Martin

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jul 31, 2020 at 12:13 PM
    day_number = ( ( iv_date - '19790101' ) MOD 7 ) + 1.
    day_name = switch char20( day_number  when 1 then 'monday' .... ). 
    

    or you could make a select on the table with day number

    rsimple ;)

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 31, 2020 at 12:39 PM

    Hi,

    There are many function modules are there.

    FTR_DAY_GET_TEXT

    RH_GET_DATE_DAYNAME

    DATE_TO_DAY

    ISP_GET_WEEKDAY_NAME

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 31, 2020 at 12:28 PM

    Hello Martin Svik

    You can use SAP standard function DATE_COMPUTE_DAY to calculate the day of the week (1 - Monday, 2 - Tuesday, 3 - Wednesday etc.)

    See SAP Help on Calendar functions

    Best regards

    Dominik Tylczynski

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 31, 2020 at 01:16 PM

    Martin Svik,

    There is no FM as such which can output the Day names from the date ranges, probably you make use of the below FMs and code it accordingly.

    You can calculate the Day Value as suggested by Frederic Girod and then use the second FM below to get the name of it.

    You can use the FM: GET_WEEKDAY_NAME, to get the Day name based on the dates as shown below:

    All weekday names can be retrieved from the FM DAY_NAMES_GET just by executing it as shown below:

    Regards!


    scn.png (20.7 kB)
    scn.png (21.7 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • Martin Svik,

      I don't think so. Think about THIS, call the second function module that I have given which gives all the week day names. Here the function module is called only once. Now the there is a internal table with all the week day numbers and its name.

      Next as suggested by Frederic Girod calculate the day number and read from the Table fetched using the FM as suggested above.

      So until now you have called the FM only once and you read it N number if times which is no harm. Hope it helps!

      Regards!

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.