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

Error Count

Former Member
0 Likes
650

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
590

HI Mani,

use collect .

Loop at itab.

collect itab into itabsum.

endlloop.

Regards,

Vijay

4 REPLIES 4
Read only

Former Member
0 Likes
591

HI Mani,

use collect .

Loop at itab.

collect itab into itabsum.

endlloop.

Regards,

Vijay

Read only

Former Member
0 Likes
590

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

Read only

Former Member
0 Likes
590

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.

Read only

Former Member
0 Likes
590

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.