‎2007 Apr 11 8:09 AM
‎2007 Apr 11 8:13 AM
hi,
these r like pointer in C language
data a type i value 10.
field-symbol <f>.
assign a to <f>.
<f> = 20.
write a.
(no u will get the result 20 we r modifing 'a' using the field symbol <f>)
yesterday i have replied this u hsould have searched before asking
if this info is helpful reward
ravi
‎2007 Apr 11 8:11 AM
Hi Sarath,
Check this info.
Syntax Diagram
FIELD-SYMBOLS
Basic form
FIELD-SYMBOLS <fs>.
Extras:
1. ... TYPE type
2. ... TYPE REF TO cif
3. ... TYPE REF TO DATA
4. ... TYPE LINE OF type
5. ... LIKE s
6. ... LIKE LINE OF s
7. ... TYPE tabkind
8. ... STRUCTURE s DEFAULT wa
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.
You can only use one of the additions.
Example
Output aircraft type from the table SFLIGHT using a field symbol:
FIELD-SYMBOLS <PT> TYPE ANY.
DATA SFLIGHT_WA TYPE SFLIGHT.
...
ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
WRITE <PT>.
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 programs. See Defining Types Using STRUCTURE.
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:
DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS <SB> STRUCTURE SBOOK
DEFAULT SBOOK_WA.
...
WRITE: <SB>-BOOKID, <SB>-FLDATE.
For more details go thru this link.
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
If you want more examples on field symbols then go to transaction ABAPDOCU.
Hi,
A field symbol is a place holder for a field.A simple program to show the usage of field symbols.You can avoid using work areas:
Report Sample.
FIELD-SYMBOLS: <FS> TYPE SPFLI.
DATA: I_SPFLI TYPE TABLE OF SPFLI .
SELECT * FROM SPFLI INTO TABLE I_SPFLI.
LOOP AT I_SPFLI ASSIGNING <FS>.
WRITE: / <FS>-CARRID, <FS>-CONNID, <FS>-CITYFROM, <FS>-CITYTO.
ENDLOOP.
We have declared a field symbol of type SPFLI and thus we need not use a work area while looping through the internal table.
Refer:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/frameset.htm
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 11 8:12 AM
Pointer to memory field.
Please use the search function first !
regards,
Hans
Please reward all helpful answers !!!!!
‎2007 Apr 11 8:13 AM
hi,
these r like pointer in C language
data a type i value 10.
field-symbol <f>.
assign a to <f>.
<f> = 20.
write a.
(no u will get the result 20 we r modifing 'a' using the field symbol <f>)
yesterday i have replied this u hsould have searched before asking
if this info is helpful reward
ravi
‎2007 Apr 11 8:14 AM
Hi Sarath,
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.
Simple program.
data : letter(10) .
field-symbols : <fs> type any.
assign letter to <fs> type 'X'.
write <fs>.
Simple program.
TYPES: BEGIN OF NAME,
NEXTNAME(10),
FIRSTNAME(10),
LASTNAME(10),
END OF NAME.
FIELD-SYMBOLS <F> TYPE NAME.
DATA: LINE(30).
LINE = 'JOHN SMITH SHRI'.
ASSIGN LINE TO <F> CASTING.
WRITE: / 'Lastname:', <F>-LASTNAME,
'Firstname:', <F>-FIRSTNAME,
'Nextname :', <F>-NEXTNAME.
Thanks
Ravi
‎2007 Apr 11 8:14 AM
sarath,
field-symbols are place holders for existing fields. It doesn't physically reserve any space for the fields, but points to the field.
Regards...
Arun.
Reward points if useful.