Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

day and time logic

Former Member
0 Kudos

hi all,

my scenario is i have a loop. and first loop pass, i am storing the system date and sytem time in a field TIMESTAMP. then in 2nd loop pass , the time is incremented to 2 mins from the previous TIMESTAMP. So in case, 2minutes is added . when it reaches 60 minutes, automatically it is should become 1 hour and similarly is the casee for 1day.

is there any function m odule .

can you provide me some coding for th is

points will be rewarded

thanks in advance

5 REPLIES 5

Former Member
0 Kudos

Hi,

If you are using field of type time stamp then you can just add 2 mintues to it.

System will automatically take care of it when it reaches one hour.

Regards,

Atish

0 Kudos

can you please give me the coding for that like you said of type TIMESTAMP

0 Kudos

Hi Jayasree

Check this code

PARAMETERS : p_time TYPE sy-uzeit.
PARAMETERS : p_date TYPE sy-datum.

START-OF-SELECTION.

  p_time = p_time + 120. " 120 seconds
  p_date = p_date + 1. " 1 day

  WRITE :  p_date.
  WRITE 😕 p_time.

Regards

Gopi

Former Member

0 Kudos

Check this code. It works and satisfies your requirement.

l_Datum = sy-datum.

l_uzeit = sy-uzeit.

l_min = '000200'.

l_uzeit = l_uzeit + l_min.

if l_uzeit > '240000'.

clear l_uzeit.

l_Datum = l_Datum + 1.

endif.

We are adding 2 minutes to L_UZEIT. When L_UZEIT is more than 24 (for 24 hours), it will reset variable and add 1 to date.

Hope this helps.

ashish