01-21-2008 7:04 AM
Hi,
I have a requirement in which the client wants to change the product from existing one to new product(report)....and i have to check whether the client is changing the product before 12 months of the issue date of existing product.
How do i do this..is ther any function module to find the month between two different dates??
01-21-2008 7:07 AM
Hi,
Check the following code:
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,
Bhaskar
01-21-2008 7:07 AM
Hi,
Check the following code:
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,
Bhaskar
01-21-2008 7:08 AM
01-21-2008 7:09 AM
FM: HR_AUPBS_MONTH_DAY
This FM will return you number of Years, Months and Days between Begin date and endDate.
01-21-2008 7:11 AM
Hi Sudheer,
Have a look at the following link.
http://abapcode.blogspot.com/2008/01/sap-function-module-for-date-and-time.html
Regards,
Kinshuk
01-21-2008 7:14 AM
Hi,
Use the FM, 'HR_HK_DIFF_BT_2_DATES' to find the number of months exists between the given 2 dates.
See the following example...
Data: d1 type sy-datum,
d2 type sy-datum,
wf_month_diff type P0347-SCRMM.
call function 'HR_HK_DIFF_BT_2_DATES'
exporting
date1 = d1
date2 = d2
output_format = '04'
importing
months = wf_month_diff.
In the 'wf_month_diff' variable, you will get the month difference between these two dates.
Regards,
Shanthi.P
Reward points if useful *****