Skip to content

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

EXTRACT

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Obsolete Syntax

EXTRACT [ header | field_group ].

Effect

This statement appends the current content of the fields previously included in the field group header or field_group using the statement INSERT to the extract dataset of the program. If there is no field group specified after EXTRACT, the field group header is added implicitly.

The extract dataset is created the first time EXTRACT is executed and the first row added. Once an EXTRACT statement is executed, no other fields can be included in the specified field group field_group using INSERT. If not, a non-handleable exception is raised by the next EXTRACT statement for the same field group.

Fields of the types s, i, and int8 with the minimum value -32768, -2147483648, or -9223372036854775808 respectively are set to the value 0 when extracted to the field group header.


Notes

  • The field group header is the initial part and sort key of every field group, which means that no more fields can be included in header after EXTRACT is executed for the first time.
  • The rows of an extract dataset cannot be deleted explicitly and are persisted as long as the internal session of the program.
  • In global classes, no field groups can be defined or edited. In methods of local classes of programs other than class pools, the statement EXTRACT is possible for globally defined field groups.
  • Extracts are obsolete. Internal tables are recommended instead.

Example

This example continues the example under INSERT. The fields of the field groups flight_info and flight_date are filled in a nested LOOP and appended to the extract dataset.

REPORT ... 

DATA: spfli_wa    TYPE spfli, 
      sflight_wa  TYPE sflight, 
      spfli_tab   LIKE TABLE OF spfli_wa, 
      sflight_tab LIKE TABLE OF sflight_wa. 

FIELD-GROUPS: header, flight_info, flight_date. 

START-OF-SELECTION. 
  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. 

Exceptions

Non-Handleable Exceptions

  • Cause: EXTRACT after SORT or LOOP.
    Runtime error: EXTRACT_AFTER_SORT/LOOP
  • Cause: Not enough roll memory to create the extracts.
    Runtime error: EXTRACT_BUFFER_NO_ROLL
    Runtime error: EXTRACT_NO_ROLL_OLD_KEY
  • Cause: Too much length of a single field is occupied.
    Runtime error: EXTRACT_FIELD_TOO_LARGE
  • Cause: Problems when creating the extract dataset master file.
    Runtime error: EXTRACT_FILE_PTR_NOT_EMPTY
    Runtime error: EXTRACT_INIT_DIR_EXTRACT
    Runtime error: EXTRACT_INIT_FILEMASK_INVALID
    Runtime error: EXTRACT_INIT_FILEMASK_TOO_LARG
    Runtime error: EXTRACT_INIT_FN_EXTRACT
  • Cause: The field group HEADER was modified after EXTRACT was used to extract records.
    Runtime error: EXTRACT_HEADER_NOT_UNIQUE
  • Cause: Local data is not allowed in field groups.
    Runtime error: EXTRACT_INSERT_LOCAL_DATA
  • Cause: Error when opening the external dataset file.
    Runtime error: EXTRACT_OPEN_EXTRACTFILE_OPEN
  • Cause: Total data length of a record to be extracted (including HEADER fields) is too big.
    Runtime error: EXTRACT_TOO_LARGE