FIELD-GROUPS fg
Field groups are used to group similar fields together into one name. Filed groups can be used in conjunction
with
INSERT f1 f2 INTO fg
EXTRACT fg
SORT BY fg
LOOP ... ENDLOOP
INSERT f1 f2 INTO fg
The INSERT statement is used to create a field group dynamically by
inserting the fields into it.Only global data fields can be inserted and not
local data fields e.g. in FORM modules.
EXTRACT fg
This statement will combine all the fields in the fieldgroup and write them to a sequential dataset as a single
record.
e.g. DATA: customer(14) TYPE C,
order(20) TYPE
C,
quantity(5)
TYPE N,
material(20)
TYPE C.
FIELD-GROUPS: order , mat .
INSERT customer order INTO order. * insering two fields in the field
*group
order
INSERT quantity material INTO mat .
customer = 'niraj visnoi'
order = '100001'
EXTRACT order.
*writing the contents of field group
*order
to dataset
material = '1004.'
quantity = 500.
EXTRACT mat.
customer = 'rahul'
order = '100002'
EXTRACT order.
material = '1006.'
quantity = 200.
EXTRACT mat.
SORT BY order. * sorting of sequential dataset
by field group order
LOOP .
AT order .
WRITE: customer, order.
ENDAT.
AT mat.
WRITE: material,quantity.
ENDAT.
ENDLOOP.