Skip to Content
Technical Articles
Author's profile photo Ramesh Vodela

Send IDOC from Cloud Platform Integration to ECC (inbound Part2)

Most of the blogs that deal with Cloud Platform Integration API describe in detail integration with SAP- There are not a lot of blogs that deal with CPI API trial version with Cloud Connector and on premise ECC Systems.    As everybody can get access to cloud trial version(CPI), API management, Trail ABAP system and cloud connector I decided to choose this environment for all my blogs on CPI.

In my earlier blog https://blogs.sap.com/2021/01/14/send-idoc-from-abap-trail-version-npl-to-cloud-platform-integration/  which is part 1 of an end to end ECC CPI sending IDOC from ECC to CPI.  In this blog which is Part 2 I describe the inbound process in which CPI sends IDOC to ECC and then we process the IDOC to create a Travel Booking for Customer which anybody can try out.

In Part1 I described the necessary settings to RZ11, STRUST and SM59 type G RFC Connection, IDOC Port in WE21 and Partner Profile in WE20.  We will use the same PORT and Partner profile and extend to add the inbound Configuration.   For this demo scenario I send the IDOC from the ECC To CPI and another CPI integration will send the IDOC to the same ECC.  This could very easily be another S4HANA system or non SAP System via the cloud connector.  Again I send the result to gmail which has to be configured as described in  https://blogs.sap.com/2020/12/06/cloud-platform-integration-gmail-configuration-and-integration-flow/

We have to create security material for gmail user/password and on premise ECC username and Password and deploy it.  Generally I like to do things from Scratch and also develop end to end integrations across technologies. At the end of this blog I would have implemented an End to End IDOC scenario from scratch.  Again we have choose the IDOC message type FLIGHTBOOKING_CREATEFROMDAT to create a customer Travel booking.  Here are the steps in detail.

  1. Create the ABAP RFC Function call can process the IDOC to and Post the travel record             Here the ABAP code for the FM

FUNCTION ZIDOC_SBOOK_CREATEFROMDAT.
*”———————————————————————-
*”*”Local Interface:
*”  IMPORTING
*”     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
*”     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
*”  EXPORTING
*”     VALUE(WORKFLOW_RESULT) LIKE  BDWF_PARAM-RESULT
*”     VALUE(APPLICATION_VARIABLE) LIKE  BDWF_PARAM-APPL_VAR
*”     VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK
*”     VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS
*”  TABLES
*”      IDOC_CONTRL STRUCTURE  EDIDC
*”      IDOC_DATA STRUCTURE  EDIDD
*”      IDOC_STATUS STRUCTURE  BDIDOCSTAT
*”      RETURN_VARIABLES STRUCTURE  BDWFRETVAR
*”      SERIALIZATION_INFO STRUCTURE  BDI_SER
*”  EXCEPTIONS
*”      WRONG_FUNCTION_CALLED
*”———————————————————————-
*———————————————————————-*
*  this function module is generated                                   *
*          never change it manually, please!        29.10.2015         *
*———————————————————————-*

INCLUDE mbdconwf.

DATAreserve_only LIKE  bapisbodatreserved,
booking_data LIKE  bapisbonew,
test_run     LIKE  bapisflauxtestrun.

DATAairlineid     LIKE  bapisbokeyairlineid,
bookingnumber LIKE  bapisbokeybookingid,
ticket_price  LIKE  bapisbopri.

DATAextension_in TYPE STANDARD TABLE OF  bapiparex,
return       TYPE STANDARD TABLE OF  bapiret2.

DATAlT_EDIDD  type standard table of EDIDD,
ls_edidd like line of lt_edidd.

DATA w_zshstuseg LIKE zstudentsseg1.
DATA t_zstudents LIKE zstudents OCCURS WITH HEADER LINE.
workflow_result c_wf_result_ok.
LOOP AT idoc_contrl.
IF idoc_contrlmestyp NE ‘FLIGHTBOOKING_CREATEFROMDAT’.
RAISE wrong_function_called.
ENDIF.

LOOP AT IDOC_DATA WHERE DOCNUM IDOC_CONTRLDOCNUM.
APPEND IDOC_DATA TO lT_EDIDD.
ENDLOOP.

LOOP AT lT_EDIDD INTO IDOC_DATA.

CASE IDOC_DATASEGNAM.
WHEN ‘E1BPSBONEW’.
booking_data idoc_datasdata.
ENDCASE.
ENDLOOP.

CALL FUNCTION ‘BAPI_FLBOOKING_CREATEFROMDATA’
EXPORTING
booking_data  booking_data
IMPORTING
airlineid     airlineid
bookingnumber bookingnumber
ticket_price  ticket_price
TABLES
extension_in  extension_in
return        return.
.

READ TABLE return WITH KEY type ‘E’ into Data(lv_type).
IF sysubrc <> 0.
CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
EXPORTING
wait ‘X’.
idoc_statusdocnum idoc_contrldocnum.
idoc_statusstatus ’53’.
idoc_statusmsgty ‘I’.
idoc_statusmsgid ‘YM’.
idoc_statusmsgno ‘004’.
idoc_statusmsgv1 bookingnumber.
APPEND idoc_status.
CLEAR idoc_status.
ELSE.
idoc_statusdocnum idoc_contrldocnum.
idoc_statusstatus ’51’.
idoc_statusmsgty ‘E’.
idoc_statusmsgid ‘YM’.
idoc_statusmsgno ‘005’.
idoc_statusmsgv1 lv_typemessage.
APPEND idoc_status.
CLEAR idoc_status.
workflow_result c_wf_result_error.
return_variableswf_param ‘Error_Idocs’.
return_variablesdoc_number idoc_contrldocnum.
APPEND return_variables.
CLEAR return_variables.
ENDIF.
ENDLOOP.

ENDFUNCTION.

2.  In Transaction BD51 create a new entry and give the FM created in the previous step

BD51%20-%20Create%20New%20Entry%20and%20Assign%20FM

BD51 – Create New Entry and Assign FM

 

 

3. In Transaction WE57 Create a new Entry Choose the FM and Direction as Inbound

WE57%20New%20Entry%20FM%20and%20Direction%20inbound

WE57 New Entry FM and Direction inbound

 

 

4)  We now have to create Process code.  For this we go transaction WE42 – Give a name to the process code and choose Processing by FM radio button and ALE Service Radio button as shown..  When you save you will be taken to a second screen – in the module section you have to choose the FM under consideration.  These two images are shown below.

 

 

Click Save to Complete the settings for WE42.

5) In Part 1 we have already created Port and Partner Profile for outbound.  We choose the Same Partner profile in WE20 and All inbound configuration as shown below below

Partner%20Profile%20inbound%20Configuration%20WE20

Partner Profile inbound Configuration WE20

 

 

WE%2020%20Complete

WE 20 Complete

 

6) In the Cloud Platform integration we are using the Same Integration which we will modify before we do that we can test the inbound configuration in WE19 and Choose Via Message type and enter FLIGHTBOOKING_CREATEFROMDAT for the message type and populate IDOC Segments as show below

 

WE19%20Idoc%20Header

WE19 Idoc Header

 

WE19%20Data%20for%20IDOC

WE19 Data for IDOC

 

Having done this we choose inbound processing and enter the FM we created

 

If everything is OK you should get a message IDOC has been created.  We can go to WE02 and Check up that the IDOC is created and check the status.   If there are errors you can take corrective actions.

Before we can go the Cloud Platform Integration there are things we need to ECC  which are described below.

7) Go to transaction SICF and active the Service /default_host/sap/bc/srt/Idoc.  T

8) Go to Transaction SRTIDOC and register the service we activated n the previous step as shown below

 

 

9) Here we use cloud connector to create connection to our cloud account.  These are described in many blogs.  Here are my settings

Create%20A%20Connection%20Cloud%20Connector%20Cloud%20Subaccount%20in%20Cloud%20Foundry%20Trial%20account

Create A Connection Cloud Connector Cloud Subaccount in Cloud Foundry Trial account

 

Create Cloud to on Premise HTTP as shown below –  After that Give a access path to /sap and sub paths

 

Now we have cloud connector url http://s4h2:8000 which we will use on CPI IDOC adapter so that ECC instance associated will be invoked by CPI to send the IDOC

 

9) Now we will modify the CPI integration created so that we will send receive the IDOC from ECC and send this back to ECC via the cloud connector and then we will post in ECC to create a travel record in SBOOK.

The modified CPI integration is as follows.  The configuration of Sender IDOC adapter is the same as described in part1 – We had a request response and Receiver before the email and connect them with IDOC adapter and configure them.  We can shift the Content Modifier to be placed after the Request Response

End%20to%20End%20IDOC%20CPI%20IFLOW as shown below.

End to End IDOC CPI IFLOW

 

CPI%20IDOC%20settings%20inbound%20to%20ECC

CPI IDOC settings inbound to ECC

 

The email settings are the same as described in Part1.

Save and Deploy the integration.  Go to the Operations view and make sure that the integration has started.

 

10) in WE19 Send the IDOC as described in part1 and choose outbound processing to send the IDOC – When we do that IDOC sent to CPI and then by IDOC To ECC and then email is sent as configured in the mail adapter. These images are as shown below

Send%20Outbound%20IDOC%20as%20described%20in%20Part%201%20outbound%20processing

Send Outbound IDOC as described in Part 1 outbound processing

 

 

CPI%20Operations%20View%20Success%20Message%20for%20integration

CPI Operations View Success Message for integration

 

 

Email%20sent%20the%20CPI%20IFLOW

Email sent the CPI IFLOW

 

WE02%20Check%20the%20IDOC%20Status%20with%2064%20ready%20to%20be%20consumed%20by%20the%20inbound%20prrocessing

WE02 Check the IDOC Status with 64 ready to be consumed by the inbound processing

 

In Real life we will have batch job to pick up the idoc for processing but as this is not set up we will again use WE19 this time we will should the idoc sent by CPIC in status 64 and choose inbound processing

WE19%20Inbound%20Processing%20Testing

WE19 Inbound Processing Testing

 

Inbound%20IDOC%20processed

Inbound IDOC processed

 

 

WE02%20IDOC%20with%20Status%20message%2053

WE02 IDOC with Status message 53

 

Finally Check SE16 for Table SBOOK that new Entry has been created

A%20New%20Bookid%20has%20been%20created%20in%20table%20SBOOK%20by%20the%20inbound%20process

A New Bookid has been created in table SBOOK by the inbound process

 

As this my personal computer having too many idocs can use up lot of memory – you can delete unnecessary IDOCs using the tcode WE11 or BD87/

 

 

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Nikolaos Tatalias
      Nikolaos Tatalias

      Hi Ramesh,

      thanks for all input.
      from my POV the title "send IDOC from CPI to ECC" is misleading, as message not realy genereated from a Cloud send to CPI and also missing the following:

      1. CPI standard setup for idoc outbound and ECC WE21 and IDOC control of the received Idoc in ECC would also be interesting.
      2. the screen titled WE02 actualy  shows WE19 and the Inbound should be also BD87 not WE19.
      3. the whole part with Z-fromdata - has little/nothing todo with CPI outbound to ECC right?
        (SAP delives thousand of APIs and if not enough BDBG will do).

      many thanks in advance for adressing the case "IDOC from CPI outbound to ECC" once more in a standard setup, if possible,

      Best regards

      Nikos

      Author's profile photo Ramesh Vodela
      Ramesh Vodela
      Blog Post Author

      Nikolaos

      Thanks for the feedback and comments.

      I wanted to blog end-to-end IDOC CPI scenario. My setup is an ABAP trial system and CPI trial which everybody can download and try.  In Part 1 of this series I send an IDOC to CPI and in Part2( this blog) I send the same IDOC from CPI to ECC.   I had to resort to this scheme as I did not have access to other systems which is the case in real life.

      The Comment below the WE19 figure was to go to WE02 to check the results of WE19.

      ZIDOC_SBOOK_CREATEFROMDAT is the FM that is required - although it is outbound from CPI as far as ECC is concerned it is inbound.  This FM is linked to the process code which in turn is configured for the inbound IDOC process as described in the blog.

      If you want an outbound IDOC from CPI you have to read or get the IDOC file from the FTP server or HTTP and then process it.

      Hope this clarifies

      Best regards

      Ramesh

       

      Author's profile photo Alexander Bühler
      Alexander Bühler

      Hi Ramesh,

      I am Alex and I have to configure a SAP ECC 6.00 EHP 4 System to an CPI Cloud Connector.  I do the things you descripe until point 8. The connection between CPI and SAP ECC should be HTTPS or do only HTTP work?

      The connection between CPI und ECC with HTTPS is "Reachable". 

      I have registered the SRTIDOC, but when I do the "Test service" I get an HTTP500 error. It starts an HTTP in a browser. 

      I get an HTTP 500 or HTTP 401 error when I send an Idoc vom S4 over the CPI.

      It will be very nice if you could give me some hints.

      Regards Alex

      Author's profile photo Ramesh Vodela
      Ramesh Vodela
      Blog Post Author

      Alex

      Sorry for the delay in getting back to you.  In my setup, I have my own ABAP developer edition and only HTTP is allowed as I don't have HTTPS.  The screenshots show the exact steps I had to do to make this work.  Check with Basis if you have HTTPS enabled in your system - Try to SICF and right-click any activated node to see the response in Browser.

      Regarding SRTIDOC 500 error you have to talk to basis.  In my system, I did not have any additional steps to make this work.

      Best regards

      Ramesh