2008 Mar 06 12:42 PM
hai dear experts,
may i know details about field group?
2008 Mar 06 1:15 PM
Field Groups / Extracts
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
Field Symbols
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb387a358411d1829f0000e829fbfe/frameset.htm
Field group:
It combines the related fields together into meaningful unit.
It provides the pre-selection so that we do not have to search through all fields of data source.
End user only has access to those fields assigned to field group.
Field symbols :
Field symbols are placeholders for other fields.
Field symbols use the memory to directly access the data from the internal table.
We do not pass the data to the header and from where we read the data which takes more time.
As a result Field Symbol is similar to a Pointer in C-Language. We can directly get the data from the memory which is very convenient.
A field symbol can point to any data object.
Does not occupy memory for the data objects.
Field should be assigned to field symbol before it is addressed in the program.
hope this code will help you.
fieldgroups
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_gr.htm
http://www.geocities.com/SiliconValley/Grid/4858/sap/ABAPCode/Fieldgroups.htm
Sample Report Code
REPORT demo_extract.
NODES: spfli, sflight.
FIELD-GROUPS: header, flight_info, flight_date.
START-OF-SELECTION.
INSERT: spfli-carrid spfli-connid sflight-fldate
INTO header,
spfli-cityfrom spfli-cityto
INTO flight_info.
GET spfli.
EXTRACT flight_info.
GET sflight.
EXTRACT flight_date.
END-OF-SELECTION.
SORT STABLE.
LOOP.
AT FIRST.
WRITE / 'Flight list'.
ULINE.
ENDAT.
AT flight_info WITH flight_date.
WRITE: / spfli-carrid , spfli-connid, sflight-fldate,
spfli-cityfrom, spfli-cityto.
ENDAT.
AT flight_date.
WRITE: / spfli-carrid , spfli-connid, sflight-fldate.
ENDAT.
AT LAST.
ULINE.
WRITE: cnt(spfli-carrid), 'Airlines'.
ULINE.
ENDAT.
ENDLOOP.
Field groups are groups similar fields together into one name. Field group works in conjuction 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 field into it. Only global data fields can be inserted and not local data fields eg : in form modules.
EXTRACT fg
--------------------------------------------------------------------------------
This will combine all the fields in the fieldgroup and write them to a sequential dataset as a single record.
SORT BY fg
--------------------------------------------------------------------------------
Sorting of sequential dataset by field group.
LOOP AND ENDLOOP
--------------------------------------------------------------------------------
LOOP.
AT ***
......
....
ENDAT.
AT ***
.....
....
ENDAT.
ENDLOOP. *
Field-Groups
Internal tables are not the only way to sort and store a series of data.
An alternative to this (which you must know, but will not often need to code) is the use of extracts.
Extracts allow you to store records with different fields in the same structure
A method similar to the style used in mainframe programming (such as COBOL) eg:
General Info
Detail
Detail
Detail
Detail
General Info
Detail
Detail
Each record in an extract dataset must be prefixed by header information, which can also be a series of fields.
Eg:
Header +General Info
Header +Detail
Header +Detail
Header +Detail
Header +Detail
Header +Detail
Header +General Info
Header +Detail
Header +Detail
Before you can use extracts, you must declare the fields in each record type in Field-Groups.
These are simple declarations which allow the programmer to assign a structure to a variable name later
The syntax is simply
FIELD-GROUP: <Field-group name>, <Field-group name>, etc
e.g.
FIELD-GROUPS: header, general, detail.
No structure is applied to these field groups, until the INSERT statement is performed at runtime (often in the INITIALIZATION event - see next page)
Regards,
Chandru
2008 Mar 06 1:47 PM
Hi,
Please refer the docu below:
FIELD-GROUPS
Basic form
FIELD-GROUPS fg.
Effect
Defines a field group.
A field group combines several existing fields together under one name. You use the INSERT statement to determine which fields belong to a field group at runtime.
Example
FIELD-GROUPS: HEADER, ORDER, PRODUCT.
Note
Neither defining a field group (statically) using FIELD-GROUPS nor filling a field group (dynamically) with INSERT generates more memory. Rather, there exists for each field group element a pointer to an (existing) field.
See You cannot define field groups in methods.
Thanks,
Sriram Ponna.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |