Application Development and Automation 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: 
Read only

Difference between Static and Dynamic Field Symbol

Former Member
0 Likes
1,194

Hi All,

Can you please suggest the syntax for assigning field symbols for the below requirement:

field-symbols: <fs_zzbol> type any.

data : l_zzbol(30).

if sy-tcode eq 'ME21N'.

l_zzbol = '(SAPLMEPO)EKKO-ZZBOL'.

elseif sy-tcode eq 'ME21'.

l_zzbol = '(SAPMM06E)EKKO-ZZBOL'.

endif.

Now my doubt is : how to assign l_zzbol to <fs_zzbol>?

Like 1. assign l_zzbol to <fs_zzbol>.

or 2. assign (l_zzbol) to <fs_zzbol>.

It would be helpful if you suggest me the reason.

Thanks,

Sanjeet

Hi All,

Can you please suggest the syntax for assigning field symbols for the below requirement:

field-symbols: <fs_zzbol> type any.

data : l_zzbol(30).

if sy-tcode eq 'ME21N'.

l_zzbol = '(SAPLMEPO)EKKO-ZZBOL'.

elseif sy-tcode eq 'ME21'.

l_zzbol = '(SAPMM06E)EKKO-ZZBOL'.

endif.

Now my doubt is : how to assign l_zzbol to <fs_zzbol>?

Like 1. assign l_zzbol to <fs_zzbol>.

or 2. assign (l_zzbol) to <fs_zzbol>.

It would be helpful if you suggest me the reason.

Thanks,

Sanjeet

4 REPLIES 4
Read only

Former Member
0 Likes
782

Hi,

Take that field l_zzbol as one of fields in that fileld symbol.

than move that fileld (l_zzbol) tho that filed symbol <fs_zzbol>-zzbol. (filed what you taken )

and modify that table with that field symbol with transporting that fileld.

Thanks

Read only

0 Likes
782

There is no field attached to the <fs_zzbol>.

This has been just defined as :

field symbols :<fs_zzbol> type any.

So I can not modify using transporting key word.

It is basically the concept of Static and Dynamic Field Symbol that I am not able to diffrerentiate.

Thanks,

Sanjeet

Read only

former_member156446
Active Contributor
0 Likes
782

Hi Sanjeet... try this way..

field-symbols: <fs_zzbol> type any.

if sy-tcode eq 'ME21N'.
assign '(SAPLMEPO)EKKO-ZZBOL' to <fs_zzbol>.
elseif sy-tcode eq 'ME21'.
Assign '(SAPMM06E)EKKO-ZZBOL' to <fs_zzbol>.
endif.

Read only

MarcinPciak
Active Contributor
0 Likes
782

Hi Sanjeet,

Basically when you assing field to field symbol you write

assign field_name to <field_symbol>. 

In this case you don't know at runtime what field you want to take the value from, (definitelly it is not field_name but name of the field which is in the field_name

i.e. (SAPLMEPO)EKKO-ZZBOL ). Therefore you can write this:


assing ('(SAPLMEPO)EKKO-ZZBOL') to <field_symbol>.

...which in turn can be replaced with.


l_zzbol = '(SAPLMEPO)EKKO-ZZBOL'.
assign (l_zzbol) to <fs_zzbol>.

Golden rule:always ask yourself if you know which field you are addressing. If you can't statically evaluate it ( field_name is not of interest here but what is in it), you must put it in brackets (meaning system will get its name during runtime from field_name ).

Hope it will clarify how to use field symbol.

Regards

Marcin