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

How to get 2 Dates of a specific day From a Pay period

Hi

I have a date range (Pay period). now from the start date i Need to find out both Dates of a specific day of that Pay period.

For Example If i know the date range is

01/06/2007 to 01/19/2007

Then I need to know what are the dates for both Saturdays.

Here it should be 01.06.2007 and 01.13.2007.

Please help. I always award points. Thanks

Message was edited by:

Anwarul Kabir

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2007 at 03:51 PM

    If I understand correctly...

    The simple solution would be just to add 7 to lower date. In your case 01/06/2007.

    Or else

    1) get the difference in no. if days between the 2 dates.

    2) divide the number by 7

    3) Ignore the decimal places.

    4) Multiply the number you get by 7

    5) Add this number to the lower date. <b>Thats the result</b>

    Dont know if that sounds good to you.

    Else, please give another example.

    Hope it helps.

    Lokesh

    Message was edited by:

    Lokesh Aggarwal

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 22, 2007 at 03:59 PM

    Hi,

    Please try this.

    PARAMETERS: P_START LIKE SY-DATUM,
                P_END   LIKE SY-DATUM.
                                                                            
    DATA: DAYS    TYPE I,
          WEEKDAY LIKE DTRESR-WEEKDAY.
                                                                            
    DAYS = P_END - P_START.
                                                                            
    DO DAYS TIMES.
      CALL FUNCTION 'DATE_TO_DAY'
        EXPORTING
          DATE    = P_START
        IMPORTING
          WEEKDAY = WEEKDAY.
                                                                            
      IF WEEKDAY = 'Sat.'.
        WRITE: / P_START.
      ENDIF.
                                                                            
      P_START = P_START + 1.
                                                                            
    ENDDO.
    

    Regards,

    Ferry Lianto

    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.