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

call transformation with dynamic table

Former Member
0 Likes
1,183

hi

i uploaded the xml file from application server into a internal table

data : begin of t_x occurs 0,
d type string,
end of t_x.
  OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT .

  DO.
    READ DATASET file INTO t_x-d.
    IF sy-subrc <> 0.
      EXIT.
    ELSE.
    append t_x.
    clear t_x.
    ENDIF.
  ENDDO.
  CLOSE DATASET filename.

and after i want to call call transformation but i can't put a structure ref to a table like this

CALL TRANSFORMATION ('ID')

SOURCE XML xmlupl

RESULT tab = t001[]

because my file xml are not always the same structure.

So is it possible to have a call transformation wit dynamic structure

thanks for your help

serge

hi

i uploaded the xml file from application server into a internal table

data : begin of t_x occurs 0,
d type string,
end of t_x.
  OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT .

  DO.
    READ DATASET file INTO t_x-d.
    IF sy-subrc <> 0.
      EXIT.
    ELSE.
    append t_x.
    clear t_x.
    ENDIF.
  ENDDO.
  CLOSE DATASET filename.

and after i want to call call transformation but i can't put a structure ref to a table like this

CALL TRANSFORMATION ('ID')

SOURCE XML xmlupl

RESULT tab = t001[]

because my file xml are not always the same structure.

So is it possible to have a call transformation wit dynamic structure

thanks for your help

serge

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
756

Hello Serge

If you know what kind of structure you require for your itab you can dynamically create the appropriate itab:

DATA:
  gd_struc    TYPE tabname,
  gdo_data    TYPE REF TO DATA.

FIELD-SYMBOLS:
  <gt_itab>   TYPE TABLE.


* Somehow find the required structure name
  gd_struc = 'KNA1'.  " for example


* Create data reference with required type (dynamically)
  CREATE DATA gdo_dref TYPE (gd_struc).

* Assign the data reference to your field symbol
  ASSIGN gdo_data->* TO <gd_itab>.

* NOTE: <gd_itab> has the line structure of 'KNA1'.
...

Regards

Uwe

Read only

0 Likes
756

Hi guys,

is there any possibility to transport the name of the structure (KNA1) also in that xml? or maybe the definition of the fields if the structure is not available local.

best regards,

Ionut

Read only

0 Likes
756

check this code sample

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b5...

where i send the table definiton (field cat) in the xml and using call transformation and xslt to dynamically define the structure and load data to it.

Regards

Raja

Read only

0 Likes
756

After the Call transformation statement, we get the XML string. How can we download that into the XML File into our frontend.