Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Current »

USE

In the migration projects, It can happen that field names or structure of the payload may change (e.g. IDocs generated in SAP S/4HANA and previous SAP ECC systems). The new interface can also generate values in a different way. Int4 IFTT by default compares the node alphabetically, but the issue can occur when the order of same nodes will be different (for example IDOC qualifiers)
In such case, in order to compare the reference and current output, we should follow the procedure described below.

PROCEDURE

Let's take an example where we want to do IDOC comparison. In order to do an validation of the IDoc segments including possible changes (segments may have been renamed, new ones may have been added or deleted) we need to perform appropriate transformation for both the reference and the current message. For this purpose we can take advantage of the XSLT transformation functionality.

In our example we need to test IDoc's, that are generated with a diffferent segment order than before (the message is still the same, but contains different sorting sequence for some of the segments). In this case we will use the XSLT transformation (shown below) which adds qualified to parent node name. With this approach comparison of IDoc segments is correct even if some node values are different and we can also easily compare missing or additional nodes.

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
  <xsl:strip-space elements="*"/>

<!-- identity template - copy everything -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <!-- Match segments with qualifiers. Value of first child node is appended to parent node name -->

  <xsl:template match="E1EDKA1|E1EDK02|E1EDK03">
    <xsl:variable name="qualifier" select="child::node()[1]/text()"/>
    <xsl:variable name="newName" select="concat(local-name(), '_', $qualifier)"/>
    <xsl:element name="{$newName}">
      <xsl:apply-templates/>
    </xsl:element>
  </xsl:template>

</xsl:transform>

The result of the transformation is as follows:

Before

After

<E1EDKA1 SEGMENT="1">      

<PARVW>RE</PARVW>      

<PARTN>1234</PARTN>

</E1EDKA1>

<E1EDKA1_RE SEGMENT="1">      

<PARVW>RE</PARVW>      

<PARTN>1234</PARTN>

</E1EDKA1>

Please note, that the presented approach can serve as a template and depending on the case the XSLT transformation (shown above) should be modified accordingly, so that the output in new interface solutions can be properly compared including any relevant (also customer specific) changes.

  • No labels