Application Development and Automation 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: 
Read only

hlep.

Former Member
0 Likes
736

Hi,

Can someone help me in implementing this simple logic in ABAP.

Set of values : (00:10:00,00:18:00,02:14:00,05:30:00,10:40:00)

If the value is not in this interval then it is updated to next higher value.

Ex:

1)If the hour timing is 02:18:00 , it will be updated to 05:30:00

2)If the hour timing is 06:40:00 , it will get updated to 10:40:00.

The value gets updated to nest higher value.

Tushar.

4 REPLIES 4
Read only

Former Member
0 Likes
582

Tushar,

I don't really understand the purpose but you can try something like this :

if sy-uzeit lt '001000'.
w_next_time = '001800'.
elseif sy-uzeit lt '001800'.
w_next_time = '021400'.
...

Hope this helps

Read only

0 Likes
582

Tushar,

Please see my reply to your earlier post:

Change all the integer data types to Type UZEIT.

PARAMETERS: p_val TYPE uzeit.

DATA:

result TYPE uzeit,

BEGIN OF it_num OCCURS 0,

val TYPE uzeit,

END OF it_num.

Populate the int. table with your values as below or you can read from a db table.

it_num-val = '001000'. APPEND it_num.

Please do award points and close messages if your question is answered. It helps others.

Thanks,

Ramki Maley

Please follow the link below to learn how and why to award points.

https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm.

Message was edited by: Ramki Maley

Read only

0 Likes
582

Never seen this type of requirement, interesting. Maybe you could elaborate on why exactly you need this type of functionality. Anyway, here is a solution.



report  zrich_0005.


parameters: p_time type sy-uzeit.

data:  begin of itab occurs 0,
       low type sy-uzeit,
       high type sy-uzeit,
       next type sy-uzeit,
       end of itab.

start-of-selection.


  itab-low  = '001000'.
  itab-high = '001759'.
  itab-next = '001800'.
  append itab.

  itab-low  = '001800'.
  itab-high = '021359'.
  itab-next = '021400'.
  append itab.

  itab-low  = '021400'.
  itab-high = '052959'.
  itab-next = '053000'.
  append itab.

  itab-low  = '053000'.
  itab-high = '103959'.
  itab-next = '104000'.
  append itab.

  loop at itab where low < p_time
                 and high > p_time.
    write itab-next.
    exit.
  endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
582

Hi,

Maybe is better than you are created a table (SE11) and add the values to which you want to do convertion to him. Soon access to that table and sera much but simple the transformation. In the programation is recommendable not to use hard. Perhaps better you functions with a conversion table.

Greetings

Ronald Mundo