‎2009 Sep 23 1:24 PM
Hi,
These are the inputs given through an internal tabe in a report.
ii001 2380 wt00 global data missing
ii001 2380 wt00 global data missing
ii001 2380 wt00 material not found
ii002 2380 wt10 missing partner detail
ii002 2380 wt10 missing partner detail
Output should display as
ii001 2380 wt00 global data missing 2
ii001 2380 wt00 material not found 1
ii002 2380 wt10 missing partner detail 2
ie it shoud count the error messages which are same and display the count.
How to apply the logic.
regards,
Mani
‎2009 Sep 23 1:28 PM
HI Mani,
use collect .
Loop at itab.
collect itab into itabsum.
endlloop.
Regards,
Vijay
‎2009 Sep 23 1:28 PM
HI Mani,
use collect .
Loop at itab.
collect itab into itabsum.
endlloop.
Regards,
Vijay
‎2009 Sep 23 1:29 PM
hi,
try this way...
"itab2 contains the same field of itab and addtional field count
Loop at itab.
read table itab2 with key <compare all fields>.
if sy-subrc = 0.
itab2 -count = itab2 -count + 1.
modify itab2 from itab1 transporting count.
else.
itab2 -count = itab2 -count + 1.
append Itab2.
endif.
endloop.
prabhudas
‎2009 Sep 23 1:34 PM
Hello
Declare another table itab2 with extra field COUNTER type i.
Then:
loop at itab1.
move-corresponding itab1 to itab2.
itab2-counter = 1. collect itab2.
endloop.
loop at itab2.
write: itab2-field1,
itab2-field2,
...
itab2-counter.
endloop.
‎2009 Sep 23 1:42 PM
say you have internal table itab1 and is1.
declare a work area of same type IS_TEMP.
declare another workarea of same type say IS2 with an extra field count.
data : gv_count type i value '1'.
now.
sort itab by field1 field 2. "all fields
loop at itab1 into is1.
if is1 = is_temp.
count = count + 1.
else.
count = 1.
endif.
is_temp = is.
move corresponding is1 to is2.
append is2 to itab2.
endloop.now itab2 holds what you need.