Hi guys, in this article I want to share one scenario How to trigger IDOC from CPI to SAP ERP using basic authentication. This scenario is useful in case which we want create data xml from third party and send this data xml to SAP ERP to create IDOC and posting document. Another way, It’s called Inbound IDOC XML. Kindly take a look this diagram to get more clearly

In this article, we will create scenario as :
- Third party will send data XML with structure ORDERS05 – Sales Order to SFTP. In fact, for simple we will use POSTMAN to send XML to CPI
- In integration flow, for simple we just use one HTTPS for sender adapter and one IDOC for receiver adapter
- In last, after data sent successful to SAP ERP, we will check SALES ORDER created.
Ok, here we go
Configure SAP ERP Settings
Step 1 : Active service
Go to T-Code : SICF
Search service with path : /sap/bc/srt/idoc
F8 to execute.


Step 2 : Register service
Go to T-Code : SRTIDOC
Choose Register Service. Press F8 to run with default

If service is registered, we will receive this message

else, It will be successful.
Step 3 : Run Test Service to get Endpoint.
Go to T-Code : SICF
Search service /sap/bc/srt/idoc
Right click and choose Test Service

Note the URL that comes in your browser. This is the URL where your IDoc adapter in HCI needs to point. The URL will be of format :
http://host:port/sap/bc/srt/idoc?sap-client=<clientnumber>
Step 4 : Create Logical System
Go to T-Code : SALE
Create Logical System
Assign this logical system to client.

Step 5 : Create partner profile and add Inbound parameter
Go to T-Code : WE20
Choose partner type = LS from left side tree view
Choose create and input information in step 4 – local system as Partner No.

Step 6 : Test service from POSTMAN
Case 1 : No body or wrong data XML.

Go to T-Code : SOAMANAGER


Case 2 : Wrong user/pass or User not in ROLEs


Case 3 : It’s OK. IDOC will create in SAP ERP. Check T-Code : WE02


SAP Cloud Connector Configuration
Login SAP Cloud Connector

Choose Cloud to On-Premise at left side.
Create
Back-end Type : ABAP System


Next, reference to Test Service above to take internal host and port

Next, choose virtual host


Add Resources of this host. Take in URL when run Test service in above step. In this case is : /sap/bc/srt/idoc

Finally, check on SAP BTP

CPI Configuration
Step 1 : Create Credential Name with User/Pass use for create IDOC on SAP/ERP. This user have to create on SAP and take ROLE can create IDOC and Posting document
Go to SAP BTP
Go to Integration Suite Application
Go to Monitor
Go to Security Material under group Manage Security



Fill user/pass. This name will use for in step config Integration Flow.
Step 2 : Design integration flow
In this integration flow, use components :

Configuration for sender HTTPS

Configuration for sender SFTP ( Solution 2)


Configuration for receiver IDOC

- (1) : Address : http://<Vitualhost on SCC> + <Resource on SCC> ? sap-client = xxx
- (2) : On-premise
- (3) : Basic
- (4) : Credential name which configured in step 1 of CPI Configuration
TEST from CPI by POSTMAN
Case 1 : No body

Case 2 : It’s OK, but invalid Partner Profile
Payload

POSTMAN :

SAP/ERP T-Code : WE02

Case 3 : SAP Cloud Connector cannot connect to backend

With this case, check SAP Cloud Connector to check destination

Case 4 : Connection time out

How to track SAP CPI generated IDOC in SAP ERP
Add Content Modifier component.
Add header as below:
Name | Value |
Name | SapMessageId |
Source Value | SAP_MessageProcessingLogID |
Source Type | Header |

Send data to SAP/ERP.
Check control record => details. We will see one text look like

Check on LOG of CPI

Summary
In this article, I discuss about scenario how to send data IDOC xml from third party system to SAP ERP through SAP Cloud Connector. This scenario use for in cases integration between SAP ERP backend and third party with SAP CPI and SAP Cloud Connector. Thanks for your reading and any question, kindly leave your comment on below this.
Thanks.
Joseph.
Hi Joseph,
When i call IDOC from CPI to SAP, the status is 64 – IDoc ready to be passed to application.
I have to Execute again in BD20 and the status will changed to 53.
I have set up Trigger Immediately in WE20 and there is no dump occured.
do you know how to solve this problem?
Thanks.
Jasper
LikeLike