Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Processing of Internal Data →  Obsolete Extracts →  Examples of Extracts 

Extracts, Control Level Processing

This example demonstrates control level processing of extracts.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    INSERT t2 t1 INTO header.

    t1 ='AABB'. t2 = 1. EXTRACT header.
    t1 ='BBCC'. t2 = 2. EXTRACT header.
    t1 ='AAAA'. t2 = 2. EXTRACT header.
    t1 ='AABB'. t2 = 1. EXTRACT header.
    t1 ='BBBB'. t2 = 2. EXTRACT header.
    t1 ='BBCC'. t2 = 2. EXTRACT header.
    t1 ='AAAA'. t2 = 1. EXTRACT header.
    t1 ='BBBB'. t2 = 1. EXTRACT header.
    t1 ='AAAA'. t2 = 3. EXTRACT header.
    t1 ='AABB'. t2 = 1. EXTRACT header.

    SORT BY t1 t2.

    DATA(out) = cl_demo_output=>new( ).

    LOOP.

      AT FIRST.
        out->write( 'Start of LOOP' ).
        out->line( ).
      ENDAT.

      AT NEW t1.
        out->write( 'New T1' ).
      ENDAT.

      AT NEW t2.
        out->write( 'New T2' ).
      ENDAT.

      out->write( |{ t1 } { t2 }| ).

      AT END OF t2.
        out->write( 'End of T2' ).
      ENDAT.

      AT END OF t1.
        out->write( 'End of T1' ).
      ENDAT.

      AT LAST.
        out->line( ).
      ENDAT.

    ENDLOOP.

    out->display( ).

Description

An example extract is created that contains only the fields from the field group header and is sorted by these fields. The content of the data set and the resulting control level change are produced in the LOOP.