sapdev logo background
sapdev logo sapdev logo
Comments

ABAP COLLECT statement syntax to add up all numeric itab values with SAP




This ABAP statement works in a similar way to APPEND and inserts the contents of a work area into an internal table. But instead of simply adding to the end of the itab, it first checks for entries with the same key and then adds to the numeric values of existing row with that same key.

Please note: The key is made up of all fields before numeric field and they must all be the same!

Here is and example ABAP code snipet that demonstrates the use of the COLLECT statement

data: it_ekko type STANDARD TABLE OF ekko,
      wa_ekko like line of it_ekko.

COLLECT wa_ekko into it_ekko.




comments powered by Disqus