EDI TO IDOC 856 multiple idocs

 





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

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:multimap="http://sap.com/xi/XI/SplitAndMerge" xmlns:hci="http://sap.com/it/" exclude-result-prefixes="hci">

<xsl:param name="Client"/>
<xsl:param name="SAP_ISA_Usage_Indicator"/>
<xsl:param name="SenderPort"/>
<xsl:param name="SenderPartnerType"/>
<xsl:param name="SenderPartner"/>
<xsl:param name="LogicalSystem"/>

<xsl:template match="/">
<SYSTAT01>
  <IDOC BEGIN="1">
    <EDI_DC40 SEGMENT="1">
      <TABNAM>EDI_DC40</TABNAM>
      <MANDT><xsl:value-of select="$Client"/></MANDT>
      <DIRECT>2</DIRECT>
      <TEST>
      <xsl:choose>
        <xsl:when test="$SAP_ISA_Usage_Indicator = 'T'">X</xsl:when>
        <xsl:otherwise/>
      </xsl:choose>
      </TEST>
      <IDOCTYP>SYSTAT01</IDOCTYP>
      <MESTYP>STATUS</MESTYP>
      <SNDPOR><xsl:value-of select="$SenderPort"/></SNDPOR>
      <SNDPRT><xsl:value-of select="$SenderPartnerType"/></SNDPRT>
      <SNDPRN><xsl:value-of select="$SenderPartner"/></SNDPRN>
      <RCVPRT>LS</RCVPRT>
      <RCVPRN><xsl:value-of select="$LogicalSystem"/></RCVPRN>
    </EDI_DC40>
    <xsl:choose>
      <xsl:when test="exists(*/multimap:Message1/*/*/G_AK2)">
        <xsl:for-each select="*/multimap:Message1/*/*/G_AK2">
        <xsl:variable name="position" select="number(S_AK2/D_329)"/>
        <E1STATS SEGMENT="1">
          <TABNAM>EDI_DS</TABNAM>
          <DOCNUM><xsl:value-of select="../../../../multimap:Message2/Interchange/DOCNUM[$position]"/></DOCNUM>
          <STATUS>
          <xsl:choose>
            <xsl:when test="S_AK5/D_717 = 'A'">16</xsl:when>
            <xsl:otherwise>17</xsl:otherwise>
          </xsl:choose>
          </STATUS>
          <REFINT><xsl:value-of select="../S_AK1/D_28"/></REFINT>
          <REFGRP><xsl:value-of select="../S_AK1/D_28"/></REFGRP>
          <REFMES><xsl:value-of select="S_AK2/D_329"/></REFMES>
        </E1STATS>
        </xsl:for-each>
      </xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="*/multimap:Message2/Interchange/DOCNUM">
          <E1STATS SEGMENT="1">
            <TABNAM>EDI_DS</TABNAM>
            <DOCNUM><xsl:value-of select="."/></DOCNUM>
            <STATUS>
            <xsl:choose>
              <xsl:when test="../../../multimap:Message1/*/*/S_AK9/D_715 = 'A'">16</xsl:when>
              <xsl:otherwise>17</xsl:otherwise>
            </xsl:choose>
            </STATUS>
            <REFINT><xsl:value-of select="../../../multimap:Message1/*/*/S_AK1/D_28"/></REFINT>
            <REFGRP><xsl:value-of select="../../../multimap:Message1/*/*/S_AK1/D_28"/></REFGRP>
            <REFMES><xsl:value-of select="format-number(position(), '000000000')"/></REFMES>
          </E1STATS>
        </xsl:for-each>    
      </xsl:otherwise>
    </xsl:choose>
  </IDOC>
</SYSTAT01>
</xsl:template>

</xsl:stylesheet>

Popular posts from this blog

pss book : శ్రీకృష్ణుడు దేవుడా, భగవంతుడా completed , second review needed. 26th April 2024

pss book: గురు ప్రార్థనామంజరి . completed 21st july 2024

pss book: కధల జ్ఞానము read review pending. 25th june 2024