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

How to export an internal table????

former_member384574
Active Participant
0 Likes
932

Hi experts,

I have a method X in my class Y, my method X exports a table (which is defined in dictionary) with a lot of fields. In the code part, I've an internal table wich must be the table to be exported, but when I'm trying to returned it, I've a message that say "Itab_X is not an internal table OCCURS n", how can I export that itab?

Thanks a lot,

Regards,

Rebeca

Hi experts,

I have a method X in my class Y, my method X exports a table (which is defined in dictionary) with a lot of fields. In the code part, I've an internal table wich must be the table to be exported, but when I'm trying to returned it, I've a message that say "Itab_X is not an internal table OCCURS n", how can I export that itab?

Thanks a lot,

Regards,

Rebeca

4 REPLIES 4
Read only

Former Member
0 Likes
891

Hi,

Use export to shared buffer to export internal table,


EXPORT ITAB TO  SHARED BUFFER INDX(ST) ID 'TEST1'.

To import,


IMPORT ITAB FROM  SHARED BUFFER INDX(ST) ID 'TEST1'.

Regards,

Arun

Read only

0 Likes
891

The exporting is in transaction SE24, so the problem is that the data I pass, itab_one with type Dictionary tabla don't let me return all the fields....

Thanks for your answer!

I don't know, but is probably I've to define a structure of that table for using it?

Thanks a lot,

Regards,

Rebeca

Read only

MarcinPciak
Active Contributor
0 Likes
891

If I understand you correctly, you have a method wherein you extract some data from DB table and want to return this table content to the method's caller. Is that right? If so you type your exporting parameter must be of TABLE TYPE defined either in DDIC or you in local class typing area. In the latter case you can use this type only within current class pool, so typing with DDIC type is a better choice.

So basically you should follow this logic


class lcl_test definition.
   "exporting parameter typed with DDIC table type FLIGHTTAB 
  methods: get_db_table_data exporting et_tab type FLIGHTTAB. 
endlcass.

class lcl_test implementation.
  method get_dd_table_data.
      select * from sflight into table ET_TAB ....
      "now ET_TAB stores desired entries and can return data to its caller in form of a table
  endmethod.
endclass.


"using the method
data itab_flights type flighttab.

call methods lo_test->get_db_table_data( importing et_tab = itab_flights ).

That's it. It's all about correct parameter typing.

Regards

Marcin

Read only

0 Likes
891

Solved! I have to create a type of line and then generate the table!

Thanks a lot everybody!

Regards,

Rebeca