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

collect itab

Former Member
0 Likes
655

i have itab (matnr,lgort,qty)

i want to make collect qty only at matnr,and append the result into another itab???

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
616

Hi rani,

1. simple.

      • Note : SUMTAB has only 2 fields, and with same name.

data : begin of sumtab occurs 0,

matnr,

qty,

end of sumtab.

LOOP AT ITAB.

move-corresponding itab to sumtab.

COLLECT SUMTAB.

ENDLOOP.

regards,

amit m.

i have itab (matnr,lgort,qty)

i want to make collect qty only at matnr,and append the result into another itab???

4 REPLIES 4
Read only

Former Member
0 Likes
616

Hello,

Try like this.

Select matnr lgort menge from mard into itab. where ...

collect itab.

append itab1.

endselect.

If useful reward points.

Rgerads,

Vasanth

Read only

Former Member
0 Likes
617

Hi rani,

1. simple.

      • Note : SUMTAB has only 2 fields, and with same name.

data : begin of sumtab occurs 0,

matnr,

qty,

end of sumtab.

LOOP AT ITAB.

move-corresponding itab to sumtab.

COLLECT SUMTAB.

ENDLOOP.

regards,

amit m.

Read only

Former Member
0 Likes
616

data: itab1 like itab.
LOOP at itab.
move itab to itab1.
collect itab into itab1.
endloop.

Provided matnr,lgort are character fields and qty is numberic.

rgds,

TM

Read only

VijayasekarK
Active Participant
0 Likes
616

Hi Rani ,

The COLLECT statement can be used with internal tables whose non-key fields are all numeric types I, P, F.

The COLLECT statement adds the work area or header line to an internal entry with the same type or, if

there is none, adds a new entry to the table.

It searches for the entry according to the table type and

defined key. If it finds an entry in the table, it adds all numeric fields that are not part of the key to the

existing values. If there is not already an entry in the table, it appends the contents of the work area or

header line to the end of the table.

Hope it clarifies your doubt.....

regards,

Vijay