Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

field-symbols: urgent

Former Member
0 Kudos
129

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.

7 REPLIES 7

Former Member
0 Kudos
91

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.

0 Kudos
91

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

0 Kudos
91

Hi,

Assign it to a local variable n try to assign that variable to the field symbol.

Then it is working fine.

Regards,

Priyanka.

0 Kudos
91

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.

0 Kudos
91

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.

Former Member
0 Kudos
91

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

sreeramkumar_madisetty
Active Contributor
0 Kudos
91

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