Application Development 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: 

Get Fields of internal table

michael_fallenbchel
Active Participant
0 Kudos

Hi experts,

I have a small problem:

I call form this way:

PERFORM export_data USING 'T_WARE'
                          gt_ware
                          gs_ware
                 CHANGING gt_exp_ware.

The Form looks like this

FORM export_data USING struktur TYPE string
                       tabname  TYPE STANDARD TABLE
                       zeile    TYPE any
              CHANGING exp_table TYPE STANDARD TABLE.

Now I need a variant of the same type as gt_exp_ware (which is this type: DATA: gt_exp_ware TYPE TABLE OF char100).

I just need a variant of type char100. How do I get this type in my perform?

I tried

  ref_table  ?= cl_abap_tabledescr=>describe_by_name( exp_table )...

Nothing is correct.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please make sure for PERFORM subroutines TABLES first and USING after.

PERFORM EXPORT_DATA TABLES GT_WARE GT_EXP_WARE

USING u2018T_WAREu2019 GS_WARE.

In the Form:

FORM EXPORT_DATA TABLES TABNAME TYPE STANDARD TABLE

EXP_TABLE TYPE STANDARD TABLE

USING STRUKTUR ZEILE.

Hope this will help you.

Regards,

Smart Varghese

6 REPLIES 6

Former Member
0 Kudos

Hi Micheal,

Why can you use like this directly,

PERFORM export_data USING 'T_WARE'
                          gt_ware
                          gs_ware
                 CHANGING gt_exp_ware.

you call form like this.

FORM export_data USING struktur 
                       tabname  
                       zeile
              CHANGING exp_table .

Thanks & regards,

Dileep .C

0 Kudos

It won't work - when I do it this way I get an error ("EXP_TABLE" is no internal table).

Former Member
0 Kudos
PERFORM export_data USING 'T_WARE'
                          gt_ware
                          gs_ware
                 CHANGING gt_exp_ware[].

FORM export_data USING struktur TYPE string
                       tabname  TYPE STANDARD TABLE
                       zeile    TYPE any
              CHANGING exp_table TYPE STANDARD TABLE.
FIELD-SYMBOLS : <gs_exp_ware> TYPE *your type of gt_exp_ware .*
 loop at exp_table  assigning <gs_exp_ware>.
endloop.

ENDFORM.

0 Kudos

Hi Gtren,

FORM export_data USING struktur TYPE string
                       tabname  TYPE STANDARD TABLE
                       zeile    TYPE any
              CHANGING exp_table TYPE STANDARD TABLE.
FIELD-SYMBOLS : <gs_exp_ware> TYPE *your type of gt_exp_ware .*
 loop at exp_table  assigning <gs_exp_ware>.
endloop.
 
ENDFORM.

Yes, you're right - but I want to get the type dynamically (acording to the table exp_table).

I can't work with a static type, I need to call the routine many times, eveytime with a different "exp_table"...

Former Member
0 Kudos

Hi,

Please make sure for PERFORM subroutines TABLES first and USING after.

PERFORM EXPORT_DATA TABLES GT_WARE GT_EXP_WARE

USING u2018T_WAREu2019 GS_WARE.

In the Form:

FORM EXPORT_DATA TABLES TABNAME TYPE STANDARD TABLE

EXP_TABLE TYPE STANDARD TABLE

USING STRUKTUR ZEILE.

Hope this will help you.

Regards,

Smart Varghese

0 Kudos

Perfect - not exaxctly what I'm looking for - but it works