09-29-2006 1:52 PM
Hi,
I am developing a program to insert new data into S716 table based on each period. The period range as given as input example 09/2005 to 02/2006. I have update the data for all the periods between the given range.
Is there any function module to get the no. of periods or a better logic to do this. pls help.
09-29-2006 1:58 PM
Hi Gopal,
1) Adding 01(day) to the second dates date and pass that to <b>RE_LAST_DAY_OF_MONTH or SLS_MISC_GET_LAST_DAY_OF_MONTH</b>. You will get the last date of that month(w_seconddate). Adding 01 will make first date(w_firstdate)
Then Days = w_seconddate - w_firstdate will give you the days.
Hope this helps you.
~thomas
09-29-2006 2:03 PM
HI,
Check the FM... "RKE_GET_NUMBER_OF_PERIODS".
Thanks and Regards,
Bharat Kumar Reddy.V
09-29-2006 2:16 PM
09-29-2006 2:27 PM
Hi,
Sample code for the function module you want.
REPORT ZDATEDIFF.
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FROMDATE
i_date_to = TODATE
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS.
INITIALIZATION.
FROMDATE = SY-DATUM - 60.
Regards,
anver
pls mark all hlpful answers