‎2005 Jun 29 5:30 PM
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.
‎2005 Jun 29 6:11 PM
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
‎2005 Jun 29 6:21 PM
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
‎2005 Jun 29 6:43 PM
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
‎2005 Jun 29 6:48 PM
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