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: 

Assign problem

MarkusKlein
Active Contributor
0 Kudos

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

Former Member
0 Kudos
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

former_member181962
Active Contributor
0 Kudos

Loop at it_test.

v_stest = ( it_test-field ).

  • Now v TEst has teh value.

endloop.

Former Member
0 Kudos

loop at it_test into S_TEXT.

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

endloop.

Make S_TEXT has line type of it_test

Hope this helps

Regards

Manoj Gupta

Former Member
0 Kudos
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.

0 Kudos

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

suresh_datti
Active Contributor
0 Kudos

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

former_member181962
Active Contributor
0 Kudos

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.