cancel
Showing results for 
Search instead for 
Did you mean: 

how to write this message mapping without UDF

Former Member
0 Kudos

hi, guru, I have to post this thread again to seek a detailed help on this.

I have a source as below

<source>

<record typeA="xx" typeB="yy">

<name>name1</name>

</record>

<record typeA="xx" >

<name>name2</name>

</record>

</source>

I'd like to create output as

<target>

<record>

<type>typeA</type>

<value>xx</value>

<name>name1</name>

</record>

<record>

<type>typeB</type>

<value>yy</value>

<name>name1</name>

</record>

<record>

<type>typeA</type>

<value>xx</value>

<name>name2</name>

</record>

</target>

How do I write this mapping without UDF ? some ones told me to use UseOneAsMany, but I really donn't know the details.

Can somebody help to show the details mapping for it?

Thanks a lot

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi.

Well it's some difficult without UDF but you can try this.

duplicate the node record in your target message (click right ) and map atribut @typeA for first one and @typeB for another

@TypeA(change context source)----


>Record

@TypeB(change context source)----


>Record[1]

@TypeA(change context source)----


>Value

@TypeB(change context source)----


>Value[1]

map the source(name) twice.

name----


>name

name----


>name[1]

Regards.

stefan_grube
Active Contributor
0 Kudos

Hi Luis,

this is a very good approach.

But it does not work correctly

The output looks like this:

<target>

<record>

<type>typeA</type>

<value>xx</value>

<name>name1</name>

</record>

<record>

<type>typeA</type>

<value>xx</value>

<name>name2</name>

</record>

<record>

<type>typeB</type>

<value>yy</value>

<name>name1</name>

</record>

</target>

The point is: All typeA elements come before all typeB elements instead of alternating.

In fact alternating sequences in the target source are a big issue for the graphical mapping tool.

VijayKonam
Active Contributor
0 Kudos

There was a recent blog by Shabarish Vijay for tricking the receiver file adapter XML strucuture. A similar approach could be useful here too but it requires a simple adapter module.

VJ

Former Member
0 Kudos

right, this is the issue.

I'm wondering if we can use a variable to rememer the index of typeA and typeB, and then sort the target element by this index.

However I could not figure out a way to do it.

>

> Hi Luis,

>

> this is a very good approach.

> But it does not work correctly

>

> The output looks like this:

> <target>

> <record>

> <type>typeA</type>

> <value>xx</value>

> <name>name1</name>

> </record>

> <record>

> <type>typeA</type>

> <value>xx</value>

> <name>name2</name>

> </record>

> <record>

> <type>typeB</type>

> <value>yy</value>

> <name>name1</name>

> </record>

> </target>

>

> The point is: All typeA elements come before all typeB elements instead of alternating.

> In fact alternating sequences in the target source are a big issue for the graphical mapping tool.

stefan_grube
Active Contributor
0 Kudos

I found finally a solution by using three different (but similar) UDF for type, name and value.

But i think, that was not what you have requested.

I don't think there is a solution without UDF, but maybe some mapping gurus can help.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi ShiWu,

I agree with Stefan, this is not possible without using UDF. Since as Stefan mentioned, it is an issue for XI/PI to handle alternating inputs. There is no way to get past this unless you have a function(UDF) that adds/joins the contexts of typeA and typeB so that this can be checked as just one whole context.

Hope this helps,

stefan_grube
Active Contributor
0 Kudos

Is this a real scenario or a mapping puzzle

Sorry, I have no solution for this. This is really difficult and only experienced guys can solve this.

I wonder if there is a chance to adjust the source or the target structure to make the mapping easier?

deepak_shah
Contributor
0 Kudos

hi,

Check this link. The example here is similar to yours

http://help.sap.com/saphelp_nw04/helpdata/EN/45/e3dd94f87c6f74e10000000a1553f6/frameset.htm

Regards,

Deepak.

Former Member
0 Kudos

>

> hi,

>

> Check this link. The example here is similar to yours

> http://help.sap.com/saphelp_nw04/helpdata/EN/45/e3dd94f87c6f74e10000000a1553f6/frameset.htm

>

> Regards,

> Deepak.

thanks, but this help talks about "Cache Monitoring ", is the link correct?

Former Member
0 Kudos

Hi,

Can u please elaborate the logic on which ur mapping...

On what logic exactly u r mapping the source to Traget...

Former Member
0 Kudos

>

> Hi,

>

> Can u please elaborate the logic on which ur mapping...

>

> On what logic exactly u r mapping the source to Traget...

thanks, the logic is:

source structure is like

<source>

<record typeA="xx" typeB="yy">

<name>namexxxx</name>

<record>

<record>.

....

</record>

</source>

The attribute typeA, typeB are optional.

If there is typeA, then will create one target element for it , and output the <type>, <value> & <name>

<record>

<type>typeA</type>

<value>xx</value>

<name>name1</name>

</record>

And if there is typeB, will create similar element for it, too.

That means, if one source record has both typeA and typeB attributes, we will create 2 target element for it.