2007 Feb 20 6:42 AM
hi experts,
I want to assig na value to an field-symbol.
This is my code:
FIELD-SYMBOLS: <FS_ANY> TYPE ANY.
ASSIGN ('(SAPMF02K)ADDR_COMPLETE-ADDR_TAB[1]-DATA-STR_SUPPL1' ) TO <FS_ANY>.
but this is givingn error.
Please help me.
2007 Feb 20 6:53 AM
Hi Srinivas,
FIELD-SYMBOLS: <FS_ANY> TYPE ANY.
ASSIGN ('(SAPMF02K)ADDR_COMPLETE-ADDR_TAB[1]-DATA-STR_SUPPL1') TO <FS_ANY>.
This is working fine.Just check out. I am not getting any error.
Regards,
Priyanka.
2007 Feb 20 6:57 AM
hi priyanka,
I do not get any value in the field-symbol.Instead i get the string written in front of the assign command.
Please check
2007 Feb 20 6:59 AM
Hi,
Assign it to a local variable n try to assign that variable to the field symbol.
Then it is working fine.
Regards,
Priyanka.
2007 Feb 20 7:06 AM
I tried doing that also.
It dives errror saying the <fs> is not assigned.
tell me the value you get in <fs>.
i have created an implementation for vendor_add_data and from transaction xk02 i extract data in the method check_all_data of the BADI.Here it gives me error.
2007 Feb 20 7:18 AM
hi ,
(SAPMF02K)ADDR_COMPLETE-ADDR_TAB[1]-DATA-STR_SUPPL1
this was the output which i got.
&----
*& Report ZP *
*& *
&----
*& *
*& *
&----
REPORT ZP .
FIELD-SYMBOLS: <FS_ANY> TYPE ANY.
DATA : VARNAME TYPE string value
'(SAPMF02K)ADDR_COMPLETE-ADDR_TAB[1]-DATA-STR_SUPPL1'.
ASSIGN VARNAME TO <FS_ANY>.
write:/ <FS_ANY>.
Regards,
Priyanka.
2007 Feb 20 6:55 AM
srinivas,
Try like below.
DATA : VARNAME(50) TYPE C.
FIELD-SYMBOLS : <FS_ANY>
VARNAME = '(SAPMF02K)ADDR_COMPLETE-ADDR_TAB[1]-DATA-
STR_SUPPL1'
ASSIGN (VARNAME) TO <FS_ANY>.
Pls. mark if useful
2007 Feb 20 7:13 AM
Hi
Field symbols offer functionlity similar to pointers in other programming languages. It does not occupy memory for the data object, it points to the object that has been assigned to the field symbol. You use the assign command to relate to the data object. After the assign operation you can work with field symbol in the same way as with the object itself.
You define the field symbol as: field-symbols <fs>.
Consider this:
field-symbol <fs>.
data field value 'X'.
asssign field to <fs>.
The field symbol <fs> now inherits all the properties from the assigned field, and you can work with the field symbol in the same way as with the field itself.
Take a look at the examples given here for working with field symbols:
http://www.sapgenie.com/abap/code/chap2401.txt
http://www.sapgenie.com/abap/code/chap2402.txt
http://www.sapgenie.com/abap/code/chap2403.txt
Regards,
kumar