Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Set parameter name as an internal table name

0 Likes
3,612

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.

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
2,487
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>.

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.

8 REPLIES 8
Read only

former_member185116
Active Participant
0 Likes
2,487

Hi,

its not possible to declare like this,

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

Read only

0 Likes
2,487

Type Standard table of can refer to any data type and offers the possibility to use dynamic types.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,488
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>.
Read only

0 Likes
2,487

Hi Rossi,

This is what i was looking for. Thanks a lot.

Best Regards,

Ankit

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
2,487

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

Read only

2,487

The f1 help dint help me in this case because i dint knew what keyword to search. Please do let me know if there are any documents which are abap concepts related so that i can go through that and learn. Thanks.

Read only

0 Likes
2,487

Maybe it is a good idea to join an ABAP training?

B.T.W., in the F1 help, there is a navigation tree, that allows you to access the contents top-down. There is a chapter about creating objects.

Read only

matt
Active Contributor
0 Likes
2,487

As a SAP employee, shouldn't you be requesting SAP ABAP training through your manager? Or has SCN become a training site for SAP internals???