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: 

what does extract statement do?

Former Member
0 Kudos

Hi all,

Can u all tel me abt what does extract statement does and in which part does it play a major role?

5 REPLIES 5

Former Member
0 Kudos

extract statement will fill the field group with the records

Former Member
0 Kudos

Hi,

EXTRACT

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

REPORT demo_extract.

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

VB09104
Active Participant
0 Kudos

Use F1...

former_member386202
Active Contributor
0 Kudos

Hi,

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

Regards,

Prashant