cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping: Unknown parent node

Former Member
0 Kudos

I have the following message type to map:


<node_1>
…
</node_1>
<node_2
…
</node_2>

…..

<node_x>
…
</node_x>

In one of these nodes is the message that I actually want. For example:


<node_7>
  <a>
    <a1>bla bla</a1>
    <a2>blab la bla</a2>
  </a>
</node_7>

The problem is I don't know which of these nodes .

Is there a simple way to deal with that? I'm not experienced with XSLT mappings and such techniques.

Accepted Solutions (0)

Answers (3)

Answers (3)

prabhu_s2
Active Contributor
0 Kudos

Gil,

You can use graphical mapping which uses the function ifexists or exists. if the source node has data then the source will be mapped to target. If ur req is to get the node (node_7) which has value and map that node alone to the target the simple thing is to have a udf defined with the context of the source node pointed to the root segment of the source. Have a java code which will read the data and map to the target.

Former Member
0 Kudos

Hi,

If u are comfortable with java you can go for that. Its very easy to code in Java to get the required node. There are many blogs available on Java mapping.

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii

Regards,

P.Venkat

Former Member
0 Kudos

use node functions and check whethr they exists or not if they exists they have message and create it using create if node fucntion.

Thanks

Sreeram.G.reddy

Former Member
0 Kudos

But I don't know how much of these <node_x> exist.

Former Member
0 Kudos

then write a USer defined function and put your check logic on wht basis u want to

target need created

Former Member
0 Kudos

Hi,

You can even try like this. If u r confident that <a> doesnt occur in only one <node_x> then use that <a> element in mapping with parent of <node_x> as context.

Give ur structures and target mapping requirement so that its easy to help u. I think this can be even solved by Graphical mapping if properly analysed.

Regards,

P.Venkat

Former Member
0 Kudos

Deleted content

Former Member
0 Kudos

Hi,

You can even try like this. If u r confident that <a>

doesnt occur in only one <node_x> then use that <a>

element in mapping with parent of <node_x> as

context.

Give ur structures and target mapping requirement so

that its easy to help u. I think this can be even

solved by Graphical mapping if properly analysed.

Regards,

P.Venkat

I've tried this already. I have defined a mapping for the following structure graphically.


<MT_BEW_DATEN_SP_response>
  <statement_response>
    <response_1>
      <row>
        …
      </row>
    </response_1>
  </statement_response>
</MT_BEW_DATEN_SP_response>

I map this to the following message type:


<MT_SAP_BEW_DATEN>
  <DATA>
    <ITEM>
      …
    </ITEM>
  </DATA>
</MT_SAP_BEW_DATEN >

I map is displayed in red.

Message was edited by:

Gil Ritter

Former Member
0 Kudos

Gil,

what is the occurance of <row> node inside <response_1> to <response_x>?

You cant use context handling in your case.

Regards,

Jai Shankar

Former Member
0 Kudos

0 to unbound

Former Member
0 Kudos

Hi Gil,

Use exists function in graphical mapping to check the existence of your message.. then direct it to if..then block......in its output use creatif to create target node..

Then inside the node, set the field to Split by value function to target message field.

Hope this solves your query.

Thanks,

Rajeev Gupta

prabhu_s2
Active Contributor
0 Kudos

Gil

it can be performed using graphical mapping but litle bit of logical evaluation needs to be done like in <a href="/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool. This would be totally different from ur scenario but context handeling will come to rescue in graphical way

Former Member
0 Kudos

I need a moment to ckeck this.

Former Member
0 Kudos

Hi Gil,

U need to use multiple if conditions in your graphical mapping to produce the nested if condition hierarchy. Also, all target nodes needs a complex mapping with nested if conditions.

It is advisable to go for Java mapping in this scenario which would be simpler.

Regards,

Jai Shankar

Former Member
0 Kudos

For example,

The target node Item's mapping will be like

The first if then else

<row>(from response_1)existsif

<row>(from response_1)--then

result --Item

The else part of the first first <i>if then else</i> is mapped to result of <i>second if then else</i>

Second if then else

<row>(from response_2)existsif

<row>(from response_2)--then

This will continue till the end of <response_x>

Also, you need the same approach for eac node with in <Item>.

Regards

Jai Shankar

Former Member
0 Kudos

> Gil

>

> it can be performed using graphical mapping but litle

> bit of logical evaluation needs to be done like in

> <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub

> /wlg/3468">here</a>. This would be totally different

> from ur scenario but context handeling will come to

> rescue in graphical way

I don't understand how this blog can help me.

If I define my mapping as described above but I got problems if the <row> node isn't in <response_1> even If I change the context of <row> to <response_1>.

If I test my mapping with the IB test tool with a message where <row> has <response_2> as parent node than <response_2>, <row> and all child nodes are displayed in red at the source side. So no mappings on <row> -> <ITEM> will be executed. In the blog the names of the nodes are always known. I never know the name of the parent node.

Former Member
0 Kudos

> For example,

>

> The target node Item's mapping will be like

>

> The first if then else

>

> <row>(from response_1)existsif

> <row>(from response_1)--then

> result --Item

>

> The else part of the first first <i>if then else</i>

> is mapped to result of <i>second if then else</i>

> Second if then else

>

> <row>(from response_2)existsif

> <row>(from response_2)--then

>

> This will continue till the end of <response_x>

>

> Also, you need the same approach for eac node with in

> <Item>.

>

> Regards

> Jai Shankar

Okay, this way is clear but my problem is that I don't know x. Maybe x is 10 or x is 100.

Former Member
0 Kudos

>>Okay, this way is clear but my problem is that I don't know x. Maybe x is 10 or x is 100

You have no other option than to go for a Java/ABAP mapping.

Regards,

Jai Shankar

prabhu_s2
Active Contributor
0 Kudos

Hi Gil

The pointer i had given you is to undestand the logical part involved. By having some logical valuations inplace and by playing around with context your reqi can be sortedout. Also you can make use of java/abap mapping if this takes more time.

There might be n number of response but all are confined to a strucutre that is defined. It is the strucutre that is carrying the data and by setting some context changes make sure that the Queue has no context change and the data are like a string of array. with this and having a udf in place we can do that. As said java mapping will also be comparitively handy.

regds

Prabhu