Skip to Content
avatar image
Former Member

Assign problem

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Mar 31, 2006 at 01: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.
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Mar 31, 2006 at 01:03 PM

    Loop at it_test.

    v_stest = ( it_test-field ).

    • Now v TEst has teh value.

    endloop.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 31, 2006 at 01: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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2006 at 01: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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 31, 2006 at 01: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.

    Add comment
    10|10000 characters needed characters exceeded