Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
adarshrao_rao
Advisor
Advisor

This blog provides a step by step process to migrate, simple, point to point B2B outbound EDIFACT interfaces from SAP PO to Cloud Integration (CPI) without TPM.

I have taken an example of an outbound invoice interface (Own system --> Trading Partner) to explain the process

System Type: UNEDIFACT

Message Type: INVOIC

Version: 96A

Introduction

When we talk about migrating B2B interfaces which are in SAP PO to cloud then there are below options.

  1. Create MIGs, MAGs and implement the interface using SAP Trading Partner Management (TPM) and leverage B2B monitoring
  2. Migrate the interface from SAP PO to Cloud Integration without using TPM.
  3. Migrate the interface from SAP PO to Cloud using both Cloud Integration and TPM

Migrating by implementing the B2B interfaces via TPM comes with a lot of benefits and best practices. Please refer to the blog for more details but there are customers who wants to avoid time and effort in creating MIGs, qualifying the fields, redoing the MAGs, testing, and implementing via TPM. They want to reuse the existing simple B2B mappings done in SAP PO system.


Hence, in this blog, we will focus on the option #2 with step-by-step approach to easily migrate B2B outbound EDIFACT interfaces from SAP PO to Cloud Integration

Note: This approach works for message mapping with function libraries without imported archive. To import it to Cloud Integration, please refer blog .

Pre-requisite

Connection between SAP PO and Cloud Integration is already set up. Please refer blog

Steps to Migrate

In this case, we will concentrate on migrating a outbound INVOIC interface (Own system --> Trading Partner) from SAP PO to Cloud Integration

1. Create a package, Click on Edit --> Migrate

adarshrao_rao_0-1708107792290.png

2. Select your already configured SAP PO system from the drop-down --> Next Step

adarshrao_rao_1-1708107792294.png

3. Select Integrated Configuration (ICo) of the B2B interface you wish to migrate.

adarshrao_rao_2-1708107792297.png

4. ICo selected will be reviewed dynamically by the tool and following template proposals are provided.

adarshrao_rao_3-1708107792307.png

5. For Simplicity purpose, I will select the below template and click on Next Step 

Update: For the list of supported templates available, please refer Supported Templates

adarshrao_rao_4-1708107792308.png

6. Provide a name for your iFlow --> Review --> Migrate --> View Artifact

adarshrao_rao_5-1708107792311.png

7. Click on Configure - to configure sender and receiver channels.

8. In the Local integration process, you can see the mapping migrated from SAP PO

adarshrao_rao_6-1708107792312.png

9. If you have any fields, which is using $B2B_END_UEBNR for unique numbers which is a parameter in SAP PO then follow below steps.

1. Open another tab, to create NRO as below.

adarshrao_rao_7-1708107792314.png

2. Add Content modifier before SAP PO mapping and set exchange property.

adarshrao_rao_8-1708107792318.png

3. Click on create to create a custom function

adarshrao_rao_9-1708107792320.png

4. Add the below code

 

 

import com.sap.it.api.mapping.*;
def String customFunc1(String P1,MappingContext context) {    
         String value1 = context.getProperty(P1);
         return value1;
}​

 

 

Update:

Now, in CI we have standard function "getProperty" available. Hence, please use this function instead of above mentioned custom. In the property name maintain the the value as ICN_DEFAULT

adarshrao_rao_0-1709479891356.png

5. Do the mapping as below for all the fields which is using SAP PO NRO parameter, $B2B_END_UEBNR, save and deploy the message mapping

adarshrao_rao_10-1708107792325.png

10. If your mapping is using $B2B_SEG_COUNTER to count the number of segments which is the value for the field D_0074 under the segment, S_UNT, then we will make use of XSLT mapping

adarshrao_rao_0-1709688544025.png

1. Add a property in the content modifier. This property will be called in the XSLT mapping.

adarshrao_rao_12-1708107792336.png

2. Create a XSLT Mapping next to the imported message mapping and add the below code

adarshrao_rao_13-1708107792338.png

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!-- Declaring the Parameter -->
    <xsl:param name="MessageType"/>
    
    <!-- Matching the template -->
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    
    <!-- Matching the template for D_0074 under S_UNT where segment count is added -->
    <xsl:template match="S_UNT/D_0074">
        <xsl:copy>
            <!-- Use the parameter in the XPath expression -->
            <xsl:value-of select="count(//*[starts-with(name(), 'S_')][ancestor-or-self::*[name()=$MessageType]])"/>
        </xsl:copy>
    </xsl:template>
    
    <!-- Template to remove "_1" from node names -->
    <xsl:template match="*[substring(name(), string-length(name()) - 1) = '_1']">
        <xsl:element name="{substring-before(name(), '_1')}">
            <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
    </xsl:template>
    
</xsl:stylesheet>

 

 

Parameter can be changed based on the message type used in the flow to make this XSLT mapping dynamic. Template to remove _1 from the node names is added to convert PO xml to CI (CPI) specific xml.

11. Final step would be to download the EDIFACT xsd from Integration Advisor. In this case it is “UN-EDIFACT_INVOIC_D96A.xsd”, add the XML to EDI converter and add the downloaded xsd.

Update: For steps to download the xsd from Integration Advisor, please refer blog

adarshrao_rao_14-1708107792342.png

12. That’s it, save and deploy the iFlow!

Now, when an IDOC is triggered to this iFlow, you will be able to see that the IDOC gets converted successfully to EDI format and the unique values from NRO and segment counters are also populated correctly .

Unique values from NRO for the field D_0020

adarshrao_rao_15-1708107792343.png

Segment counter for the field D_0074

adarshrao_rao_16-1708107792343.png

Summary

These steps will help to easily and quickly migrate simple, point to point B2B outbound EDIFACT interfaces from SAP PO to CI. This will help in reusing the existing mapping done in SAP PO. This blog also explained how SAP PO parameters like  $B2B_END_UEBNR and $B2B_SEG_COUNTER are replaced in SAP Cloud Integration. 

Note: Inbound EDIFACT interfaces will require more modifications and it cannot be used directly from the EDI to xml converter in the imported PO mapping.

In my next blog, I will try to cover how to migrate inbound EDIFACT interfaces w/o using TPM.

Please feel free to discuss your experience with B2B migration from SAP PO to cloud in the comment section of this blog post.