‎2005 Nov 22 1:09 AM
TYPES: BEGIN OF NAME,
FIRSTNAME(10),
LASTNAME(10),
END OF NAME.
data : person1 type standard table of name with header line.
start-of-selection.
person1-firstname = 'Shiv'.
person1-lastname = 'Kasthala'.
append person1.
clear person1.
FIELD-SYMBOLS <fs> TYPE table.
assign person1 to <fs>.
This sample code gives me a syntax error that person1 and <fs> are in-compatible. Can anybody please suggest me the reason why?
Also, can some body guide me to some documentation where I can use dynamic programming in daily ABAP.
‎2005 Nov 22 1:26 AM
try this code
data: BEGIN OF person1 occurs 0,
FIRSTNAME(10),
LASTNAME(10),
END OF person1.
start-of-selection.
person1-firstname = 'Shiv'.
person1-lastname = 'Kasthala'.
append person1.
clear person1.
FIELD-SYMBOLS <fs> TYPE any table.
assign person1[] to <fs>.
In your code person1 is assigned to field symbol which has only work area not entire table.
‎2005 Nov 22 1:26 AM
try this code
data: BEGIN OF person1 occurs 0,
FIRSTNAME(10),
LASTNAME(10),
END OF person1.
start-of-selection.
person1-firstname = 'Shiv'.
person1-lastname = 'Kasthala'.
append person1.
clear person1.
FIELD-SYMBOLS <fs> TYPE any table.
assign person1[] to <fs>.
In your code person1 is assigned to field symbol which has only work area not entire table.
‎2005 Nov 22 1:31 AM
hi, no need to do any change, only replace one line as following:
replace
ASSIGN PERSON1 TO <FS>.
with
ASSIGN person1[] to <fs>.
the compile failure due to person1 has header line.
<FS> is table type.
So compiler treat 'assign person1 to <fs>.' as header line assigned to a table type field symbol.
So it failed.
thanks
‎2005 Nov 22 5:54 AM
hi,
person1 is of type standard table,
define
field-symbol <fs> type standard table of name.
try this, may be this will work.
regards,
manohar.
‎2005 Nov 22 10:21 PM
Ok. So, now how can I get the contents of a field symbol on the screen if the field symbol is of type "standard table".
‎2005 Nov 22 10:46 PM
see below code, its the same code but I have added one more workarea called person and I assigned from field symbol and printed.
data: BEGIN OF person1 occurs 0,
FIRSTNAME(10),
LASTNAME(10),
END OF person1.
data: BEGIN OF person,
FIRSTNAME(10),
LASTNAME(10),
END OF person.
start-of-selection.
person1-firstname = 'Shiv'.
person1-lastname = 'Kasthala'.
append person1.
clear person1.
FIELD-SYMBOLS <fs> TYPE any table.
assign person1[] to <fs>.
loop at <fs> into person.
write : / person-firstname, person-lastname.
endloop.
‎2005 Nov 22 10:53 PM
Thanks Satyanarayana, I have awardded you points for that. Just one more thing:
1. Can you tell me how & where can i use field symbols in daily ABAP programming. As such I m not able to find any use to it.
Example: Can it be used to display the internal table contents of any internal table declared in a program irrespective of its structure.
‎2005 Nov 22 11:05 PM