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: 

How to assign field symbol with it self?

Former Member
0 Kudos

Hello guys,

In the Code Initialization in the Interface for Adobe Forms, I want to Import from Memory an Field Symbol.

I did this: IMPORT <table> FROM MEMORY ID 'RAD'.

When I try to import, it shows me that <TABLE> is not assigned. But the problem is that I can't assign <TABLE> because i have created an DYNAMIC INTERNAL TABLE which I Export to Memory and in the Interface initialization I want to Import.

Is there any way to assign the field symbol, without assiging it an table or something like that? Because I created it dynamic, and I don't have a TYPE to create an internal table and then assign it to the field symbol.

4 REPLIES 4

adrian_mejido
Contributor
0 Kudos

Hi,

You should use a variable type ANY.

Best Regards

raymond_giuseppi
Active Contributor
0 Kudos

I don't think the import statement is able to import to a non assigned field-symbol. So you could export the structure definition (*) first, and then the data, so you will be able to import the definition, create once again the internal table and then import the data.


IMPORT lt_desc FROM MEMORY 'ZDESC'.

CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE ...

IMPORT <lo_itab> FROM MEMORY 'ZDATA'.

Regards,

Raymond

(*) An internal table of type of LVC_T_FCAT (CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE) or REF TO CL_ABAP_DATADESCR (CL_ABAP_TABLEDESCR=>CREATE)

0 Kudos

Don't use the CL_ALV_TABLE_CREATE - use RTTI instead...

When you created the dynamic table, you had some information about its type in memory. So one thing you could do is...

DATA xmlstring TYPE xstring.

CALL TRANSFORMATION id RESULT xml xmlstring SOURCE table = <mytable>.

EXPORT xmlstring typeinformation...

Then.

IMPORT xmlstring typeinformation...

use typeinformation to build an empty <mytable>.

CALL TRANSFORMATION id RESULT table = <mytable> SOURCE xml xmlstring.

Former Member
0 Kudos

Why are you importing variable via memory id. You can directly pass the internal table using import parameters. You need to declare like this.

IM_TABLE  TYPE STANDARD TABLE

In the initialization.section, you need to put the following code.

DATA : lr_table TYPE REF TO data.

DATA : lr_struc  TYPE REF TO data.

DATA : lr_struct_descr TYPE REF TO cl_abap_structdescr.

DATA : lt_components TYPE abap_component_tab.

FIELD-SYMBOLS : <fs_table> TYPE STANDARD TABLE.

" Content of the table

Get reference of im_table into lr_table.

assign lr_table->* to <fs_table>.

"  To get the column names

  CREATE DATA lr_struc LIKE LINE OF lr_table.

  lr_struct_descr  ?= cl_abap_structdescr=>describe_by_data_reference( lr_struc ).

  lt_components = lr_struct_descr->get_components( ).