Skip to Content
author's profile photo Former Member
Former Member

extract statement

hi friends,

What does an extract statement do in the ABAP program?

Please let me know

Thanks

Rup

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 12:27 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 03, 2007 at 12:29 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 12:27 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.