Introduction

In my previous post B2B on SAP Integration Suite – Cloud Integration – CPI – using Trading Partner Management – Part 1 – IDoc to EDI Flow(s) we covered the initial set up of your B2B Trading Partner Management on Integration Suite / CPI / Cloud Integration for a IDoc to EDI Scenario, i.e., an Outbound EDI scenario from an Enterprise perspective.

In this post we continue on this journey ( with the principal of keeping it simple) for an Inbound EDI Scenario,i.e, we receive an EDI file over HTTP or SFTP Adapters and then process it over to our ERP system as an IDoc. We will build on top of the configuration we have already performed.

Scenario in Scope

Scenario in scope

This is a reversal of our previous scenario, i.e., an EDI to IDoc Scenario.

  • Get a EDI file over SFTP from Trading Partner or EDI Gateway.
  • Convert EDI file to EDI XML.
  • Map the EDI XML to IDoc XML using Graphical Mapping of Integration Suite
  • Deliver the IDoc to ERP.
  • Leverage use of TPM.

Pre-requisites from Previous Post

It is very much possible that you do not want to do Outbound EDI scenario and want to start with an Inbound EDI Scenario. In that case while this blog has most of the configuration and steps, there are certain steps you need to refer back to my Part 1. Ensure below steps are configured before you move on from the linked Part 1 post.

  1. Create Company Profile
  2. Create Identifiers (for Self)
  3. Create Systems (for Self)
  4. Create Type Systems ( for Self)
  5. Create Trading Partners
  6. Create Identifiers
  7. Create System
  8. Create Type System

Pre-requistes from Previous Post

High Level Steps in Scope

  • Create a MIG for EDIFACT Message
  • Create a MIG for IDoc
  • Create Communication System for Trading Partners
  • Create Communication System for Self
  • Define Agreement Template
  • Define Agreements
  • Create your Mapping IFlow
  • Create a SFTP Sender IFlow
  • Configure / Customize Standard IFlows
  • Test your Flow

Create a MIG ( Message Implementation Guide) for EDIFACT Message

The EDIFACT message in scope in our implementation is ORDERS D96 B. We will create a MIG for this EDIFACT Message. If you have the EDI XML available to you, that will make your life easy, else you just need to select all the relevant fields in scope.

Go to Integration Suite –> Design –> MIGs. Click on ADD

Add MIGs

Select UN/EDIFACT

UN/EDIFACT Type System MIG

Search for ORDERS and Select ORDERS

EDIFACT ORDERS MIG
MIG for EDIFACT ORDERS

Select D.96B.S3 ( Corresponding to our EDIFACT Incoming EDI(

ORDERS D96B

If you have the EDI XML of your Cloud Integration, you can use that here to make your MIG process easy. Note: You will also see the option here to select Process Integration. This also allows you to use EDI XML from Process Integration ( or Process Orchestration) if you are planning to migrate EDI from SAP PO to Cloud Integration. If you do not have the EDI XML, you can skip this step.

MIG SAP Cloud Integration Use File Content Example Values

Provide the below details

  1. Name: MIG_UN_EDIFACT_ORDERS_D96B
  2. Direction: BOTH
  3. Own Business Context : Select Required Business Process Context
  4. Click on Create
MIG for ORDER D96B Create
  1. Select Option Get Proposals . I would suggest you select the fields in scope as per your EDI Guidelines and specification.
  2. If you have your EDI File example, you can also Simulate this and make sure it works.
  3. Activate your MIG
Simulate Get Proposals and Activate MIG

Create a MIG for IDoc

As per our requirement, the IDoc in scope is an ORDERS.ORDERS05 IDoc. You can use the Message Implementation Guidelines section to create a MIG for ORDERS.ORDERS05 IDoc. The steps are similar to what we have described in previous section and hence I will just provide some self explanatory screenshots here.

MIG SAP S/4Hana On Premise IDoc
MIG for ORDERS.ORDERS05
Select MIG S/4Hana On Premise IDoc Version
Provide Cloud Integration IDoc XML if available
Create MIG for ORDERS.ORDERS05 IDoc.
Simulate, Get Proposals and Activate MIG

Create Communication ( for Trading Partner)

As we will receive the EDI File from our trading partner (CUSTOMER1) over SFTP, we will need to create a Sender Communication for this Trading Partner in TPM. Unfortunately SFTP is not supported currently in TPM. ( As of Sep 2023) This is on the roadmap (Q4 2023) and hence as a workaround we will define a AS2 Sender Communication System. In reality we will not use this but to allow us to move forward we need to define a AS2 Sender Communication for our Trading Partner – CUSTOMER1. [ Updated to reflect the Nov 2023 release from SAP to allow for ProcessDirect Based flows]

Navigate to your Integration Suite -> Design –> B2B Scenarios. Go to tab Trading Partners. If you have followed all steps in the Pre-requisites you should see the Trading Partner CUSTOMER1. We will add the Communication for this Trading Partner.

Navigate to Systems –> Communications of your Trading Partner and click on Create

Not relevant from Nov 2023

Enter below details and save

[Updated Nov 2023 to allow ProcessDirect based Senders]

  1. Name: CUST1_COMM_DUMMY_SENDER
  2. Alias: CUST1_COMM_DUMMY_SENDER
  3. Direction: Sender ( As your Trading Partner is now going to Initiate the message)
  4. Adapter: AS2 ( As SFTP Is not Supported and this is a Dummy channel)
  5. Security Configuration: Channel
  6. User Account: Dummy
  7. Leave other details as is and Save
  • Name : CUST1_COMM_SFTP_PROCESSDIRECT_SENDER
  • Alias: CUST1_COMM_SFTP_PROCESSDIRECT_SENDER
  • Direction: Sender
  • Adapter: Process_Direct

Not relevant from Nov 2023

Create Communication (for Self)

As we are going to map the EDI file to a IDoc and post an IDoc to SAP ECC ( ERP) we will need to define a Receiver Communication for our Company.

Navigate to B2B Scenarios on your Integration Suite and Tab : Company Profile. If you have completed all pre-requisites of previous section, you will see your Company as below

Navigate to Systems -> Communications and Click on Create

Enter below details and click on Save

  1. Name: ERP_ECC_IDOC_RECEIVER
  2. Alias: ERP_ECC_IDOC_RECEIVER
  3. Direction: Receiver
  4. Adapter: IDOC
  5. Address: http://<<erphostname>>/sap/bc/srt/idoc?sap-client=<<clientnumber>>
  6. Proxy Type: OnPremise
  7. Authentication: Basic
  8. Credential Name: ERPCLNT200
Add Receiver Communication in TPM

Note: In this configuration, I have assumed that I use cloud connector to connect to my ERP system. Adjust details accordingly.

Refer to part 4 of this blog series of mine for IDoc Configuration (HCI/HCP-IS: IDoc Adapter Deciphered – Part 1 – Trigger IDoc from SAP ERP to HCI Using Basic Authentication)

Define Agreement Template

In this section, we will create a Agreement Template in our Trading Partner Management. The Agreement Template here is where CUSTOMER1 is the Initiator and ERPCLNT200 is the Reactor

Go to Integration Suite -> Design -> B2B Scenarios -> Agreement Templates.

Create Agreement Templates in Trading Partner Management
  1. Name: Customer1 Initiates EDIFACT ORDERS D96B
  2. System –> ERP_ECC
  3. Type System –> S/4 HANA On Premise IDoc
  4. Type System Version –> 701
  5. Identifier –> ERPCLNT200
Create Agreement Template for EDIFACT ORDERS D96B

Create a B2B Scenario / Transaction

Create Business Transaction in Trading Partner Management
  1. Name: EDIFACT ORDERS D96B To IDoc ORDERS.ORDERS05
  2. Business Transaction Pattern: One Way Notification
  3. My Company Role : Reactor
Provide Details of Business Transaction
Define Interchange Details
Provide Interchange Details

When you try to select the Message Implementation Guideline MIG; you will not be able to see your MIG. That is because your MIG was defined for S/4Hana 1709 but our ECC version is 701. Reset the filters and then the search will work.

Reset MIG Search Filter
Select your MIG

Define the Communication channel ( IDoc) in your Template.

Provide your Communication Details in MIG

Define Agreement

Create a Agreement in your Trading Partner Management as per below details.

Create Trading Partner Agreement for Customer1 Initiates EDIFACT ORDERS D96B
Provide Trading Partner Details in Trading Partner Agreement

We have not created a Type System Version for D.96B.S3 so far as we will receive a EDIFACT message of Type System Version D.96B.S3. We will create that now .

Update Type System Version in Trading Partner Agreement
Create Type System Version from Trading Partner Agreement

You will now see D.96B.S3 in your Trading Partner Agreement. Select that and the remaining Identifiers as per screenshot below.

Provide Sender Communication Details in Trading Partner Agreement

Provide Sender Interchange Details in Trading Partner Agreement

Sender Interchange Details in Trading Partner Agreement

Provide Mapping Details in Trading Partner Agreement

As per our scope, we will not use MAG and use a Message Mapping in Cloud Integration. Select option “Customized Mapping Processing” and provide your Process Direct endpoint of your Iflow ( /tpm/Customer1/EDIFACT_ORDERSD86B/IDOC_ORDERS_ORDERS05). Note this endpoint as you will use it in the next step.

Mapping Details in Trading Partner Agreement with Custom Mapping

Activate your Trading Partner Agreement

Create your Custom Mapping IFlow

As per previous section, we need to have a custom mapping flow running on the Process Direct Endpoint: /tpm/Customer1/EDIFACT_ORDERSD86B/IDOC_ORDERS_ORDERS05

Create an IFlow that takes your EDI XML as Input and maps it to the ORDERS05 IDoc. I will not go into the details of this. Below screenshots are self explanatory.

Create a SFTP Sender IFlow

[[Updated in Nov 2023 to reflect the new Process Direct Based Approach with the package release from SAP]]

Define a SFTP to ProcessDirect Iflow that receives a EDI File from SFTP and sends it over ProcessDirect. The ProcessDirect endpoint will be /tpm/b2b/processdirect, pointing to the standard IFlow Step 1 – Sender Process Direct Communication Flow V2.

In this flow as we process a EDI File, we need to set a header for the next Standard IFlow from SAP to identify the type of message.

Set Header “SAP_EDI_Document_Standard” with value “UN-EDIFACT” ( for EDIFACT) or “ASC-X12” ( for ANSI X12). See below screenshot.

Create a SFTP to ProcessDirect Iflow to handle SFTP for TPM
Create a SFTP to ProcessDirect Iflow to handle SFTP for TPM. Set Header "SAP_EDI_Document_Standard" with value "UN-EDIFACT" ( for EDIFACT) or "ASC-X12"  ( for ANSI X12)

As we have seen previously we have configured our Trading Partner Management in previous section to have AS2 Sender as our Sender Channel. This was done to overcome the limitation of our TPM as it does not support SFTP yet.

To now get to process our inbound EDI file over SFTP,

  • Go to the Standard Package of SAP Cloud Integration – Trading Partner Management V2
  • Copy the Iflow Step 1 – Sender AS2 Communication Flow V2 as a custom Iflow with Name Step 1 – Sender SFTP As AS2 Communication Flow V2 in your own Custom Package.
  • Once you have done that, change the Sender AS2 Channel in this copied Iflow to a Sender SFTP Channel. Do not change anything else except the Sender AS2 Channel.

See screenshots

Step 1 - Sender AS2 Communication Flow V2 Copy

Not relevant from Nov 2023

Copy Iflow  Step 1 - Sender AS2 Communication Flow V2

Not relevant from Nov 2023

Change the Sender Adapter as SFTP for Step 1

Not relevant from Nov 2023

Configure / Customize Standard IFlows

As per our previous post, we need to deploy as is the below Iflows and Groovy Script from Standard SAP Package Cloud Integration – Trading Partner Management V2 .

Navigate to Discover -> Integrations and Copy the Standard Package
Cloud Integration – Trading Partner Management V2 to your tenant

  • Reusable Groovy Scripts V2
  • Step 2 – Interchange Processing Flow V2
  • Step 1 – Sender Process Direct Communication Flow V2

Optionally Deploy this Iflow depending on whether you have implemented the previous Post or not. If you are directly implementing a SFTP to IDoc EDI Flow, you need to deploy this Iflow. If you have already implemented the Part 1 of this series for IDoc to EDI Flow, then do not deploy this Iflow as you have built a Custom Iflow in Part 1

  • Step 3 – Receiver Communication Flow V2 ( Note: If you have implemented the previous scenario from Part 1 where you modified this iflow, then do not Deploy this iflow. You will use the Modified IFlow.)

Below are the list of Iflows to be deployed

S.NoIFlowDescription
1CUST1_COMM_SFTP_PROCESSDIRECT_SENDERCustom IFlow for SFTP to Process Direct
2Step 1 – Sender Process Direct Communication Flow V2Standard Iflow for ProcessDirect Sender
3Step 2 – Interchange Processing Flow V2Deploy As Is
4Step 3 – Receiver Communication Flow V2Deploy As Is if directly implementing this scenario. Else Deploy Step 3 – Receiver Communication Flow V2 SFTP Modified from previous post
5Reusable Groovy Scripts V2Deploy As Is
Summary of IFlows Deployed

Test You Flow

Drop a EDIFACT EDI Message of Format ORDERS D96 B on your SFTP Server. The File will be picked by Iflow CUST1_COMM_SFTP_PROCESSDIRECT_SENDER and processed all the way to ERP. The Iflows that will be triggered are

  • CUST1_COMM_SFTP_PROCESSDIRECT_SENDER
  • Step 1 – Sender Process Direct Communication Flow V2
  • Step 2 – Interchange Processing Flow V2
  • EDI_ORDERS96B_TO_ORDERS – Executes our Mapping
  • Step 3 – Receiver Communication Flow V2 SFTP Modified

The message will be processed over and will look as below in the B2B Monitor

  1. Message Type : ORDERS ( As Sender Sends EDIFACT Orders )
  2. Message Number: 15 ( UNH Message Reference Number)
  3. Sender Identifier : CUST_1234 ( Corresponding to Customer1 EDI Identifier)
  4. Receiver Identifier : SELF_1234 ( Corresponding to Self Company EDI Identifier)
  5. Document Standard : UN-EDIFACT
  6. Interchange Control Number: EDI ICN Number
  7. Adapter Type : AS2 ( Workaround as SFTP is not supported)
  8. Message Type : ORDERS.ORDERS05 ( Corresponding to IDoc Orders)
  9. Document Standard : SAP_IDoc
  10. Sender Identifier: CUSTOMER1 ( for IDoc SNDPRN)
  11. Receiver Identifier: ERPCLNT100 ( for IDoc RCVPRN)
B2B Monitoring Integration Suite for EDI Message
B2B Monitoring Sender Interchange Received
Receiver Interchange Payload In B2B Monitoring

Final Thoughts

We have extended our EDI flow for an Inbound EDI flow. We have received a EDIFACT Message and processed them over into Integration Suite using Trading Partner Management and B2B.

The only “Customization” we have done is to handle SFTP for Sender / Receiver channel by leveraging AS2 ( for Sender) and SOAP ( For Receiver). With multiple partners in your landscape you can avoid having to write custom code and leverage the B2B Trading Partner Management and its Partner Directory to handle all your EDI Flows.

In the next part we will look at extending this to use a AS2 Sender Channel and AS2 Receiver Channel. Stay Tuned!

Additional Blogs from this Series