Você está na página 1de 1

DATA: BEGIN OF d_collect,

key(5) TYPE c,
num1(2) TYPE n,
num2 TYPE i,
END OF d_collect.
DATA itab LIKE STANDARD TABLE OF d_collect.

d_collect-key = 'First'.
d_collect-num1 = '20'.
d_collect-num2 = '30'.
COLLECT d_collect into itab.

d_collect-key = 'First'.
d_collect-num1 = '20'.
d_collect-num2 = '15'.
COLLECT d_collect into itab.

d_collect-key = 'Second'.
d_collect-num1 = '20'.
d_collect-num2 = '15'.
COLLECT d_collect into itab.

The result is as follows.


After first collect

First 20 30 >>>>> First 20 30

After Second Collect

First 20 15 >>>>> First 20 45

After Third Collect

Second 20 15 >>>>> First 20 45


Second 20 15

Please make a not that the first and the third COLLECT statements
act as insertion statements and they just append the row to the table.

Você também pode gostar