Field symbols allow to access data objects dynamically in ABAP programs. Unlike staticaccess to a data object, where you need to specify the name of the object, field symbolsallow you to access and pass data objects whose name and attributes you do not knowuntil runtime. When we address a field symbol, the system works with the contents of thedata object assigned to it, and not with the contents of the field symbol itself.Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. The data object to which afield symbols points is assigned to it after it has been declared in the program.Whenever we address a field symbol in a program, you are addressing the field that isassigned to the field symbol. After successful assignment, there is no difference in ABAPwhether you reference the field symbol or the field itself. You must assign a field to eachfield symbol before you can address the latter in programs.Field symbols are similar to dereferenced pointers in C (that is, pointers to which thecontent 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 withoutthe contents operator, are reference variables in ABAP Objects.Field symbols can be created either without or with type specifications. If type is notspecified, the field symbol inherits all of the technical attributes of the field assigned to it.If we specify a type, the system checks the compatibility of the field symbol and the fieldyou are assigning to it during the ASSIGN statement.Field symbols provide greater flexibility when we address data objects:
If we want to process sections of fields, we can specify the offset and length of the field dynamically.
You we assign one field symbol to another, which allows us to address parts of fields.
Assignments to field symbols may extend beyond field boundaries. This allowsyou to address regular sequences of fields in memory efficiently.
We can also force a field symbol to take different technical attributes from thoseof the field assigned to it.The flexibility of field symbols provides elegant solutions to certain problems. On theother hand, it does mean that errors can easily occur. Since fields are not assigned to fieldsymbols 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 dataassignments.While runtime errors indicate an obvious problem, incorrect data assignments aredangerous because they can be very difficult to detect. For this reason, we should onlyuse field symbols if we cannot achieve the same result using other ABAP statements.© Manish Shankar