Skip to Content
avatar image
Former Member

File to IDOC Scenario with message split

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 14, 2017 at 01:18 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 14, 2017 at 03:43 AM

    Hello Praveen,

    Try using enhanced Interface determination.

    Based on condition route it to multiple mappings.

    Add comment
    10|10000 characters needed characters exceeded

    • 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


  • Dec 14, 2017 at 08:25 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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