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: 

extract statement

Former Member
0 Kudos

hi friends,

What does an extract statement do in the ABAP program?

Please let me know

Thanks

Rup

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi Rup

Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:

EXTRACT <fg>.

When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset

EXTRACT HEADER.

When you extract the data, the record is filled with the current values of the corresponding fields.

As soon as the system has processed the first EXTRACT statement for a field group <fg>, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups <fg> and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.

By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.

Please give some fair points on this if it is ok

Siva Kumar

3 REPLIES 3

Former Member
0 Kudos

Extracts

Since internal tables have fixed line structures, they are not suited to handle data sets with varying structures. For this purpose, ABAP offers the possibility to create so-called extract datasets (extracts, for short).

An extract is a sequential dataset in the memory area of the program. You can only address the entries in the dataset within a special loop. The index or key access permitted with internal tables is not allowed. You may only create one extract in any ABAP program. The size of an extract dataset is, in principle, unlimited. Extracts larger than 500 KB are stored in operating system files. The practical size of an extract is up to 2 GB, as long as there is enough space in the file system.

An extract dataset consists of a sequence of records of a predefined structure. However, the structure need not be identical for all records. In one extract dataset, you can store records of different length and structure one after the other. You need not create an individual dataset for each different structure you want to store. This fact reduces the maintenance effort considerably.

In contrast to internal tables, the system partly compresses extract datasets when storing them. This reduces the storage space required. In addition, you need not specify the structure of an extract dataset at the beginning of the program, but you can determine it dynamically during the flow of the program.

You can use control level processing with extracts just as you can with internal tables. The internal administration for extract datasets is optimized so that it is quicker to use an extract for control level processing than an internal table.

http://help.sap.com/saphelp_nw70/helpdata/en/9f/db9ed135c111d1829f0000e829fbfe/content.htm

http://www.sap-img.com/abap/difference-between-extract-and-collect-statements.htm

Former Member
0 Kudos

hi Rup

Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:

EXTRACT <fg>.

When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset

EXTRACT HEADER.

When you extract the data, the record is filled with the current values of the corresponding fields.

As soon as the system has processed the first EXTRACT statement for a field group <fg>, the structure of the corresponding extract record in the extract dataset is fixed. You can no longer insert new fields into the field groups <fg> and HEADER. If you try to modify one of the field groups afterwards and use it in another EXTRACT statement, a runtime error occurs.

By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.

Please give some fair points on this if it is ok

Siva Kumar