2012 Oct 07 6:55 PM
I have internal table t_first with values
orderno date time_real capacity
1000 29.09.2012 09:00:00 2000
1000 29.09.2012 15:00:00 3000
1000 29.09.2012 16:00:00 4000
2000 30.09.2012 08:00:00 3000
my requirement is to fill the second internal table t_second with following format.
orderno date start_time end_time capacity
1000 29.09.2012 00:00:01 09:00:00 2000
1000 29.09.2012 09:00:01 15:00:00 5000
1000 29.09.2012 15:00:01 16:00:01 9000
2000 30.09.2012 00:00:01 08:00:01 3000
The requirement is:
1.Each day should start with start_time 00:00:01 and end time is time_real from
the first internal table.
2 The capacity values should be cumulative values as shown above .
can any one suggest optimized logic to get the entries in the second internal table as shown above.
2012 Oct 07 7:12 PM
I have internal table t_first with values
orderno date time_real capacity
1000 29.09.2012 09:00:00 2000
1000 29.09.2012 15:00:00 3000
1000 29.09.2012 16:00:00 4000
2000 30.09.2012 08:00:00 3000
my requirement is to fill the second internal table t_second with following format.
orderno date start_time end_time capacity
1000 29.09.2012 00:00:01 09:00:00 2000
1000 29.09.2012 09:00:01 15:00:00 5000
1000 29.09.2012 15:00:01 16:00:00 9000
2000 30.09.2012 00:00:01 08:00:00 3000
The requirement is:
1.Each day should start with start_time 00:00:01 and end time is time_real from
the first internal table.
2 The capacity values should be cumulative values as shown above .
can any one suggest optimized logic to get the entries in the second internal table as shown above.
I have internal table t_first with values
orderno date time_real capacity
1000 29.09.2012 09:00:00 2000
1000 29.09.2012 15:00:00 3000
1000 29.09.2012 16:00:00 4000
2000 30.09.2012 08:00:00 3000
my requirement is to fill the second internal table t_second with following format.
orderno date start_time end_time capacity
1000 29.09.2012 00:00:01 09:00:00 2000
1000 29.09.2012 09:00:01 15:00:00 5000
1000 29.09.2012 15:00:01 16:00:01 9000
2000 30.09.2012 00:00:01 08:00:01 3000
The requirement is:
1.Each day should start with start_time 00:00:01 and end time is time_real from
the first internal table.
2 The capacity values should be cumulative values as shown above .
can any one suggest optimized logic to get the entries in the second internal table as shown above.
2012 Oct 07 7:12 PM
I have internal table t_first with values
orderno date time_real capacity
1000 29.09.2012 09:00:00 2000
1000 29.09.2012 15:00:00 3000
1000 29.09.2012 16:00:00 4000
2000 30.09.2012 08:00:00 3000
my requirement is to fill the second internal table t_second with following format.
orderno date start_time end_time capacity
1000 29.09.2012 00:00:01 09:00:00 2000
1000 29.09.2012 09:00:01 15:00:00 5000
1000 29.09.2012 15:00:01 16:00:00 9000
2000 30.09.2012 00:00:01 08:00:00 3000
The requirement is:
1.Each day should start with start_time 00:00:01 and end time is time_real from
the first internal table.
2 The capacity values should be cumulative values as shown above .
can any one suggest optimized logic to get the entries in the second internal table as shown above.
2012 Oct 08 7:29 AM
Hi Kiran,
Please check the below code:
DATA:BEGIN OF gs_itab1,
orderno TYPE char10,
date TYPE dats,
time TYPE tims,
capacity TYPE cifmaxc,
END OF gs_itab1.
DATA:gt_itab1 LIKE STANDARD TABLE OF gs_itab1.
DATA:BEGIN OF gs_itab2,
orderno TYPE char10,
date TYPE dats,
s_time TYPE tims,
e_time TYPE tims,
capacity TYPE cifmaxc,
END OF gs_itab2.
DATA:gt_itab2 LIKE SORTED TABLE OF gs_itab2 WITH NON-UNIQUE KEY orderno.
DATA:gv_capacity TYPE cifmaxc,
gv_s_time TYPE tims VALUE '000001',
gv_stime TYPE char2.
gs_itab1-orderno = '1000'.
gs_itab1-date = '20120929'.
gs_itab1-time = '09'.
gs_itab1-capacity = '2000'.
APPEND gs_itab1 TO gt_itab1.
gs_itab1-orderno = '1000'.
gs_itab1-date = '20120929'.
gs_itab1-time = '15'.
gs_itab1-capacity = '3000'.
APPEND gs_itab1 TO gt_itab1.
gs_itab1-orderno = '1000'.
gs_itab1-date = '20120929'.
gs_itab1-time = '16'.
gs_itab1-capacity = '4000'.
APPEND gs_itab1 TO gt_itab1.
gs_itab1-orderno = '2000'.
gs_itab1-date = '20120930'.
gs_itab1-time = '08'.
gs_itab1-capacity = '3000'.
APPEND gs_itab1 TO gt_itab1.
SORT gt_itab1 BY orderno.
LOOP AT gt_itab1 INTO gs_itab1.
gs_itab2-orderno = gs_itab1-orderno.
gs_itab2-date = gs_itab1-date.
gv_s_time(2) = gv_stime.
AT FIRST.
gv_s_time = '000001'.
ENDAT.
AT NEW date.
gs_itab2-capacity = gv_capacity.
gv_s_time = '000001'.
ENDAT.
gs_itab2-s_time = gv_s_time.
gs_itab2-e_time = gs_itab1-time.
gs_itab2-capacity = gs_itab2-capacity + gs_itab1-capacity.
gv_capacity = gs_itab1-capacity.
gv_stime = gs_itab1-time(2).
APPEND gs_itab2 TO gt_itab2.
CLEAR: gv_capacity.
ENDLOOP.
write:/ 'First internal table'.
skip.
LOOP AT gt_itab1 INTO gs_itab1.
WRITE:/ gs_itab1-orderno,
gs_itab1-date,
gs_itab1-time,
gs_itab1-capacity.
ENDLOOP.
ULINE.
write:/ 'Second internal table'.
skip.
LOOP AT gt_itab2 INTO gs_itab2.
WRITE:/ gs_itab2-orderno,
gs_itab2-date,
gs_itab2-s_time,
gs_itab2-e_time,
gs_itab2-capacity.
ENDLOOP.
Output will be like below:
With regards,
2012 Oct 08 7:43 PM