cancel
Showing results for 
Search instead for 
Did you mean: 

Question with multi-mapping 1:n split scenario

Former Member
0 Kudos

Hi

I have a scenario with the following requirement

R3 --> XI --> Multiple files

I used a multi-mapping scenario using message mapping. to get the following output

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<Transaction> </Transaction>

<Transaction> </Transaction>

</ns0:Message1>

<ns0:Messages>

Each <Transaction> </Transaction> produces a file in runtime. So far so good.

Now, there was a new requirement to introduce a dtd line as the first line in each of the target files created - that looks like follows :

<!DOCTYPE Transaction PUBLIC \"-//XXXXX//DTD BatchReceiptAuthorization//EN\" \"http://dtd.XXXXX.com/dtds/ReceiptAuthorization.dtd\">

How do I go about introducing this header line above the <Transaction> node in each and every target file - that is created by multi-mapping ? This header line is not a part of the target schema and hence cannot be mapped to as an constant element in the target.

Any suggestions/ideas as to how this can be done ?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Karthik,

This can be achieved by adding a java mapping or xslt mapping after the message mapping in the Interface mapping.

I don't think you can insert an additional namespace in the target file using standard message mapping functions.

Regards,

Gautam Purohit

Former Member
0 Kudos

Hi Gautam

I did use a java mapping , as a second step after the message mapping - so that the dtd line can be introduced as a header for each target message/file written by the muti-mapping in the first step.

In my scenario, I sent the inputstream that is being passed to the Java execute method - to trace and I see that the whole of the xml file - as shown below - which is the output of message mapping ( from the first mapping step ) in sent to the execute method of the java mapping a single call

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<Transaction> </Transaction>

<Transaction> </Transaction>

</ns0:Message1>

<ns0:Messages>

So, I modified Java mapping program to look for multiple occurences of <Transaction> tag and prefix them with my constant DTD Literal - which is the primary reason , why I had to use Java mappings after the message mapping.

Now, I get an error is XI- SXMB_MONI

***********************************************************************************************************************************

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">

<SAP:Category>XIServer</SAP:Category>

<SAP:Code area="MAPPING" />

<SAP:P1>unexpected symbol; expected '<'</', entity refe</SAP:P1>

<SAP:P2>rence, character data, CDATA section, processing i</SAP:P2>

<SAP:P3>0</SAP:P3>

<SAP:P4>113</SAP:P4>

<SAP:AdditionalText />

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack>The exception occurred (program: CL_XMS_MAIN===================CP, include CL_XMS_MAIN===================CM00A, line: 609)</SAP:Stack>

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

**********************************************************************************************************************************

Can you help me out here ?

Former Member
0 Kudos

Hi

We solved this by setting file post processing shell script to add the additional header line to the invidual files created out of multimapping.