Introduction

We are done with the standard setup in our previous posts. We have the basics in place. Outbound and Inbound EDI Flows are working over SFTP And AS2. So far, we have only used a Standard IDoc from ERP. In Part 1 of this series we integrated an Outbound DESADV.DELVRY03 IDoc from ERP into an SFTP Receiver. In Part 3 we extended the same Outbound DESADV.DELVRY03 to an AS2 Based Trading Partner.

Well, what if your ERP system uses a Custom IDoc? How do you define a MIG for a Custom IDoc? How do you get a Custom IDoc working end to end? What if you want to transmit the IDoc as is with no changes to another SAP System ( S/4Hana Cloud). These are the challenges we address in this post.

Scenario in Scope

Scenario in Scope - Handle Custom IDoc in Trading Partner Management
  • ERP triggers a Custom IDoc DESADV.ZDELVRY03 to Integration Suite TPM.
  • Integration Suite will trigger the IDoc as is to S/4HanaCloud SOAP Based System.
  • In other words, there is No Mapping in this scenario.
  • To handle a Custom IDoc from ERP, Custom Message will be defined in Custom Type System
  • Define New Communication System and Identifiers for an Existing Trading Partner – CUSTOMER1
  • Define a new Agreement Template and Agreement for existing Customer – CUSTOMER1

The idea behind defining a new Communication System / Identifiers and Communication Channels is to show how you can extend an existing Trading Partner for different systems and protocols. You can also choose to send this over EDI / SFTP and in this case you can use the existing process from our Part1.

Pre-requisites from Part 1

As you can identify this is an extension of the Part 1 of this series, and below Pre-requisites need to be completed before you can move ahead.

  • Company_Self needs to be created
  • Trading Partner CUSTOMER1 needs to be created.
Pre-requisites from Part 1

High Level Steps in Scope

  • Create a Custom Message in Type Systems for Z IDoc.
  • Create a MIG
  • Create a System S/4Hana Cloud for CUSTOMER1
  • Create a Communication for S/4Hana Cloud for CUSTOMER1
  • Create Identifier for S/4Hana Cloud System for CUSTOMER1
  • Create Agreement Template for Custom IDoc
  • Create Agreement
  • Create a Dummy Passthrough ProcessDirect Iflow

Create a Custom Message Type in Type Systems

Before you start this step, ensure you have the XSD of your Custom IDoc. You can download this from your ERP System or your SAP PO System. Check this blog on how to do this Extract an iDoc structure from SAP ERP to utilize in SAP CPI

Navigate to Integration Suite -> Design -> Custom Type Systems -> Add

Custom Type System Add TPM

Select Custom Messages ( Collection of Custom Messages) and click on Create

Custom Messages
–
Collection of Custom Messages
This Type System can be used by customers to upload and use their own Custom Messages.

Click on the Custom Messages that was just created

TPM Custom Messages

Navigate to the Tab Messages and Add

Tab Messages of Custom Messages

Provide the XSD, and when you do that you can get the below error “Upload failed. The XSD file contains unsupported features. lineNumber: 1; columnNumber: 131; cvc-complex-type.3.2.2: Attribute ‘version’ is not allowed to appear in element ‘xsd:schema‘.

Upload failed. The XSD file contains unsupported features.
lineNumber: 1; columnNumber: 131; cvc-complex-type.3.2.2: Attribute 'version' is not allowed to appear in element 'xsd:schema'.

As the error implies you have a Attribute version=1.0 on the xsd:schema, remove this and try again. Note you will need to cancel and start again

Remove version attribute from XSD schema

Attribute version removed from XSD.

Attribute removed

Reload the XSD after you make the fixes.

Reload XSD

Select the Messages -> Note the root tag here : ZDELVRY03

Provide a Name for the Identifier. Note: This should be DESADV.ZDELVRY03 i.e., it should be in the format MessageType.IDocType.

This naming convention is critical as the Standard IFlows from SAP will use this format when looking for the equivalent TPM Agreement.

Provide the Identifier for your Custom Message in TPM

Your Custom Message is now Ready.

Create a MIG

For the Custom Message we just created, we will now create a MIG. From the Custom Message, click on the Button Create MIG

Create a MIG for your Custom Message.

As we have seen in previous examples where we created a MIG, it is always better to have your Sample XML data handy to create the MIG. In my case I have the IDoc DESADV.ZDELVRY03 as a Custom XML and hence will use that. Ensure you select option Use file content as example values

Create a MIG for Custom IDoc by providing the XML File as an Input.

Provide the Details of your MIG as below and click on Create

  • Name: MIG_CustomIDoc_DESADV_ZDELVRY03
  • Direction: Both
  • Own Business Context: Notify of Advance Shipment

Ensure all the required fields are selected in your Custom ZDELVRY03 IDoc and click on Activate Message and Confirm

Activate your Message in MIG

Click on Activate and Confirm

Activate and Confirm MIG

Your MIG is now ready!

Create a System S/4Hana Cloud for CUSTOMER1

As we have discussed in the previous section, the idea is to take a Z IDoc and enable a pass through scenario for this Z IDoc in Integration Suite over SOAP, i,e, we will not do any mapping in Integration Suite. To enable this for CUSTOMER1 created in Part1, we will create a new System of Type S/4Hana Cloud. The idea being we are also showing how for the same Customer / Trading Partner you can have multiple Systems.

You can skip this and create the Agreement template and Agreement directly ( next steps) but then you need to ensure you select the right Communication System / Identifiers and Channel in your Agreement.

Go to your Trading Partner CUSTOMER1 -> Systems -> Create

Create System for your Trading Partner

Provide the following details and click on Save

  • Name: CUSTOMER1_S4HANACLOUD
  • Alias: CUSTOMER1_S4HANACLOUD
  • Type: SYSTEM_CUSTOMER1 ( you can also choose to create a new system but I just use the existing one)
  • Purpose: Dev
Create a System for existing Trading Partner
System is created but in Incomplete Status

Create a Type System

Go to your Customer1 -> Systems -> CUSTOMER1_S4HANACLOUD -> Type Systems -> Create Type System

Create Type System for Customer

Even though you do not have a S/4Hana Cloud SOAP System, create one with these details

  • Name: SAP S/4HANA Cloud SOAP
  • Version: 1905
Create a Type System for S/4Hana Cloud SOAP

Create a Communication for S/4Hana Cloud for CUSTOMER1

Create Receiver Communication

Go to your Customer1 -> Systems -> CUSTOMER1_S4HANACLOUD -> Communications -> Create Communication

Create Communication for your System

As we do not have a S/4Hana Cloud System, for now I am using a SOAP Receiver Adapter with dummy details for the endpoint. I typically use requestcatcher.com when I want to dump a HTTP Request somewhere.

  • Name: CUSTOMER1_S4HANACLOUD_RECEIVER
  • Alias: CUSTOMER1_S4HANACLOUD_RECEIVER
  • Direction: Receiver
  • Adapter: SOAP_1.x
  • Address: https://dummyaddress.com
  • Authentication: NONE ( Not set in the screenshot below but make sure you put the right authentication)

Create a Receiver Communication in TPM

Create Sender Communication

To make our System Complete we need to add a dummy Sender Channel. Create another Communications and provide below details

  • Name: CUSTOMER1_S4HANACLOUD_SENDER
  • Alias: CUSTOMER1_S4HANACLOUD_SENDER
  • Direction: Sender
  • Adapter: SOAP_1.x
Create a Sender Communication in TPM

Make System Complete

Go to your Customer1 -> Systems, click on Edit and Save. You system status will not change to Complete

Make System Complete
System is now Complete

Create Identifier for S/4Hana Cloud System for CUSTOMER1

Create a new Identifier for your S/4HanaCloud System with below details

  • Identification: CUSTOMER1
  • Alias: CUSTOMER1_S4
  • Type System: SAP S/4HANA Cloud SOAP
  • Scheme: N/A
Create Identifier for S/4Hana Cloud System for CUSTOMER1

Create Agreement Template for Custom IDoc

Create Agreement Template

Create a new Agreement Template with the below Details

  • Name: Company_Self – ERPCLNT200 Sends Z IDoc ZDELVRY03
  • Description : Company_Self – ERPCLNT200 Sends Z IDoc ZDELVRY03
  • System: ERP_ECC
  • Type System: SAP S/4HANA On Premise IDoc
  • Type System Version: #701
  • Identifier: ERPCLNT200
Create a Agreement Template for your Z IDoc / Custom IDoc

Create a B2B Scenario for your Agreement Template

Create a Business Transaction with below details

  • Name: ERPCLNT200 Sends Z IDoc ZDELVRY03
  • Business Transaction Pattern: One Way Notification
  • My Company Role: Initiator
Create a Business Transaction with below details
Business Transaction Pattern: One Way Notification

My Company Role: Initiator
Provide Communication Channel Details

When Selecting MIG, ensure you clear filters

Select MIG in Your Interchange
Select and Reset Filter when you do not find your MIG
Reset Filter when you do not find your MIG

Select the MIG we created in previous step: MIG_CustomIDoc_DESADV_ZDELVRY03

Select the MIG we created in previous step: MIG_CustomIDoc_DESADV_ZDELVRY03

Create Agreement for Custom IDoc for CUSTOMER1

Click on Create in Agreements

Create Agreements

Select Agreement Template from Previous Step

Select Agreement Template from Previous Step

Provide Agreement Details

Provide Agreement Details

Provide Transaction Details

Provide Mapping Details. Even though we have mentioned in the previous section that we will not perform any mapping, we will still need to select “Customized Mapping Processing” and provide a “Process Direct Address”. This Process Direct Address will point to a Integration Flow that does nothing . We will build this Custom Mapping Iflow in the next section but for now provide below details

  • Customized Mapping Processing: selected
  • Process Direct Address: /tpm/mapping/passthrough

Provide Receiver Interchange Details. Ensure that you select the MIG. The MIG will be the same MIG from previous section. You will need to remove filters to select the MIG. Also ensure you have de-selected Enable Payload Validation

Provide Receiver Interchange Details. Ensure that you select the MIG. The MIG will be the same MIG from previous section. You will need to remove filters to select the MIG. Also ensure you have de-selected Enable Payload Validation

Provide Receiver Communication: Select the Receiver SOAP Channel as below screenshot.

Receiver Communication In B2B Transactions

Save your Agreement and Activate it

Activate your Agreement

Create a Dummy Passthrough ProcessDirect Iflow

Create a Dummy Iflow with the Process Direct Sender Adapter. This Process Direct Sender will be on the same Process Direct endpoint defined in the previous section. /tpm/mapping/passthrough

TPM requires mapping as mandatory step while activating and hence this dummy pass through Iflow is required.

Test Your Flow

As a recap, we will now push a Custom IDoc of type: DESADV.ZDELVRY03 from our ERP system. As our Partner configured is CUSTOMER1, as we have seen in the previous Part 1 post, we will need to send the IDoc with the RCVPRN as CUSTOMER1. The SNDPRN if you have followed Part 1 will be ERPCLNT200. Here is the reminder from Part 1 . Below is how your control record should look like

IDoc Control Record

You will see that the message is processed over and it works as needed!

Messages in CPI Message Processing Log

Notice the Message Type, it is the Custom Message Type of the IDoc. Notice how the IDoc is a Custom IDoc.

Message in B2B Monitoring with Custom Message Type

Final Thoughts

Using a Custom IDoc in Integration Suite for Trading Partner Management requires a minor tweak of knowing how to define a Custom Message in Integration Suite Type Systems. It is essential to remember that

  • Custom Message should have the message identifier of the format : MessageType.IDocType. Once you know this trick, most of the remaining parts remain the same.
  • If you want to Build a pass through scenario for TPM, you still need to define a Custom Process Direct Mapping flow that does nothing.
  • S/4Hana Cloud does not support all IDocs out of the box. The idea of using S/4Hana Cloud here is just to show this as a demo. I only send this to a external endpoint and not a real S/4Hana Cloud System. See this reference link for the BAPIs and IDocs supported in S/4Hana Cloud : BAPIs/IDocs in SAP S/4HANA Cloud

The TPM Journey is not easy but as you start repeating the same steps over and over again, there come a sense of familiarity with TPM. Think of your SAP PO development days, or even PI Development days when you needed to define Sender Agreement, Receiver Determination and so on. Once you get the flow of steps, they are repetitive and quite easy to do.

Additional Blogs from this Series