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

Export a dynamic table (defined by field-symbol)

0 Likes
2,491

Hi,

I would like to export the field-symbol <fs_table> in a class method.

Unfortunatly I got OBJECTS_TABLES_NOT_COMPATIBLE dump while storing the field-symbol to the exporting variable.

       
  DATA lt_table  TYPE REF TO data.
  
  FIELD-SYMBOLS <fs_table> TYPE STANDARD TABLE.

.....

* create dynamic table
  CREATE DATA lt_table TYPE STANDARD TABLE OF (iv_structure_name).
  ASSIGN lt_table->* TO <fs_table>.

....// fill <fs_table>

et_data_table = <fs_table>. 

The exporting parameter et_data_table is of type STANDARD TABLE but this can be changed.

How can I make it work?

Thanks in advance,

Best Regards Clemens

1 ACCEPTED SOLUTION
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,855

Hi,

Use TYPE REF TO Data for the exporting parameter. And assign lt_table to it.

And in the calling program you can assign that into a field-symbol.

Regards,

Sesh

Hi,

I would like to export the field-symbol <fs_table> in a class method.

Unfortunatly I got OBJECTS_TABLES_NOT_COMPATIBLE dump while storing the field-symbol to the exporting variable.

       
  DATA lt_table  TYPE REF TO data.
  
  FIELD-SYMBOLS <fs_table> TYPE STANDARD TABLE.

.....

* create dynamic table
  CREATE DATA lt_table TYPE STANDARD TABLE OF (iv_structure_name).
  ASSIGN lt_table->* TO <fs_table>.

....// fill <fs_table>

et_data_table = <fs_table>. 

The exporting parameter et_data_table is of type STANDARD TABLE but this can be changed.

How can I make it work?

Thanks in advance,

Best Regards Clemens

8 REPLIES 8
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,856

Hi,

Use TYPE REF TO Data for the exporting parameter. And assign lt_table to it.

And in the calling program you can assign that into a field-symbol.

Regards,

Sesh

Read only

0 Likes
1,855

Hey Sesh,

the problem still exist.

Regards, Clemens

Read only

0 Likes
1,855

Hi,

Sorry I got your problem wrong.

Use TYPE REF TO Data for the exporting parameter. And assign lt_table to it.

Assuming et_data_table is TYPE REF TO DATA.

et_data_table = lt_table.

Then you can dereference it and copy in to the field-symbol in the calling program.

Regards,

Sesh

Read only

0 Likes
1,855

Hi Sesh,

And assign lt_table to it.

How can I assign lt_table to et_data_table(because this isn't a field-symbol)?

Regards, Clemens

Read only

0 Likes
1,855

Hi,

By assign I mean using the = not the ASSIGN keyword.

Since your lt_table is TYPE REF TO DATA and if you declare your exporting parameter as TYPE REF TO DATA then you can use = to assign the reference of lt_table to your exporting parameter.

As I have put in the code,

et_table_data = lt_table.

Regards,

Sesh

Read only

0 Likes
1,855

Thank you Sesh.

Read only

Former Member
0 Likes
1,855

Hi,

If ur using a variable 'et_data_table' as an exporting parameter in a class method then u can do the same by putting the field symbol instead of 'et_data_table' .But it should be of the same type as dat of

'et_data_table' .It ll work.

Regards,

ajit.

Read only

0 Likes
1,855

Hi Ajit,

I tried it, put its not possible to create method parameters that are field-symbols. Or do I understand you wrong.?

Regards, Clemens