Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Field Symbols

Field Symbols

Ratings: (0)|Views: 225|Likes:
Published by Manish Shankar
Field Symbols
Field Symbols

More info:

Published by: Manish Shankar on Jul 14, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





S A PField Symbols
© Manish Shankar 
Field Symbols:
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 
Declaring Field Symbols:
Statement to declare a field symbol
REPORTProgramName.field-symbols<fs>type any. Data:empname(20)type c, empid(6)typen.  assignempnameto<fs>. <fs>='Raghawan'.  assignempidto<fs>. <fs>='123456'.  write:/ empname,/ empid.
For field symbols, the
angle brackets are part of the syntax
. They identify fieldsymbols in the program code.If you do not specify any additions, the field symbol <FS> can have data objects of anytype assigned to it. When you assign a data object, the field symbol inherits its technicalattributes. The data type of the assigned data object becomes the actual data type of thefield symbol.© Manish Shankar 

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->