Skip to content

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

Extracts, Processing

This example demonstrates how extracts are processed.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA: spfli_tab   LIKE TABLE OF spfli_wa,
          sflight_tab LIKE TABLE OF sflight_wa.

    INSERT: spfli_wa-carrid spfli_wa-connid sflight_wa-fldate
              INTO header,
            spfli_wa-cityfrom spfli_wa-cityto
              INTO flight_info.

    SELECT *
           FROM spfli
           INTO TABLE @spfli_tab.

    SELECT *
           FROM sflight
           INTO TABLE @sflight_tab.

    LOOP AT spfli_tab INTO spfli_wa.
      sflight_wa-fldate = '--------'.
      EXTRACT flight_info.
      LOOP AT sflight_tab INTO sflight_wa
              WHERE carrid = spfli_wa-carrid AND
                    connid = spfli_wa-connid.
        EXTRACT flight_date.
      ENDLOOP.
    ENDLOOP.

    SORT STABLE.
    LOOP.
      AT FIRST.
        DATA(out) = cl_demo_output=>new(
          )->begin_section( `Flight list`
          )->begin_section( `--------------------` ).
      ENDAT.
      AT flight_info WITH flight_date.
        out->next_section( |{ spfli_wa-carrid   } {
                              spfli_wa-connid   } {
                              spfli_wa-cityfrom } {
                              spfli_wa-cityto   }| ).
      ENDAT.
      AT flight_date.
        out->write( |{ spfli_wa-carrid   } {
                       spfli_wa-connid   } {
                       sflight_wa-fldate }| ).
      ENDAT.
      AT LAST.
        out->line( )->write( |{ cnt(spfli_wa-carrid) } Airlines| ).
      ENDAT.
    ENDLOOP.
    out->display( ).

Description

This example continues the example given under EXTRACT. After the extract dataset is filled, it is sorted by field group header and, afterwards, control level processing is executed in a LOOP. Here, structured output is created.