03-31-2006 2:00 PM
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
03-31-2006 2:05 PM
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.
03-31-2006 2:03 PM
Loop at it_test.
v_stest = ( it_test-field ).
Now v TEst has teh value.
endloop.
03-31-2006 2:05 PM
loop at it_test into S_TEXT.
logic.............
endloop.
Make S_TEXT has line type of it_test
Hope this helps
Regards
Manoj Gupta
03-31-2006 2:05 PM
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.
03-31-2006 2:13 PM
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
03-31-2006 2:05 PM
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
03-31-2006 2:13 PM
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.