Skip to Content
avatar image
Former Member

Assigning a Dynamic Variable

Dear Gurus

I want to ask about next code section. On ECC 6, the next statement is working out fine, but somehow, it's giving a short dump in 4.6c, because the second line(ASSIGN statement) is giving out SY-SUBRC = 4. and l_value is trying to access <fvalu> which is not assigned properly(or so they say in the dump).

wa_Data-ebeln = '1000000000'.

g_String = 'WA_DATA-EBELN'.

ASSIGN (g_string) TO <fvalu>.

l_value = <fvalu>.

Can anybody help to tell me what's wrong with the code? I am trying to get the value of WA_DATA-EBELN based on the field string 'WA_DATA-EBELN'. I am expecting l_value's value to be 1000000000. Is there any other way to do this kind of thing? (4.6c environment)

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 17, 2008 at 01:54 AM

    Hey...Andre ...

    * CONCATENATE 'PS_WAREA-' g_string INTO g_string.
    * ASSIGN (g_string) TO <fvalu>. " Andres code
      ASSIGN COMPONENT g_string OF STRUCTURE ps_warea TO <fvalu>.

    Hey Andre, problem got solved... 😊

    Regards

    Gopi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 16, 2008 at 03:41 PM

    Using the Assign statement in 4.6c

    DATA dref TYPE REF TO data.

    FIELD-SYMBOLS <l_dobj> TYPE ANY.

    CREATE DATA dref LIKE g_dobj.

    ASSIGN dref->* TO <l_dobj>.

    <l_dobj> = g_dobj.

    <l_dobj> = <l_dobj> + 1.

    WRITE: / g_dobj, <l_dobj>.

    Hope this helps,

    Sudhir.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 16, 2008 at 04:10 PM

    Better you should have tried in the ABAP forum. any how, try this link

    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/frameset.htm

    Regards, IA

    Add comment
    10|10000 characters needed characters exceeded