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 using OO

Former Member
0 Likes
733

Does anyone know how to use the instruction collect using OO programming?

Cheers,

Nuno A.

2 REPLIES 2
Read only

Former Member
0 Likes
559

The collect statement is used to sum the values of fields of type n and p. I would be suprised if you can use this same statement for collecting objects into an internal table.

Read only

jaideeps
Product and Topic Expert
Product and Topic Expert
0 Likes
559

hi,

the collect function is same as in normal abap..

chk out this sample for collect,..

DATA: BEGIN OF line,

col1(3) TYPE c,

col2(2) TYPE n,

col3 TYPE i,

END OF line.

DATA itab LIKE SORTED TABLE OF line

WITH NON-UNIQUE KEY col1 col2.

line-col1 = 'abc'. line-col2 = '12'. line-col3 = 3.

COLLECT line INTO itab.

WRITE / sy-tabix.

line-col1 = 'def'. line-col2 = '34'. line-col3 = 5.

COLLECT line INTO itab.

WRITE / sy-tabix.

line-col1 = 'abc'. line-col2 = '12'. line-col3 = 7.

COLLECT line INTO itab.

WRITE / sy-tabix.

LOOP AT itab INTO line.

WRITE: / line-col1, line-col2, line-col3.

ENDLOOP.

or paste ur code regarding collect..we will solve it..

thanks

jaideep

*reward points if useful...