Application Development and Automation 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: 
Read only

Days calculation

Former Member
0 Likes
1,107

Hi,

I need days calculation.I have to enter 50 days in selection screen.

But it has to be executed from todays date.(ex 03.03.2009 + 50 days).

how to write syntax.

9 REPLIES 9
Read only

former_member242255
Active Contributor
0 Likes
993

you have write the code in the program saying

sy-datum + no.of days given in sel.secreen.

you can use the FM HR_99S_DATE_ADD_SUB_DURATION for adding the no.of days given in sel.scr

Edited by: Sravan Kumar on Mar 3, 2009 1:07 PM

Read only

Former Member
0 Likes
993

Hi,

in the selection screen, populate the low value of the select-option as sy-datum,

and use FM BKK_ADD_WORKINGDAY to add 50 days to sy-datum and populate the result as the high value of the select option.

Regards,

Kiran

Read only

Former Member
0 Likes
993

hi,

u can use the fm ADD_TIME_TO_DATE

simply pass the sy-datum and no of days to be added it will add the no of days and give the date after 50 days.

hope this helps you .

regards,

prashanti

Read only

Former Member
0 Likes
993

Hi Bathrinath,

Use the FM:

DATE_IN_FUTURE

Calculate a date N days in the future.

RP_CALC_DATE_IN_INTERVAL

Add/subtract years/months/days from a date

or do it this way:

Parameter:
  days type i default 50.
Data:
  date type sy-datum.

At selection-screen.

  date = sy-datum + days.

Start-of-selection.

  Write:
    date.

With luck,

Pritam.

Edited by: Pritam Ghosh on Mar 3, 2009 1:21 PM

Edited by: Pritam Ghosh on Mar 3, 2009 1:41 PM

Read only

Former Member
0 Likes
993

data v_date type sy-datum.

v_date = sy-datum + no_of_days ( value from the selection screen).

Read only

Former Member
0 Likes
993

data v_date type sy-datum.

v_date = sy-datum + no_of_days ( value from the selection screen).

Read only

Former Member
0 Likes
993

Hi,

You can use the simple addition to achieve this.

ie:

data: w_dat type sy-datum.
w_dat = sy-datum + 50. "This gives the current date -+ 50 days

Edited by: Manoj Kumar on Mar 3, 2009 1:28 PM

Read only

Former Member
0 Likes
993

hi,

try this..



data: var1 type sy-datum,
        var2 type sy-datum.
var1= sy-datum.

var2 = var1 + 50.
"use this var2 

regards

Ritesh J

Read only

Former Member
0 Likes
993

hi.

test this sample code

REPORT ztn_test .

PARAMETERS: adddays type i,
            newdate
             like sy-datum.

AT SELECTION-SCREEN OUTPUT.
IF adddays IS INITIAL.
  clear newdate.
else.
 newdate = sy-datum.
 add: adddays to newdate.

endif.