2007 Mar 21 9:17 AM
Hi Experts,
If I execute the following code i am getting 32757 for cdays. Please tell me the reason or the calculation behind this.
REPORT ZTEST .
data: z_datum type d,
erdat type d,
cdays(5) type n.
z_datum = sy-datum.
cdays = z_datum - erdat.
2007 Mar 21 9:28 AM
u r getting the result as number of days between those two dates.
if u want to get in
Use this FM <b>HR_HK_DIFF_BT_2_DATES</b> to get the difference between dates in Years, Months and Days by specifying OUTPUT_FORMAT parameter.
If its 01, u vl get the differrnce in years,
02 - Months
03 - days.
Hope this hint may help u.
Regards,
Sujatha.
Hi Experts,
If I execute the following code i am getting 32757 for cdays. Please tell me the reason or the calculation behind this.
REPORT ZTEST .
data: z_datum type d,
erdat type d,
cdays(5) type n.
z_datum = sy-datum.
cdays = z_datum - erdat.
2007 Mar 21 9:19 AM
that's correct ! You are calculating the number of days between the current date (sy-datum) and the initial date (???).
regards,
Hans
2007 Mar 21 9:20 AM
erdat is 00000000.
sy-datum = 20070321
so 32757 days have passed after the first day in AD.
Regards,
Ravi
2007 Mar 21 9:22 AM
chk this , it will give 732757 no of days , divide this by 365 , it will give 2007 years till now
REPORT YCHATEST.
DATA: Z_DATUM TYPE D,
ERDAT TYPE D,
<b>CDAYS(7) TYPE N.</b>
Z_DATUM = SY-DATUM.
CDAYS = Z_DATUM - ERDAT.
WRITE : CDAYS.
2007 Mar 21 9:28 AM
u r getting the result as number of days between those two dates.
if u want to get in
Use this FM <b>HR_HK_DIFF_BT_2_DATES</b> to get the difference between dates in Years, Months and Days by specifying OUTPUT_FORMAT parameter.
If its 01, u vl get the differrnce in years,
02 - Months
03 - days.
Hope this hint may help u.
Regards,
Sujatha.
2007 Mar 21 9:31 AM
hi Viven,
Hope u understood my answer , You have given the length of CDAYS as 5 , thats why it is not giving the correct number , increase the length to 7
DATA : CDAYS(7) TYPE N.
So you will get CDAYS as 732757 / 365 = 2007 Years till now which is true
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |