‎2009 Jan 12 3:55 PM
Is it possible to replace a Collect statement by using a Hash Table and Insert
statements? If so, how?
Thanks
‎2009 Jan 12 4:04 PM
Hi
Yes u can try to do it, but u need to use READ and MODIFY statament in order to update a record just loaded in the table:
READ TABLE ITAB WITH KEY FIELD = .....
IF SY-SUBRC = 0.
ITAB-FIELD2 = ITAB-FIELD2 + .......
MODIFY ITAB INDEX SY-TABIX.
ELSE.
INSERT ITAB INTO TABLE ITAB.
ENDIF.
Max
‎2009 Jan 12 4:03 PM
yes it is possible (and by big internal tables it is advised to do so):
read the internal table for the line:
-if found: summarize numeric values and modify the line in the internal table
-if not found: insert the new line
‎2009 Jan 12 4:03 PM
HI,
You need do the Sum on the integer and Num Fields and insert the data to Hash table.
As Collect Statement add the NUM and INT fields where all Other Char fields has the same value.
‎2009 Jan 12 4:04 PM
Hi
Yes u can try to do it, but u need to use READ and MODIFY statament in order to update a record just loaded in the table:
READ TABLE ITAB WITH KEY FIELD = .....
IF SY-SUBRC = 0.
ITAB-FIELD2 = ITAB-FIELD2 + .......
MODIFY ITAB INDEX SY-TABIX.
ELSE.
INSERT ITAB INTO TABLE ITAB.
ENDIF.
Max