09-16-2008 6:36 AM
Hello Friends,
I am making one program, Program is one truck is entering at 7:30 A.M. and it is exiting at 7:25 P.M. I want to calculate time in hours and minutes like(11 hours 55 minutes) from entring to exiting also want to calculate wages on the basis of hours and minutes......
Please guide me as soon as possible......
Waiting For positive response
09-16-2008 6:51 AM
Hi Shelly,
this code put into begenning:
data: time_in like sy-uzeit.
data: time_out like sy-uzeit.
data: time_total type i.
data: time_hours type i.
data: time_min type i.
time_in = sy-uzeit.
now process your program and then execute the code below
time_out = sy-uzeit.
time_total = time_out - time_in.
time_hours = time_total div 3600.
time_min = time_total - ( 3600 * time_hours ).
time_min = time_min div 60.
write: / 'hours:', time_hours, 'min:', time_min.
you get time spent during execution of program.
Regards,
Karol
09-16-2008 6:51 AM
Hi Shelly,
this code put into begenning:
data: time_in like sy-uzeit.
data: time_out like sy-uzeit.
data: time_total type i.
data: time_hours type i.
data: time_min type i.
time_in = sy-uzeit.
now process your program and then execute the code below
time_out = sy-uzeit.
time_total = time_out - time_in.
time_hours = time_total div 3600.
time_min = time_total - ( 3600 * time_hours ).
time_min = time_min div 60.
write: / 'hours:', time_hours, 'min:', time_min.
you get time spent during execution of program.
Regards,
Karol
09-16-2008 6:56 AM
Hi,
There are many FMs for calculating difference between time.
Eg- TIMECALC_DIFF
For using this you need to timestamp the Entry and Exit date, time with timezone.
then give it to this FM. It will calculate the difference in seconds
Cheers,
Kothand
09-16-2008 6:57 AM
Hi,
Try this Code :
DATA : entry_time type syuzeit.
DATA : exit_time type syuzeit.
tot_time : entry_time - exit_time.
it will give you the total working time.
Regards,
Saran
09-16-2008 7:08 AM
Hi shelly Malik,
Use FM
SD_CALC_DURATION_FROM_DATETIME
Pass paramters like
I_DATE1 16.09.2008
I_TIME1 10:33:00
I_DATE2 16.09.2008
I_TIME2 19:00:00
and you will get the result as below..
E_TDIFF 8:27
8 hours and 27 minutes...
Use Offsets and get the hour and minute value from E_TDIFF
Now u can use this values of hours and minutes to get the exact wage type values... get the details from HR module and multiply it with the hours and minute and calculate it...
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
09-16-2008 7:27 AM
Hi..
Please do in this way...
In the beginning of START-OF-SELECTION the current time as..
v_entry_time = sy-uzeit,
When you want to display the time diff.(END OF SELECTION)
v_time_diff = sy-uzeit - v_entry_time.
And display v_time_diff