Skip to Content
-1

Is it possible to pass Transformation ID as parameter

Jan 11, 2017 at 10:50 AM

48

avatar image

Dear experts,

I am just starting to play with XML and would like to know if it is possible to pass the Transformation using parameter/variable

CALL TRANSFORMATION ztran
     SOURCE XML g_xmldata
     RESULT para = i1_tab[].

I've created a Transformation ztran and would like to know if it is possible to pass it using a variable.

Thanks,

Francis

xml
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Horst Keller
Jan 11, 2017 at 10:56 AM
0

Why don't you read the documentation for CALL TRANSFORMATION before asking such a question.

It is written there, that the name of the transformation can be specified dynamically as (name) ...

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Dear Keller,

Sure I've read and tried before asking for advise here. I've tried with the following but is getting a short dump for 'Transformation_not_found'

data : trans_id(20).

trans_id = 'ztran'.

CALL TRANSFORMATION (trans_id)
     SOURCE XML g_xmldata
     RESULT para = i1_tab[].

Appreciate if you can further advise what I've done wrong in the code.

Thanks,

Francis

0

Again documentation ...

You have to specify it in "uppercase".

0

Dear Keller,

Oops, I've just overlooked that in the documentation. Thanks for pointing that out. Now I manage to pass it as variable.

However, I would like to know some more regarding the following XML

<?xml version="1.0" encoding="utf-8"?>
<Records count="000001">
<Record>
<FIELD_1>XXXX</FIELD_1>
<FIELD_2>YYYY</FIELD_2>
</Record>
</Records>

If my requirement to store the <Record> in an internal table itab with only the 2 fields, field_1 and field_2 and use a separate variable to store the 'count'. What should I do?

I managed to use XLST_TOOL to map the the internal table but is stuck in the 'count'. Appreciate if you can further advise or let me know if there is any reference that I can refer.

Many Thanks,

Francis

0

You have to write an according transformation. Did you look at "Simple Transformations" already?

0

Dear Keller,

Thanks for your help and guidance. I managed to solve it myself by adding a new root (e.g. COUNT) and add assigning it to the attribute in the XLST_TOOL.

Then call transformation as follows:

     call transformation (g_trans_id)
        source Records = i1_tab[]
               COUNT = txt_count
        result XML xml_xout.

Regards,

Francis

0