‎2007 Dec 20 4:47 AM
Dear all,
I am doing something like this
W_CTIME = ( WA_VBRK-ERDAT - WA_LIKP-ERDAT + WA_VBRK-ERZET - WA_LIKP-ERZET ).
.
But the moment my
WA_LIKP-ERZET is greater than WA_VBRK-ERZET my calculation goes wrong.
w_ctime is of type MKPF-CPUTM.
cAN ANYONE HELP?
‎2007 Dec 20 4:55 AM
Hi,
You should fallow the BODMAS rule
Try like this
W_CTIME = ( WA_VBRK-ERDAT - WA_LIKP-ERDAT ) + ( WA_VBRK-ERZET - WA_LIKP-ERZET ).
Regards,
Prashant
‎2007 Dec 20 4:58 AM
hai
can u plz send me ur requirement clearly coz we cant recadnize ur data error or type problem..
regard
nawa
‎2007 Dec 20 5:05 AM
hi,
if WA_VBRK-ERDAT > WA_LIKP-ERDAT.
W_CTIME = ( WA_VBRK-ERDAT - WA_LIKP-ERDAT + WA_VBRK-ERZET - WA_LIKP-ERZET ).
else if WA_VBRK-ERDAT < WA_LIKP-ERDAT.
W_CTIME = ( WA_LIKP-ERDAT-WA_VBRK-ERDAT + WA_VBRK-ERZET - WA_LIKP-ERZET ).
endif.
hope this will be helpful.
regrds,
karthik
‎2007 Dec 20 5:26 AM
Hi,
If you calculate directly the hour/min calculation will not be done. multiply the date difference with 3600 (i.e., 60 * 60 )
Use the below logic for calculation.
l_f_date = WA_VBRK-ERDAT,
l_f_date1 = WA_LIKP-ERDAT.
l_f_time1 = WA_VBRK-ERZET
l_f_time2 = WA_LIKP-ERZET.
if l_f_date >= l_f_date1.
if l_f_time1 > l_f_time2.
l_f_time = ( ( l_f_date - l_f_date1 ) * 60 * 60 ) + ( l_f_time1 -
l_f_time2 ).
endif.
else.
if l_f_time1 >= l_f_time2.
l_f_time = ( ( l_f_date1 - l_f_date ) * 60 * 60 ) + ( l_f_time1 -
l_f_time2 ).
else.
l_f_time = ( ( l_f_date - l_f_date1 ) * 60 * 60 ) + ( l_f_time2 -
l_f_time1 ).
endif.
endif.
Hope this helps you.