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

Using COLLECT statement except for the specific column

Former Member
0 Likes
1,392

Can I use the COLLECT statement except for the specific column as below?

Example)

A   BR   BR40   100

A   BR   BR41   200

A   CR   BR40   300

Result)

A   BR   Total   300
             BR40  100

             BR41   200

A   CR   BR40  300

I want to make it by using COLLECT statment or others.

Please help me.

1 REPLY 1
Read only

ArcherZhang
Product and Topic Expert
Product and Topic Expert
0 Likes
1,026

Hi Minsuk,

Define source_itab, result_itab, final_itab with same structure.

LOOP source_itab INTO source_wa.

   source_wa-field3 = ''.

   COLLECT source_wa TO result_itab.

ENDLOOP.

LOOP result_itab INTO result_wa.

   APPEND result_wa TO final_itab.

   LOOP source_itab INTO source_wa WHERE field1 = result_wa-field1.AND field2 = ...

     APPEND source_wa INTO final_itab.

   ENDLOOP.

ENDLOOP.

BRs,

Archer