cancel
Showing results for 
Search instead for 
Did you mean: 

File to IDOC Scenario with message split

praveen_vanga3
Participant
0 Kudos

Hi,

I am looking for a help to create a File to IDOC in PI 7.31 dual stack.based on records from the file, I have to create an IDOCs at target i.e Orders , delivery and Invoice.How can we develop? Could you please provide steps to generate different IDOCs at target. I have done a scenario where if the all records are same then I have created same multiple Idocs.

Thanks

Praveen

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor

Hi Praveen!

From the first sight I could see that you conditionally create "Message1" and "Message2" elements. That's wrong. You should always create theses elements. And IDOC message(s) inside it may or may not be created.

Regards, Evgeniy.

praveen_vanga3
Participant
0 Kudos

Thank you Evegeniy...Let me try..

You mean to say, we can't create "Message1" and "Message2" based on conditions, so it should be added before IDOCs.

Thank you

Praveen

former_member190293
Active Contributor
0 Kudos

Yes, these elements should always exist in target structure even if no IDoc messages of that type are produced during transformation.

Regards, Evgeniy.

praveen_vanga3
Participant

Thank you... You are right.... When I posted this question, I though of you. Most of the XSLT queries answered by you.

Thank you

Praveen

Answers (2)

Answers (2)

former_member190293
Active Contributor
0 Kudos

Hi Praveen!

If the only receiver is used in your scenario, just add all the IDOC types you need as receiver interfaces in your Operation mapping definition.

Create message mapping using the same IDOCs as receiver message type (or use XSLT transformation as message program).

Regards, Evgeniy.

praveen_vanga3
Participant
0 Kudos

Hi Evgeniy,

Thank you... We are using XSLT mapping ....I am able to test it in Operation mapping... when I test a end to end scenario getting en below error.

MappingException: Unexpected error while parsing the multi-structure document, NullPointerException:
while trying to invoke the method javax.xml.stream.XMLEventWriter.add(javax.xml.stream.events.XMLEvent) of an null object loaded from localvariable writer

Thank you

Praveen


former_member190293
Active Contributor
0 Kudos

Hi Praveen!

Wouldn't you mind to provide your XSL transformation code here?

Regards, Evgeniy.

praveen_vanga3
Participant
0 Kudos

Hi Evgeniy,

The below is the code which we are using.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:ns0=" http://sap.com/xi/XI/SplitAndMerge">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:variable name="Order" select="ns0:Messages/ns0:Message1/MT_FiletoIdoc"/>
<xsl:template match="/">
<ns0:Messages xmlns:ns0=" http://sap.com/xi/XI/SplitAndMerge">
<xsl:for-each select="//Record">
<xsl:if test="exp2='S'">
<ns0:Message1>
<ORDERS05>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<DIRECT>2</DIRECT>
<IDOCTYP>ORDERS05</IDOCTYP>
<CIMTYP/>
<MESTYP>ORDERS</MESTYP>
<SNDPOR>SAPRD1</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>SNDPORT</SNDPRN>
<RCVPOR>SAPRD1</RCVPOR>
<RCVPRN>RD1CLNT200</RCVPRN>
</EDI_DC40>
<E1EDK01 SEGMENT="1">
<BELNR>
<xsl:value-of select="exp1"/>
</BELNR>
</E1EDK01>
</IDOC>
</ORDERS05>
</ns0:Message1>
</xsl:if>
<xsl:if test="exp2='U'">
<ns0:Message2>
<DELVRY03>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<DIRECT>2</DIRECT>
<IDOCTYP>DELVRY03</IDOCTYP>
<CIMTYP/>
<MESTYP>DESADV</MESTYP><MESTYP/>
<SNDPOR>SAPRD1</SNDPOR>
<SNDPRT>LS</SNDPRT>
<SNDPRN>SNDPORT</SNDPRN>
<RCVPOR>SAPRD1</RCVPOR>
<RCVPRN>RD1CLNT200</RCVPRN>
</EDI_DC40>
<E1EDL20 SEGMENT="1">
<VBELN>
<xsl:value-of select="exp1"/>
</VBELN>
</E1EDL20>
</IDOC>
</DELVRY03>
</ns0:Message2>
</xsl:if>
</xsl:for-each>
</ns0:Messages>
</xsl:template>
</xsl:stylesheet> Thank YouPraveen
former_member186851
Active Contributor
0 Kudos

Hello Praveen,

Try using enhanced Interface determination.

Based on condition route it to multiple mappings.

praveen_vanga3
Participant
0 Kudos

Hi Raghu,

Thank you.. I am looking for it in the mapping to generate multiple different IDOCS based on input records.

former_member186851
Active Contributor
0 Kudos

Hello Praveen,

Is it a specific requirement to use only mapping?

And is it like only one idoc of particular type will generated?like one orders one invoice out of file?

praveen_vanga3
Participant
0 Kudos

Hi Raghu,

We have two records in a source file, one of the record is for order and other for delivery..so at target we need to generate two different IDOCs for this we are using XSLT mapping and able to test it in OM while testing end to end getting an error . we have checked sap note that related to error, ours PI is 7.31 SP 18.

MappingException: Unexpected error while parsing the multi-structure document, NullPointerException:
while trying to invoke the method javax.xml.stream.XMLEventWriter.add(javax.xml.stream.events.XMLEvent) of an null object loaded from localvariable writer

Thank you

Praveen