Skip to Content
0

File to IDOC Scenario with message split

Dec 14, 2017 at 03:22 AM

89

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Evgeniy Kolmakov Dec 14, 2017 at 01:18 PM
1

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.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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

Regards, Evgeniy.

0
Former Member

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

2
Raghuraman S Dec 14, 2017 at 03:43 AM
0

Hello Praveen,

Try using enhanced Interface determination.

Based on condition route it to multiple mappings.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Raghu,

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

0

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?

0
Former Member

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


0
Evgeniy Kolmakov Dec 14, 2017 at 08:25 AM
0

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.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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


0

Hi Praveen!

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

Regards, Evgeniy.

0
Former Member

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
0