cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.3 Split Mapping with a Java map

Former Member
0 Kudos

I am having a unique problem with setting up a new split mapping.  I have setup the following:

First step - Java Mapping for splitting a single order into multiple orders (still 1 to 1 based on the XSD schema, just creating extra order nodes)

Second step - a standard message mapping that will map each order from the java mapping to a ORDERS05 IDOC.

The XML being produced is supposed to be the following:

<ENACOM>

     <UNB>

          <UNG>

          <ORDERS>      <- this is where you are allowed unbounded orders via the schema

          <UNE>

     <UNZ>

The java map successfully creates the above XML, but when I try to use it via end-to-end testing, I get the following error:

com/sap/xi/tf/_MM_CRM_<mapping name>_com.sap.aii.utilxi.misc.api.BaseRuntimeException: The prefix "sxi" for element "sxi:Messages" is not bound.

I did an xml dump of what is being returned and the following is there:

<sxi:Messages>

     <sxi:Message1>

          <ENACOM>

My java code does not add the "sxi:Messages" xml tag.  PI must be adding it for me.  However, it is definitely not adding it correctly as it doesn't add the namesspace for sxi.

Has anybody seen this behavior?  Any idea on how to get PI to use a java mapping with split/merge functionality?   I know how to code Java well, but relatively new to PI and this has definitely got me stumped.

Thanks for any assistance you can provide!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I have researched the problem even further and come up with a solution and strange behavior. 

The strange behavior is the namespace prefix PI is using.    If you have your OM setup this way:

Step 1: Java Map

Step 2: Message Map (MM)

PI uses a prefix of sxi for the Messages node (sxi:Messages).  However if you setup a OM this way:

Step 1: MM

Step 2: Java Map

Step 3: MM

Then PI uses a prefix of ns0 for the messages node (ns0:messages).  Not sure why but it doesn't affect the processing of the message.  I know in the ESR test window it always expects a ns0:Messages section not sxi:Messages.

Now for the problem.  I was informed that in PI 7.1, PI did not auto add the "Messages" node to the XML and in the java map that I based my code off of, they were adding it in automatically.  However in PI 7.3, PI does add the Messages node automatically.  I found this out when I added in code to dump the Input xml to the trace log.  This was how the sxi:Messages was being "added".  I also reviewed the code that I was using (copied from an old PI 7.1 java map) and found the code did not copy attributes when it was creating the output XML.  That code caused the <sxi:Messages> to appear without the namespace declaration and why I was receiving a "not bound" error.

The fix was to update the java code to properly copy XML nodes/elements maintaining all attributes and to adjust the code for already having the "Messages" nodes (not to re-create them on the output). 

Answers (1)

Answers (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Brian,

Multi-Mapping using Java Mapping this has sample code.


I think this requirement can be achieved with out Java Mapping. Please check response

Former Member
0 Kudos

I do actually know that process but I don't think it will work in this case.

The input to the above is a EDIFACT d96A Unicom message.  This order is being sent in to us with all the items (for multiple ship-Tos) on one order.  We prefer each Order only have one Ship-To location.   We use the java map to parse the D96A order items and create a list of items by location, then produce a new d96A order that contains multiple ORDERS segments (now each ORDERS segment has only 1 ship-to and its associated materials). 

The multi-mapping has to be used for the ORDERS IDOC sent to SAP.   I hope that help to explain why we use a java map instead of just using message mappings.