Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

general

Former Member
0 Kudos

hi,

what does the EXTRACT statment in abap program?

3 REPLIES 3

Former Member
0 Kudos

Hi,

EXTRACT [ header | field_group ].

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 datset 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.

Example

This example continues the example under INSERT. If the executable program is linked to a fitting logical data base, the fields of the field groups flight_info and flight_date are attached to the extract dataset during the GET-events.

NODES: spfli, sflight.

FIELD-GROUPS: header, flight_info, flight_date.

START-OF-SELECTION.

INSERT: spfli-carrid spfli-connid sflight-fldate

INTO header,

spfli-cityfrom spfli-cityto

INTO flight_info.

GET spfli.

EXTRACT flight_info.

GET sflight.

EXTRACT flight_date.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9ed135c111d1829f0000e829fbfe/frameset.htm

Thanks.

Former Member
0 Kudos

Hi,

abstact: extract is an obsolete technique of the time when an internal table could not hold too many data. They are used similar to itabs but you don't see all data records at runtime.

check this.

REPORT demo_extract_extract.

NODES: spfli, sflight.

FIELD-GROUPS: header, flight_info, flight_date.

INSERT: spfli-carrid spfli-connid sflight-fldate

INTO header,

spfli-cityfrom spfli-cityto

INTO flight_info.

START-OF-SELECTION.

GET spfli.

EXTRACT flight_info.

GET sflight.

EXTRACT flight_date.

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9f0535c111d1829f0000e829fbfe/content.htm

Former Member
0 Kudos

Hi Ganapathi,

EXTRACT fg.

Effect

Writes all fields of the field group fg (see FIELD-GROUPS) as one record to a sequential dataset (paging). If a field group HEADER has been defined, its fields prefix each record to form a sort key. You can then sort this dataset using SORT and process it with LOOP ... ENDLOOP. After this, EXTRACT cannot be executed again.

Notes

General:

As soon as the first dataset for a field group has been extracted with EXTRACT, the field group cannot be expanded using INSERT. The field group HEADER, in particular, cannot be expanded after the first EXTRACT (regardless of field group).

Large extract datasets are not kept in main memory; instead, they are written to an external help file. You can specify the directory in which this file is to be stored using the SAP profile parameter DIR_EXTRACT. By default, the system uses the SAP file directory SAP profile parameter DIR_DATA).

Exceptions

Non-Catchable Exceptions

Cause: EXTRACT to SORT or LOOP.

Runtime Error: EXTRACT_AFTER_SORT/LOOP

Cause: Occupied length of a single field is too large.

Runtime Error: EXTRACT_FIELD_TOO_LARGE

Cause: Field group HEADER was modified after records were extracted using EXTRACT.

Runtime Error: EXTRACT_HEADER_NOT_UNIQUE

Cause: Error opening the external extract dataset file.

Runtime Error: EXTRACT_OPEN_EXTRACTFILE_OPEN

Cause: Entire data length of a record to be extracted (including HEADER fields) too large.

Runtime Error: EXTRACT_TOO_LARGE

Reward if useful.

Regards,

Chitra