What does an extract statement do in the ABAP program?

Answer Posted / shankar

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.

Each extract record contains exactly those fields that are contained in the field group <fg>, plus the fields of the field group HEADER (if one exists). The fields from HEADER occur as a sort key at the beginning of the record. If you do not explicitly specify a field group <fg>, the EXTRACT statement is a shortened form of the statement extracts used in field groups (version 2.x - obsolete these days as noone uses field groups anymore), and collect is used to accumulate the contents of a field if X no. of keys are the same.

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.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How the at-user command serves mainly in lists?

616


What is an interactive report?

618


Explain the inside concept in select-options?

559


Explain Singleton class

833


Mention what is alv programming in abap?

582






What are field symbols?

631


what is the purpose of BAPI BAPI_CUSTMATINFO_GETLIST What is input and output of this BAPI.

2058


What are the different types of work process?

588


How to eliminate duplicate entries in internal tables?

677


What is off cycle payroll run

1784


In sap script how to print bar code in vertical manner

2630


Which infotype records can not be deleted ? : abap hr

606


How do you find out whether a file exits on the presentation server?

565


Define alv programming in abap?

698


What is the difference between skip and new-line?

795