Skip to Content
avatar image
-2
Former Member

Set parameter name as an internal table name

Hello,

I wanted to know is it possible to make the input parameter name as an internal table.

Please have a look in the snip-it of the code. In this report i am trying to take p_dbtab as a table name then make an internal table i_temp of the type p_dbtab.

Thanks in advance,

Ankit

REPORT  ZPRACTICDYNAMIC.



SELECTION-SCREEN BEGIN OF BLOCK 1.

   PARAMETERS:

    p_dbtab TYPE tabname   DEFAULT 'SOMETABLE'  OBLIGATORY.

SELECTION-SCREEN END   OF BLOCK 1.



data: it_tab TYPE STANDARD TABLE OF p_dbtab.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 22, 2017 at 12:10 PM
    DATA dref TYPE REF TO DATA.
    FIELD-SYMBOLS <itab> TYPE STANDARD TABLE.
    FIELD-SYMBOLS <line> TYPE ANY.
    FIELD-SYMBOLS <field> TYPE SIMPLE.
    
    CREATE DATA dref TYPE TABLE OF (p_dbtab).
    ASSIGN dref->* TO <itab>.
    SELECT * FROM (p_dbtab) INTO TABLE <itab>.
    LOOP AT <itab> ASSIGNING <line>.
      ASSIGN COMPONENT 'COLUMNNAME' OF STRUCTURE <line> TO <field>.
    Add comment
    10|10000 characters needed characters exceeded

  • Apr 22, 2017 at 12:47 PM

    You are with SAP? Why don't you read SAP's documentation?

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 22, 2017 at 11:59 AM
    -1

    Hi,

    its not possible to declare like this,

    type standard table of should refer to a work area or any table defined in SE11..

    Add comment
    10|10000 characters needed characters exceeded