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

Assign problem

MarkusKlein
Active Contributor
0 Likes
724

Hello everybody,

im having a problem using the assign statement.

This is what i need:

I have a structure at runtime called "S_TEST". This structure has 3 fields. A, B and C. A has the value 10, B is 20 and C is 30.

Now i have a internal table called "it_test". Which holds all the fieldname of structure "S_TEXT".

- A

- B

- C

What i need now is, when i loop over "it_test" to get the corresponding value of each fieldnames.

regards,

Markus

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
696
LOOP AT it_test.
  CONCATENATE 'S_TEXT-' it_test-fieldname INTO v_itab_field.
  CONDENSE v_itab_field NO-GAPS.
  TRANSLATE v_itab_field TO UPPER CASE.
  ASSIGN (v_field_name) TO <fs>.
  ... do something....
ENDLOOP.
6 REPLIES 6
Read only

Former Member
0 Likes
696

Loop at it_test.

v_stest = ( it_test-field ).

  • Now v TEst has teh value.

endloop.

Read only

Former Member
0 Likes
696

loop at it_test into S_TEXT.

logic.............

endloop.

Make S_TEXT has line type of it_test

Hope this helps

Regards

Manoj Gupta

Read only

Former Member
0 Likes
697
LOOP AT it_test.
  CONCATENATE 'S_TEXT-' it_test-fieldname INTO v_itab_field.
  CONDENSE v_itab_field NO-GAPS.
  TRANSLATE v_itab_field TO UPPER CASE.
  ASSIGN (v_field_name) TO <fs>.
  ... do something....
ENDLOOP.
Read only

0 Likes
696

Thx Srinivas

you got it

I had pretty much the same already, but instead of


ASSIGN (v_field_name) TO <fs>.

i had just


ASSIGN v_field_name TO <fs>.

and wondered why it didnt work!

thx!

regards

Markus

Read only

suresh_datti
Active Contributor
0 Likes
696

Hi,

If you want to move the values from he structure to your itab. .there is no need to loop..you can use this..


move-corresponding s_text to it_test.
append it_test.
clear it_test.

Reagrds,

Suresh Datti

Read only

Former Member
0 Likes
696

loop at it_test.

concatenate 'S_TEXT-' it_test-field

into v_field.

it_value-value = (V_FIELD).

append it_value.

clear it_value.

endloop.

it_value has the values 10, 20 and 30.