Application Development and Automation 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: 
Read only

Extract statement

Former Member
0 Likes
914

Hi,

What does the extract statement do?

Thanks,

Sagar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
597

Hi Sagar,

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.

Regards,

Azhar

4 REPLIES 4
Read only

Former Member
0 Likes
598

Hi Sagar,

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.

Regards,

Azhar

Read only

Former Member
0 Likes
597

Hi Sagar

Since internal tables have fixed line structures, they are not suited to handle data sets with varying structures. Instead, you can use extract datasets for this purpose.

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 500KB are stored in operating system files. The practical size of an extract is up to 2GB, as long as there is enough space in the filesystem.

An extract dataset consists of a sequence of records of a pre-defined 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.

plzz reward if u found my information is usefull to u

for further quiries my mail id is mutyalasunilkumar@gmail.com

dont forget to reward.

Read only

Former Member
0 Likes
597

Hi,

This statement to be used at LDB.

By using this we can get the data from the database are a group of data.

• LDBs use Open SQL statements for direct data-reads and retrieval from the underlying vendor database application (Oracle, Informix, Sybase, etc.)

• LDBs simplify and ‘encapsulate’ data retrieval

please reward points,

regards,

satish.

Read only

former_member402443
Contributor
0 Likes
597

Hi Sagar,

Internal tables are not the only way to sort and store a series of data.An alternative to this (which you must know, but will not often need to code) is the use of extracts.

Extracts allow you to store records with different fields in the same structure

A method similar to the style used in mainframe programming (such as COBOL) eg:

General Info

Detail

Detail

Detail

Detail

General Info

Detail

Detail

Each record in an extract dataset must be prefixed by header information, which can also be a series of fields.

Before you can use extracts, you must declare the fields in each record type in Field-Groups.

These are simple declarations which allow the programmer to assign a structure to a variable name later

The syntax is simply

FIELD-GROUP: <Field-group name>, <Field-group name>, etc

e.g.

FIELD-GROUPS: header, general, detail.

No structure is applied to these field groups, until the INSERT statement is performed at runtime

Example:

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.

Reward Points, if useful.

Regards,

Manoj Kumar