07-12-2007 12:31 PM
Does anyone know how to use the instruction collect using OO programming?
Cheers,
Nuno A.
07-12-2007 12:39 PM
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.
07-12-2007 2:19 PM
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...