Академический Документы
Профессиональный Документы
Культура Документы
Cell Phone Xmas Sale WiFi/TV/Touchscreen all on Sale, Free Shipping & 30% Off Now! CellPhones.LightInTheBox.com
Formação de Consultor SAP Formação e Recolocação Profissional SAP no RJ - Parceira KA Solution www.dxtraining.
Compras com Descontos Compras com descontos incríveis. Até 70% de desconto. Aproveite! ClubeUrbano.GROUPON.c
Field symbol is dynamically allocated at runtime and field group is pointer to field symbol.
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 symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is
applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address
(reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE
statement between two field symbols moves the contents of the field assigned to the first field symbol to the field
assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE
statement as they did before.
You can create field symbols either without or with type specifications. If you do not specify a type, the field
symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks
the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
Field symbols provide greater flexibility when you address data objects:
If you want to process sections of fields, you can specify the offset and length of the field dynamically. You can
assign one field symbol to another, which allows you to address parts of fields. Assignments to field symbols may
extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
You can also force a field symbol to take different technical attributes from those of the field assigned to it. The
flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that
errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax
and security checks is very limited for operations involving field symbols. This can lead to runtime errors or
incorrect data assignments.
While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be
very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result
using other ABAP statements.
For example, you may want to process part of a string where the offset and length depend on the contents of the
field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset
and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if
required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field.
However, field symbols may improve performance in some cases.
Syntax : FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
http://www.sap-basis-abap.com/abap/difference-between-field-symbol-and-field-grou... 17/12/2010
Difference Between Field Symbol and Field Group Page 2 of 4
5. ... LIKE s
The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use
Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
Effect : This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the
field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field
assigned to it.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
Addition 1
... TYPE type
Addition 2
... TYPE REF TO cif
Addition 3
... TYPE REF TO DATA
Addition 4
... TYPE LINE OF type
Addition 5
... LIKE s
Addition 6
... LIKE LINE OF s
Addition 7
... TYPE tabkind
Effect : You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters
(compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries
out the same type checks as for USING parameters of FORMs.
This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD
SYMBOLS.
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode
http://www.sap-basis-abap.com/abap/difference-between-field-symbol-and-field-grou... 17/12/2010
Difference Between Field Symbol and Field Group Page 3 of 4
Effect : Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All
fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to
the work area wa specified after DEFAULT. The work area wa must be at least as long as the structure s. If s
contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise
alignment problems may occur.
Example
Address components of the flight bookings table SBOOK using a field symbol:
FIELD GROUPS are used to hold/handle large amount of data when the internal table are not useful we
use EXTRACT statement, HEADER structure in them see the example REPORT demo_extract.
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.
*-- Samiran
http://www.sap-basis-abap.com/abap/difference-between-field-symbol-and-field-grou... 17/12/2010
Difference Between Field Symbol and Field Group Page 4 of 4
Excel reporting for SAP Do SAP Finance reporting. Fast, Easy, Drill Down. Free Trial. www.excel4apps.com/sap
Leitor Symbol Ls 2208 Leitor laser c/5anos de Garantia Leitor Symbol Ls 2208 www.Libermac.com/MotorolaLs2208
SharePoint+External Data Connect native WSS/MOSS/2010 Lists Codeless: Auto-Update + Write-Back www.layer2.de
Smart Forms
SAP Smartforms
ABAP Menu:
ABAP Example Hints and Tips
Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips
http://www.sap-basis-abap.com/abap/difference-between-field-symbol-and-field-grou... 17/12/2010