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
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.
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,
material(20) TYPE C.
FIELD-GROUPS: order , mat .
INSERT customer order INTO order. * insering two fields in the field
INSERT quantity material INTO mat .
customer = 'niraj visnoi'
order = '100001'
*writing the contents of field group
material = '1004.'
quantity = 500.
customer = 'rahul'
order = '100002'
material = '1006.'
quantity = 200.
SORT BY order. * sorting of sequential dataset
by field group order
AT order .
WRITE: customer, order.
The field symbols work similarly to pointers in C. They are used in conjunction with statement
ASSIGN f TO <fs> .
At runtime we can assign a field or structure to the field symbol , any changes or work
can be done on the field symbol affecting directly the assigned field. The syntax of field symbol declaration is:
Declares a field symbol <fs> which can be assigned any single field.
FIELD-SYMBOL <fs> TYPE /LIKE type.
Declares a field symbol <fs> which can be assigned any single field
which is of particular type.
FIELD-SYMBOL <fs> STRUCTURE s DEFAULT wa.
Declares a field symbol <fs> which will point to a structure(table) and the
default work area will be wa.
FIELD-SYMBOL <fs> TYPE LINE OF /LIKE LINE OF type.
Declares a field symbol <fs> which will have line type .
e.g. FIELD-SYMBOLS <fs>
* Customer master
ASSIGN kna1-kunnr TO <fs>.
ASSIGN f TO <fs>
This will assign the field f to field symbol <fs>,now we can work with the field
symbol instead of the field.
Type-pools are used to declare a type pool to be used in the program.The
specified type pool should already exists in the ABAP DICTONARY(SE11).Once the type pool has been declared we can use any
of the constants and types declared in that type pool.
Type-pool statement is used to create a type group in the ABAP dictionary.It
is the first statement in the definition.The type group is used to declare constants and types and these must begin with the
name of the type pool and underscore.
e.g. TYPE-POOL owntypes.
TYPES num TYPE P DECIMALS 2.
TYPES name(14) TYPE C.
To use these types in the abap program we have to use the statement
e.g. TYPE-POOLS owntypes.
DATA customer TYPE owntypes_num.