on 12-28-2007 5:47 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
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.
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.
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?
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.