cancel
Showing results for 
Search instead for 
Did you mean: 

Split XSLT Output into Multiple Files

Former Member
0 Kudos

I have an XML-to-File scenario working, but now I need to split my XSLT map output into multiple files based on the data. I have been reading the Jin Shin blog on message splitting, but don't know that it pertains to my situation.

XML data getting mapped with XSLT map creates output formatted like this.

<?xml version="1.0" encoding="utf-8"?>

<ns1:ColdInvoiceData xmlns:ns1="http://graybar.com/cold/invoice">

<Header>

<RecordID>HDR</RecordID>

<InvoiceNumber>15</InvoiceNumber>

</Header>

<Details>

<RecordID>DTL</RecordID>

<LineItemNumber>001</LineItemNumber>

<UnitPrice>1.25</UnitPrice>

</Details>

<Details>

<RecordID>DTL</RecordID>

<LineItemNumber>002</LineItemNumber>

<UnitPrice>2.22</UnitPrice>

</Details>

<Header>

<RecordID>HDR</RecordID>

<InvoiceNumber>16</InvoiceNumber>

</Header>

<Details>

<RecordID>DTL</RecordID>

<LineItemNumber>001</LineItemNumber>

<UnitPrice>3.33</UnitPrice>

</Details>

</ns1:ColdInvoiceData>

I currently have this output writing to a file (FTP, File Conversion). A single file is no issue, but I need to send multiple files for every set of HDR/DTL(s). I also need to put the invoice number in the filename (which is working fine as a parameter in my single FTP File CC now).

Can I make this happen with message splitting and maybe a second map (GUI map)? Do I need to adjust the XSLT output XML format to have an invoice level? Is there a better way to go?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

VijayKonam
Active Contributor
0 Kudos

You can do this with an additional GUI mapping. Use the one you have as target as source in this new mapping. Use multi-mapping by adjusting the cardinality of the new target structure. As many messages you create, those many files should get generated at the adapter level.

VJ

Former Member
0 Kudos

I created a gui Message Mapping to use right after my XSLT mapping. I set the target's cardinality to unbounded in the Messages tab, and did an automapping since the source matches the target.

When I do a system test, I get no output other than the Messages/Message1 structure.

Am I supposed to do any mapping into the Messages and Message1 nodes that were created automatically?

Am I correct in assuming that I will need to add the Messages and Message1 nodes to my XSLT map's output?

Former Member
0 Kudos

HI Keith,

How r u generating the test message to test in multimapping ?If u r using the test input message then it will not work u will have to modify the messagea nd then test it

Regards

Former Member
0 Kudos

I am testing with the target data from my XSLT map. I have been trying two versions...one with the Messages and Message1 nodes and one without. Both are causing me to get this output from my Gui Mapper Multi-Mapping:

<?xml version="1.0" encoding="UTF-8"?>

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

None of my xml data comes out. I think I need more help on how to map when using Multi-Mapping. I originally assumed I could just map straight across since all I am doing is wanting the same XML data to be split up into multiple messages...maybe this is not the case.

Former Member
0 Kudos

I made a change to the namespace used on the Messages/Message1 nodes (since the system-assigned ns0 was already being used in my xml data) and now I am getting output.

The problem is that the output matches my input. As aforementioned, I started with just a one-to-one mapping on every node and field.

When I change the mapping to try to force multiple ColdInvoiceData nodes, I get the following error (when my source has two Invoice nodes):

<Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:Messages/ns0:Message1/ns1:ColdInvoiceData[2]/Invoice. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at

When my source has one invoice node, it works ok.

Here is a screenshot of my mapping structure.

http://webpages.charter.net/kpwendel2/ib.jpg

Former Member
0 Kudos

change the context of InvoiceNumber field to Invoice node and try

Former Member
0 Kudos

...same result with context of Invoice...

I really don't even need to split on InvoiceNumber. I need every Invoice to create a separate ColdInvoiceData message (so I can send out a separate file for each).

Former Member
0 Kudos

With some adjusted mapping and xsl changes, I know have my output looking as I think it should look.

http://webpages.charter.net/kpwendel2/MultiMappingOutput.jpg

But I am not getting multiple files for each. I have the Messages tab set so the target is 0...unbounded, so there must be something about my output that does not trigger the multiple messages. Does anyone see it?

http://webpages.charter.net/kpwendel2/MessagesTab.jpg

Former Member
0 Kudos

I closed this post since VJ answered my original question.

I am still having an issue with no splitting, but will make a new question once I get it formulated.

Answers (0)