cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Mapping using condition & Dynamic Receiver determination – Used XSLT Mapping

Former Member
0 Kudos

Dear Experts,

     I am struggling to identify an error on the Technical Routing. Firstly according to my scenario, I receive an XML file with multiple PO's and I have to split the file to 2 different target messages. and also according to the source payload I have to send the file to 2 different receivers. first receiver is ABAP Proxy to the back end system and the 2nd one is to a file location. I have used XSLT to split the message into 2 target message type and I have used a XSLT mapping for receiver determination. Does any one have any idea of what I am doing wrong.

Note: some time I will only be able to fill in on target message.

I have attached my XSLT message split mapping with this post, please let me know if you have further question.

Your help is more appreciated.

Advance Thanks,

Pradeep

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">



  <xsl:variable name="vFlag"/>

  <xsl:variable name="vPONUM" select="POTRACKING/Lines[1]/PONumber"/>



  <xsl:template match="/">



    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

      <ns0:Message1>

        <ns1:MT_Tracking xmlns:ns1="http://www.findel-education.co.uk/axapta">

          <xsl:for-each select="POTRACKING/Lines">





            <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">

              <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>

              <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>

            </sap:call-external>



            <xsl:if test="$vFlag = 0">



              <Lines>

                <DDate>

                  <xsl:value-of select="DespatchDate"/>

                </DDate>

                <PONumber>

                  <xsl:value-of select="PONumber"/>

                </PONumber>

                <POLine>

                  <xsl:value-of select="POLine"/>

                </POLine>

                <QTY>

                  <xsl:value-of select="Quantity"/>

                </QTY>

                <VendorMaterial>

                  <xsl:value-of select="VendorMaterialNumber"/>

                </VendorMaterial>

                <AccountRef>

                  <xsl:value-of select="AccountReference"/>

                </AccountRef>

                <ConsignNumber>

                  <xsl:value-of select="ConsignmentNumber"/>

                </ConsignNumber>

                <CarrierURL>

                  <xsl:value-of select="CarrierURL"/>

                </CarrierURL>

                <ConsignURL>

                  <xsl:value-of select="ConsignmentURL"/>

                </ConsignURL>

              </Lines>





            </xsl:if>



          </xsl:for-each>

        </ns1:MT_Tracking>

      </ns0:Message1>





      <ns0:Message2>

        <ns2:MT_Tracking xmlns:ns2="http://www.findel-education.co.uk/ecc/ax/po/ftp">

          <xsl:for-each select="POTRACKING/Lines">





            <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">

              <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>

              <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>

            </sap:call-external>



            <xsl:if test="$vFlag = 1">



              <Lines>

                <DDate>

                  <xsl:value-of select="DespatchDate"/>

                </DDate>

                <PONumber>

                  <xsl:value-of select="PONumber"/>

                </PONumber>

                <POLine>

                  <xsl:value-of select="POLine"/>

                </POLine>

                <QTY>

                  <xsl:value-of select="Quantity"/>

                </QTY>

                <VendorMaterial>

                  <xsl:value-of select="VendorMaterialNumber"/>

                </VendorMaterial>

                <AccountRef>

                  <xsl:value-of select="AccountReference"/>

                </AccountRef>

                <ConsignNumber>

                  <xsl:value-of select="ConsignmentNumber"/>

                </ConsignNumber>

                <CarrierURL>

                  <xsl:value-of select="CarrierURL"/>

                </CarrierURL>

                <ConsignURL>

                  <xsl:value-of select="ConsignmentURL"/>

                </ConsignURL>

              </Lines>



            </xsl:if>



          </xsl:for-each>

        </ns2:MT_Tracking>

      </ns0:Message2>

    </ns0:Messages>





  </xsl:template>

</xsl:stylesheet>

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Hareesh,

I have split the mappings to 1:1 and created multiple Interface determinations following the below help.

<<Defining Message Splits - SAP NetWeaver Process Integration - SAP Library>>

Thanks,

Pradeep

Former Member
0 Kudos

Thanks for all your help guys. I have resolved the issue.

former_member184720
Active Contributor
0 Kudos

It's good if you can share the solution which helps other members..

Former Member
0 Kudos

Dear Experts,

Can anyone help me with giving me some sample 1:N message scenario please without using BPM.

Thanks,

Pradeep

Former Member
0 Kudos

Please find my Operations Mapping for your reference.

former_member184720
Active Contributor
0 Kudos

Hi Pradeep - You did not select the "use SAP XML tool kit" check box..? try selecting that.

Can you also share the error screenshot?

Former Member
0 Kudos

Hi Hareesh,

Please find the interface determination for both interfaces attached with this post.

For me there is something wrong with the Interface determination. Please correct me.

Thanks,

Pradeep

Former Member
0 Kudos

Dear Experts,

To make your life simple I have attached a process flow of what exactly I am trying to achieve.

could someone please give me steps to implement the scenario please.

Advance Thanks,

Pradeep

former_member184720
Active Contributor
0 Kudos

Hi Pradeep - I'm not sure how you are finding the "Receiver system" during the interface determination step..

But looking at your design ->

you can add both of your receivers in the "receiver determination"

     -> If you have any conditions, try validating xpath and route.

     -> If it's not possible to handle with xpath, you can go for enhanced receiver determination

Once the receivers are identified,

for receiver A :  handle the message split part in your graphical mapping(multi mapping) and select the same in your interface determination..

For receiver B : it's a straight forward as you would be creating another interface determination and selects the graphical mapping..

Former Member
0 Kudos

Hi Hareesh,

Please find my determination in the XSLT below, I am using enhanced receiver determination.

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:p1="http://sap.com/xi/XI/System" xmlns:ns="urn:sap-com:document:sap:idoc:messages" version="1.0">



  <xsl:variable name="vFlag"/>

  <xsl:variable name="vAX" select="0"/>

  <xsl:variable name="vSAP" select="0"/>

  <xsl:variable name="vBoth" select="0"/>

  <!--  <xsl:variable name="vPONUM" select="POTRACKING/Lines[1]/PONumber"/>-->

  <xsl:template match="/">



    <xsl:for-each select="POTRACKING/Lines">



      <sap:call-external class="ZCL_VNAP_OBJECTS" method="CHECK_PO_EXIST">

        <sap:callvalue param="IP_EBELN" select="string(PONumber)"/>

        <sap:callvariable name="vFlag" param="EP_BOLEAN" type="string"/>

      </sap:call-external>



      <xsl:choose>

        <xsl:when test="$vFlag = 0">

          <!--          <p1:Receivers>

            <Receiver>

              <Service>

                <xsl:text>BS_AXAPTA_TST</xsl:text>

              </Service>

            </Receiver>

          </p1:Receivers>-->

          <xsl:variable name="vAX" select="$vAX + 1"/>



        </xsl:when>

        <xsl:when test="$vFlag = 1">

          <!--          <p1:Receivers>

            <Receiver>

              <Service>

                <xsl:text>BS_ECQCLNT300</xsl:text>

              </Service>

            </Receiver>

          </p1:Receivers>-->

          <xsl:variable name="vSAP" select="$vSAP + 1"/>



        </xsl:when>



      </xsl:choose>



    </xsl:for-each>







    <xsl:if test="$vSAP &gt; 0">

      <xsl:if test="$vAX &gt; 0">

        <xsl:variable name="vBoth" select="$vBoth + 1"/>

        <xsl:variable name="vSAP" select="0"/>

        <xsl:variable name="vAX" select="0"/>

      </xsl:if>

    </xsl:if>





    <xsl:if test="$vBoth &gt; 0">

      <p1:Receivers>

        <Receiver>

          <Service>

            <xsl:text>BS_AXAPTA_TST</xsl:text>

          </Service>

        </Receiver>

        <Receiver>

          <Service>

            <xsl:text>BS_ECQCLNT300</xsl:text>

          </Service>

        </Receiver>

      </p1:Receivers>

    </xsl:if>



    <xsl:if test="$vAX &gt; 0">

      <p1:Receivers>

        <Receiver>

          <Service>

            <xsl:text>BS_AXAPTA_TST</xsl:text>

          </Service>

        </Receiver>

      </p1:Receivers>

    </xsl:if>



    <xsl:if test="$vSAP &gt; 0">

      <p1:Receivers>

        <Receiver>

          <Service>

            <xsl:text>BS_ECQCLNT300</xsl:text>

          </Service>

        </Receiver>

      </p1:Receivers>

    </xsl:if>





  </xsl:template>



</xsl:transform>

former_member184720
Active Contributor
0 Kudos

Hi Pradeep - Did you test this mapping in ESR? does it work.. i mean is it returning the receiver system?

Also any specific reason for going with XSLT? why not a graphical mapping..

Former Member
0 Kudos

Hi Hareesh,

My Client would like this to be XSLT. I did a test and it works fine.

I can send a screen print if you require.

Regards,

Pradeep