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: 

Call Transformation with generic sources?

Former Member
0 Kudos
319

Hi,

I am using the coding from Durairaj Athavan Raja referred here (/people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i) to extract data from a query to a string.

The extract of the query is working generic, but at the end it is just:

CALL TRANSFORMATION (`ID`)

SOURCE meta = meta_data[]

output = <ltable>[]

RESULT XML xml_out.

to perform a transformation to xml-string.

But I would like to a call transformation using the source with

Field1 (from <ltable>) = Tag1 (from XML-File),

Field2 (from table) = Tag2 (from XML-File)

and so on.

is there a way to do this generic to in the way the <ltable> is build up?

Thanks in advice!

Sincerly

Markus

5 REPLIES 5

athavanraja
Active Contributor
0 Kudos
85

Hi Welcome to SDN.

i couldnt get your question, can you eloborate a little further.

Regards

Raja

Sorry for the dealy , i was on holidays

0 Kudos
85

Hi Raja,

please excuse my late reply.

I will try to explain more clearly what I would like to have.Think of a query with three dimensions (company, material and business year) and two facts (sales and ammount).

In the first section I would like to have a kind of metadata information with:

<factsmetadata>

</factsmetadata>

<dimensionmetadata>

<dimensionDescription>

<dimensionlevel>1</dimensionlevel>

<Dimensionkey>0company</Dimensionkey>

<DimensionName>Company</DimensionName>

<DimensionText>Company</DimensionText>

</dimensionDescription>

<dimensionDescription>

<dimensionlevel>2</dimensionlevel>

<Dimensionkey>0material</Dimensionkey>

<DimensionName>material</DimensionName>

<DimensionText>material</DimensionText>

</dimensionDescription>

<dimensionDescription>

<dimensionlevel>3</dimensionlevel>

<Dimensionkey>0year</Dimensionkey>

<DimensionName>business year</DimensionName>

<DimensionText>business year</DimensionText>

</dimensionDescription>

</dimensionmetadata>

The second section should bring up the data in the following format:

<dimension key=company>

<key> </key>

<name></name>

</dimension>

<dimension key=material>

<key> </key>

<name></name>

</dimension>

<dimension key=business year>

<key> </key>

<name></name>

</dimension>

<fact key=sales>

<value></value>

<unit></unit>

</fact>

<fact key=amount>

<value></value>

<unit></unit>

</fact>

I hope, that my question now is better explained and more clearly?

regards

Markus

athavanraja
Active Contributor
0 Kudos
85

you can simply do

CALL TRANSFORMATION (`ID`)

SOURCE meta = meta_data[]

axis_data = axis_data[]

cell_data = cell_data[]

RESULT XML xml_out.

is this what you are looking for?

if you look at the code i have in the FM, i get the data from axis_data, axis_info, cell_data and manipulate them to get into two dimensional format, similarly you could write an abap to generated the required format and then do a call tansformation to transform it to a XML

Regards

Raja

0 Kudos
85

Hi Raja,

that is not the solution I am looking for. This coding just brings up the axis_data "as is" and does not include the other informations I need.

I decided to use another solution, which brings up the query result as RRX_Grid and uses RRX_REPORT_OPEN to extract the data.

I will have to do the transformation of the grid by hand though...

Thanks for your help!

Cheers

Markus

0 Kudos
85

Hey Markus I know you have marked this as answered but I saw the following documentation on call transformation this afternoon and thought of this question:

Addition 3b

... SOURCE sp1 = ap1 ... | (sptab)

Effect

Specification of transformation source

ABAP data is transformed with addition 3b. The canonical XML representation of the ABAP data is generated and serves as the transformation input.

Use spi to specify the names of the ABAP data objects in XML format. Use api to specify suitable data objects, whose values are displayed in XML format. Instead of in a static parameter list, you can also transfer these dynamically as the content of an internal table with type ABAP_TRANS_SRCBIND_TAB from the type group ABAP.

Which seems to be exactly what you are looking for.

HTH

Nigel