Skip to Content
author's profile photo
Former Member

Add 1 to date

Hi,

Can you ple tell me how can i add '1' to a date '2007/06/01/' ( i.e. yyyy/mm/dd).

im need logic as no FM exists in my system,

please help, points assured

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 29, 2007 at 04:44 AM

    If you want to use FM, then try FM RP_CALC_DATE_IN_INTERVAL.

    data: wa_date like sy-datum.

    call function 'RP_CALC_DATE_IN_INTERVAL'

    exporting

    date = sy-datum

    days = 1

    months = 0

    signum = '+'

    years = 0

    importing

    calc_date = wa_date.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 29, 2007 at 04:52 AM

    I dont have any FM modules related to date in this system.

    So the following logice is what i have written.

    SPLIT '2007-09-01' at '-' into v_sydatum1 v_sydatum2 v_sydatum3.

    CONCATENATE v_sydatum1 v_sydatum2 v_sydatum3 into v_sydatum.

    v_sydatum = v_sydatum + 1.

    and it works.

    v_sydatum has 1 day incrmentaed, but how can i split this date again with '-'.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 29, 2007 at 04:53 AM

    Or you can just as easily do a calculation.

    add 1 to date.

    OR

    date = date + 1.

    if your date is stored in a date-type variable.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 29, 2007 at 05:21 AM

    Hi Ajay..

    On Date fields we can directly perform the Add ➕ and Subtract ➖ .

    It will add the No of days. So there is no need of a FM.

    Eg:

    Parameters: p_date type sy-datum.

    Initialization.

    P_date = sy-daum.

    Add 1 to P_date.

    Start-of-selection.

    Write:/ 'Date = ', P_date.

    <b>reward if Helpful.</b>

    Add comment
    10|10000 characters needed characters exceeded