Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Extracts 

EXTRACT

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Obsolete Syntax

EXTRACT [ header | field_group ].

Effect

This statement links the current content of the fields, which were until then included in the field group header resp. field_group via the statement INSERT , to the extract dataset of the program. If there is no field group specified after EXTRACT, then the field group header is implicitly added.

At the first execution of the EXTRACT-statement of a program, the extract dataset is created and the first line added. After execution of an EXTRACT-statement, it is not allowed to incorporate other fields to the specified field group field_group with the INSERT statement. If you do so, an uncatchable exception will be raised at the next EXTRACT-statement for the same field group.


Notes

  • As the field group header is the beginning part and sort key of every field group, it is not allowed to incorporate fields into header after execution of the first EXTRACT statement.
  • The lines of an extract dataset cannot be explicitly deleted and will be kept alive as long as the internal mode 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 now obsolete. We recommend that you use internal tables instead

Example

This example continues the example under INSERT. The fields of the field groups flight_info and flight_date are filled into a nested LOOPand 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-Catchable 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: The occupied lenght of a single field is too large.
    Runtime Error: EXTRACT_FIELD_TOO_LARGE
  • Cause: Problems at creation of 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: Field group HEADER was modified after extraction of records with EXTRACT.
    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 extract dataset master file.
    Runtime Error: EXTRACT_OPEN_EXTRACTFILE_OPEN
  • Cause: Total data length of a record to be extracted (inclusive HEADER-fields) is too large.
    Runtime Error: EXTRACT_TOO_LARGE