2008 Mar 14 9:43 AM
hello experts
i want to subtract a date from a date suppose
ekko-bedat - mseg-bldat .how shall i do it
plz reply
hello experts
i want to subtract a date from a date suppose
ekko-bedat - mseg-bldat .how shall i do it
plz reply
2008 Mar 14 9:47 AM
Hello,
You can do it directly.
data: lv_date like ekko-bedat.
lv_date = ekko-bedat - mseg-bldat.
write: lv_date.
Cheers,
Vasanth
2008 Mar 14 9:51 AM
hello i ahve done it from an internal table
data: d1 type ekko-bedat
d1 = it_ekpo-bedat - it_mseg-bldat.
but the output is comming as 00.00.0000
plz help
2008 Mar 14 9:56 AM
declare d1 as type i.
data : d1 type i.
d1 = it_ekpo-bedat - it_mseg-bldat.
2008 Mar 14 9:58 AM
Hello,
Does the two fields it_ekpo-bedat and it_mseg-bldat have values.
If it has the values then definetely the your d1 will give the result.
Cheers,
Vasanth
2008 Mar 14 10:01 AM
>
> hello i ahve done it from an internal table
> data: d1 type ekko-bedat
"here d1 supposed to store number of days. "so declare d1 as type i NOT 'date' type. DATA : d1 TYPE i.> d1 = it_ekpo-bedat - it_mseg-bldat.
> but the output is comming as 00.00.0000
> plz help
2008 Mar 14 9:47 AM
Hi,
u can subtract it directly.then it will give u the diff in number of days.
days = date1 - date2.
rgds,
bharat.
2008 Mar 14 9:49 AM
2008 Mar 14 9:50 AM
Hi
Use the FM /SDF/CMO_DATETIME_DIFFERENCE where you can pass the 2 dates to date1 and date2 parameters to get the difference (in days).
Thanks
Vijay
2008 Mar 14 9:56 AM
Use
DAYS_BETWEEN_TWO_DATES function module.
Award points if useful.
2008 Mar 14 10:00 AM
Hi,
Check this code,
data: date type i.
date =ekko-bedat - mseg-bldat
write: / date.
Thats it. !!..
You can also have the date fields in two variables if you want to.
Reward if helpful.
Regards.
2008 Mar 14 10:32 AM
hi try this ,
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,
venkat.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |