1. What does an extract statement do in the ABAP program?
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 .
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 , the structure of the corresponding extract
record in the extract dataset is fixed. You can no longer insert new fields into the field groups 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.
Assume the following program is linked to the logical database F1S.
REPORT demo_extract_extract.
NODES: spfli, sflight.
FIELD-GROUPS: header, flight_info, flight_date.
INSERT: spfli-carrid spfli-connid sflight-fldate
INTO header,
spfli-cityfrom spfli-cityto
INTO flight_info.
START-OF-SELECTION.
GET spfli.
EXTRACT flight_info.
GET sflight.
EXTRACT flight_date.
There are three field groups. The INSERT statement assigns fields to two of the field groups. During the GET events, the system fills the extract dataset with two different record types. The records of the field group FLIGHT_INFO consist of five fields: SPFLI-CARRID, SPFLI-CONNID, SFLIGHT-FLDATE, SPFLI-CITYFROM, and SPFLI-CITYTO. The first three fields belong to the prefixed field group HEADER. The records of the field group FLIGHT_DATE consist only of the three fields of field group HEADER. The following figure shows the structure of the extract dataset:
Confused? Feel free to ask
Your feedback is always appreciated.I will try to reply Ur queries as soon as time allows.
Regards,
SAPhelpdesk
0 comments:
Post a Comment