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

Transform value into variable

Former Member
0 Likes
467

Hi all. I need to clear a field in a structure, but the problem is that this field is known only during runtime and is contained as a value of another field (lv_need_clear). How can the value be into transformed into variable?


CONCATENATE 'ls_bapi_' <ls_matdata>-tabname 'x' '-' 
<ls_dd03p>-deffdname INTO lv_need_clear.
 CLEAR  "...???

3 REPLIES 3
Read only

pavel_parshenkov2
Participant
0 Likes
445

hi, try this code.

FIELD-SYMBOLS <fs>.

ASSIGN COMPONENT (lv_need_clear) OF STRUCTURE Your Structure name TO <fs>.

CHECK sy-subrc EQ 0.

CLEAR <fs>.

Read only

0 Likes
445

Thanks, but the structure is also known only during runtime, as well as the field I need to clear.

Read only

0 Likes
445

u can assign structure too.

FIELD-SYMBOLS <fs_struc> TYPE ANY.

ASSIGN (structure_name) TO <fs_struc>.

check sy-subrc EQ 0.

then.

ASSIGN COMPONENT (field_name) OF structure <fs_struct> TO <fs>.