‎2006 Aug 17 8:41 AM
HI All,
Requirment is like this . I have a table looks like this .
WERKS ! LINE ! ZDATE ! ZTIME ! SHIFT ! flow(g)
1 lp 1.2.06 06:00 blue 20
1 lp 1.2.06 10:00 blue 30
1 lp 1.2.06 12:00 blue 50
1 lp 1.2.06 14:00 blue 80
1 lp 1.2.06 18:00 blue 120
I need to read the 'line' start time '6:00' to pick value for the flow(g) i.e 20 . And end of 'line' end of shift time '18:00' to pick up the value of flow '120 g ,
. So that i can calculate the varience of flow/line/shift/time/date.
Any example logic for this pls
thanks,
vin.
‎2006 Aug 17 9:22 AM
SORT ITAB BY ZTIME DESCENDING.
read table itab index 1.
end_time = itab-ztime.
SORT ITAB BY ZTIME ASCENDING.
read table itab index 1.
start_time = itab-ztime.
diff = end_time - start_time.
‎2006 Aug 17 8:59 AM
Hey,
You can use AT NEW LINE and AT END OF LINE. Move the corresponding flow values to a variable.
Reward if helpful.
Regards
‎2006 Aug 17 9:04 AM
You will have these records in an internal table before passing them to the ALV.
Read the first record and the last record and calculate required values.
to read the last line find out line size of internal table and use index.
desribe table itab lines v_lines.
if v_lines ne 0.
Last line
read table itab into wa_temp1 index v_lines.
First line
read table itab into wa_temp2 index 1.
endif.
or if you always have to read the line with time 6:00 and time 18:00, use that as a where clause in the read statement.
Hope I have understood your problem correctly.
‎2006 Aug 17 9:22 AM
SORT ITAB BY ZTIME DESCENDING.
read table itab index 1.
end_time = itab-ztime.
SORT ITAB BY ZTIME ASCENDING.
read table itab index 1.
start_time = itab-ztime.
diff = end_time - start_time.
‎2006 Aug 17 9:35 AM
Hi Vind,
U can do it this way:-
DESCRIBE TABLE iTAB LINES count.
Read table itab into wa1 index 1.
Read table itab into wa2 index count.
now u have the vlaues in wa1 and wa2 for first and last row...wa1,wa2 are work areas of the same
Hope his helps...
Regards
-
Sachin Dhingra