Application Development 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: 

Addition of days in a date..

Former Member
0 Kudos

Hello,

Is want to add ceratin days in a date if certain condition is successful.

The date data in i_output-BLDAT is 20080428. If I do as follows, it does not work properly, is there any function module to add days to date.

For e.g.

i_out-ZFBDT = i_output-BLDAT + 220.

Regards,

Rajesh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Try FM CALCULATE_DATE

Hope this helps!

7 REPLIES 7

Former Member
0 Kudos

Try FM CALCULATE_DATE

Hope this helps!

former_member188829
Active Contributor
0 Kudos

Hi,

Use FM:RP_CALC_DATE_IN_INTERVAL

former_member188685
Active Contributor
0 Kudos

You can use the Function

RP_CALC_DATE_IN_INTERVAL

Former Member
0 Kudos

Hello,

RP_CALC_DATE_IN_INTERVAL

Add/subtract years/months/days from a date

- Jayant Sahu.

Former Member
0 Kudos

Use Function Module RP_CALC_DATE_IN_INTERVAL

Other important FMs are :

HR_JP_MONTH_BEGIN_END_DATE

First Date and Last date of the month

HR_IN_GET_DATE_COMPONENTS

Gets the components of a date

FIRST_AND_LAST_DAY_IN_YEAR_GET

Get First Date and Last Date of a year

HR_SGPBS_YRS_MTHS_DAYS

Find the difference between two days

DELTA_TIME_DAY_HOUR

Time Difference

former_member705122
Active Contributor
0 Kudos

Hi,

Check this FM,

DATE_IN_FUTURE

DATA:
date1 LIKE rm06b-eeind VALUE '20080428',
date2 TYPE sy-datum,
date3 TYPE sy-datum.

CALL FUNCTION 'DATE_IN_FUTURE'
  EXPORTING
    anzahl_tage             = 220
    import_datum            = date1
  IMPORTING
    export_datum_int_format = date2.

WRITE:/ date1, date2.

Regards

Adil

former_member188829
Active Contributor
0 Kudos

Hi Rajesh,

When You Pass 220 days to the Function module RP_CALC_DATE_IN_INTERVAL it is going to the dump.

Because Days Parameter Length is 2.So it accepts upto 99 days.

DATA:date TYPE sy-datum VALUE '20080428'.

START-OF-SELECTION.
  CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
      date      = date
      days      = '220'    <-----Change to 99  then it works
      months    = '00'
      signum    = '+'
      years     = '00'
    IMPORTING
      calc_date = date.
  .
  WRITE:'New date' ,date.

So,Use Function module BKK_ADD_WORKINGDAY

DATA:date TYPE sy-datum VALUE '20080428'.
  START-OF-SELECTION.
   CALL FUNCTION 'BKK_ADD_WORKINGDAY'
     EXPORTING
       i_date            = Date
       i_days            = '220'
*      I_CALENDAR1       =
*      I_CALENDAR2       =
    IMPORTING
      E_DATE            = date
*      E_RETURN          =
             .
  WRITE:/ 'New Date is',date.