In ABAP, the statement ‘COLLECT’ is used to add all numeric values of a work area into an internal table.
For example: In the example below, we will explain and demonstrate how to we will collect the data in an internal table.

*Types:
TYPES:
BEGIN OF gxs_vbbe ,
matnr TYPE vbbe-matnr,
werks TYPE vbbe-werks,
omeng TYPE vbbe-omeng,
END OF gxs_vbbe.

*Internal tables and structures:
DATA:
lt_vbbe TYPE STANDARD TABLE OF gxs_vbbe,
lt_vbbe_collected TYPE STANDARD TABLE OF gxs_vbbe,
lst_vbbe TYPE gxs_vbbe.

* Dummy retrieval for demo purposes.
SELECT matnr " Material Number
werks " Plant
omeng " Open Qty
FROM vbbe
INTO TABLE lt_vbbe
UP TO 10 ROWS.

* Looping on the internal table to be collected.
LOOP AT lt_vbbe INTO lst_vbbe.

* Collecting all numeric values into the
* internal table 'LT_VBBE_COLLECTED'.
COLLECT lst_vbbe INTO lt_vbbe_collected.

ENDLOOP.


Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Consultant
Contact : serkurumsal@yandex.com