Register Login

Using Field Groups, Collect, Sort and Extract Keywords

Updated May 18, 2018

REPORT ZZBGS008 .

*-------------------------------*

* Example program: Use of FIELD-GROUPS, COLLECT, SORT, EXTRACT*

*--------------------------------*

TABLES: T001.

DATA: BEGIN OF RESULT OCCURS 100.

DATA:   

MANDT LIKE T001-MANDT,

BUKRS LIKE T001-BUKRS,
BUTXT LIKE T001-BUTXT,
ORT01 LIKE T001-ORT01,
LAND1 LIKE T001-LAND1,
WAERS LIKE T001-WAERS,
SPRAS LIKE T001-SPRAS,
KTOPL LIKE T001-KTOPL. 
                               "
DATA: END OF RESULT.

FIELD-GROUPS: HEADER, DATA.
  
INSERT
    
T001-SPRAS                         " SPROGNØGLE
T001-MANDT                         " CLIENT
T001-BUKRS                         " FIRMACODE

'INTO HEADER.

INSERT
    
T001-BUTXT                         "
T001-ORT01                         " BY
T001-LAND1                         " LANDENØGLE
T001-WAERS                         " VALUTANØGLE

INTO DATA.

START-OF-SELECTION.

REFRESH RESULT.
SELECT * FROM T001.
EXTRACT DATA.
ENDSELECT.

END-OF-SELECTION.

SORT BY T001-SPRAS T001-MANDT T001-BUKRS.

LOOP.

MOVE-CORRESPONDING T001 TO RESULT.

APPEND RESULT.

ENDLOOP.


×