Skip to Content
author's profile photo Former Member
Former Member

How to convert field symbol to an internal table?

Hi all,

How to convert Field symbol (which is an internal table) into an internal table.The Field symbol is being populated dynamically hence the structure is not fix.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jan 07, 2008 at 08:19 AM

    Hello Daphne,

    See this code, i'm not sure if its exactly what you want

    DATA : LV_DBTAB1 LIKE DD02L-TABNAME.

    DATA : DREF TYPE REF TO DATA.

    FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE, " used to store dynamic tables

    <WA> TYPE ANY, " used to store record data

    <WA1> TYPE ANY . " used to store field data

    LV_DBTAB1 = 'MARA'.

    data: it_mara like mara occurs 0 with header line.

    CREATE DATA DREF TYPE STANDARD TABLE OF (LV_DBTAB1)

    WITH NON-UNIQUE DEFAULT KEY.

    ASSIGN DREF->* TO <ITAB> .

    • selects all data

    SELECT * FROM (LV_DBTAB1) INTO TABLE <ITAB> .

    LOOP AT <ITAB> ASSIGNING <WA>.

    APPEND <WA> TO IT_MARA.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2008 at 08:33 AM

    but i need to export this field symbol which contain an internal table to another program. after trying to export it, i put the import statement into another program and i got this error message which say that field symbol is not assigned...

    Add a comment
    10|10000 characters needed characters exceeded

    • Interesting...

      One work around I can think of is to export the table name (which the user entered as a parameter) as well

      Then before importing the internal table into your second program, import that variable and assign your new field symbol to that type

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.