02-12-2008 5:35 AM
Hi,
What is Field symbol and Field Group ?
Can anybody expalin me with example where and how to use Field symbol and Field group ?
02-12-2008 5:45 AM
Hi Dude,
A field symbol is a place holder for a field (i.e. a pointer). A field symbol does not reserve space for the field, but points to the field (i.e., a field symbol assumes the address of the field, not the value).
A field symbol can point to single fields or field strings (structures). Remember that the TABLES statement creates a field string with the appropriate ABAP Dictionary structure.
When working with field symbols, angle brackets (< >) must be used.
The FIELD-SYMBOLS statement is used to declare a field symbol.
A field symbols name can be up to 30 characters in length.
This name should begin with a letter and the remainder of the name should consist of letters, numbers, or an underscore.
If a field symbol is defined without attributes, it takes on the attributes of the field assigned to it.
If a field symbol is given a data type and length (either explicitly or with the LIKE addition), the system verifies that the field symbol has the same attributes as the field assigned to it.
The ASSIGN statement associates a field to a field symbol at runtime (i.e., when the program is executed).
If you change the value to a field symbol, you are really changing the value of the field assigned to the field symbol. If you write the value of the field symbol, you are really writing the value of the field assigned to the field symbol.
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)
02-12-2008 5:51 AM
Hi,
Field symbols: are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
A field group combines several existing fields together under one name
like
FIELD-GROUPS: fg.
then you can use one insert statement to insert values in fields of field-group.
INSERT f1 f2 ... INTO fg.
Field symbols
If u have experience with 'C', then understand this to be similar to a pointer.
It is used to reference another variable dynamically. So this field symbol will simply point to some other variable. and this pointer can be changed at runtime.
FIELD-SYMBOLS <FS>.
DATA FIELD VALUE 'X'.
ASSIGN FIELD TO <FS>.
WRITE <FS>.
Field symbols: are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
Field Groups:
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
Field Symbols
http://help.sap.com/saphelp_46c/helpdata/EN/fc/eb387a358411d1829f0000e829fbfe/frameset.htm
Field Groups
http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9ede35c111d1829f0000e829fbfe/frameset.htm
santosh.