INSERT dobj1 dobj2 ... INTO { header |
field_group }.
What does it do? This statement is used to build a structure of a field
group defined by FIELD-GROUPS of the
program's extract dataset . A list of
global flat data objects dobj can be
inserted after INSERT . The specification of local data objects
causes an exception. The list defines the components of the field group
header or field_group . Any name can be specified directly
for field_group , whereas header is a predefined name of a
special field group whose components are automatically a part and a key
of all other field groups. The components of a field group have the
function of a pointer to data objects whose contents can be attached as
a line to the extract dataset when executing the statement
EXTRACT .
The statement INSERT can be used in any
processing block of a program and is
executed at the given time during the program execution. A field group
can have different INSERT statements. A field group can be
extended with additional components till the first corresponding line
with EXTRACT is attached to the extract dataset. The field group
header can only be extended till a field group of the program is
extracted because it is a part of all field groups. An INSERT
statement for an already extracted field group causes an exception that
cannot be handled.
You can specify field symbols but not dereferenced data references for
dobj . A field symbol is ignored if no data object is assigned to
it. The specification of a data reference causes an exception that cann
ot be handled.
Latest notes: A field group field_group to which no fields are
explicitly added still contains the field of the special field group
header .
In global classes, no field groups can be defined or edited. In
methods of local classes of programs other than class pools, the sta
tement INSERT is possible for globally defined field groups.
Extracts are now obsolete. We recommend that you use
internal tables instead
Example ABAP Coding In this example, three field groups are declared in the
global declaration part of an
executable program and its components are specified in the event
block START-OF-SELECTION . The field group flight_info
contains five components of the field group header and its own.
The field group flight_date contains only the components of the
field group header .
REPORT ...
DATA: spfli_wa TYPE spfli,
sflight_wa TYPE sflight.
FIELD-GROUPS: header, flight_info, flight_date.
START-OF-SELECTION.
INSERT: spfli_wa-carrid spfli_wa-connid sflight_wa-fldate
INTO header,
spfli_wa-cityfrom spfli_wa-cityto
INTO flight_info.
Runtime Exceptions
Non-catchable Exceptions
Reason for error: Local data objects should be inserted into a field
group.
Runtime error: EXTRACT_INSERT_LOCAL_DATA
Reason for error: Field group contains INSERT after sets of this
set type have been extracted using EXTRACT .
Runtime error: INSERT_INTO_LOCKED_FIELD_GROUP
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved