Technical Articles
SAP Cloud Platform Integration (CPI) || Fetching Report’s data from ECC to C4C via CPI (Alternative for Mashups in C4C/ Integration fo ECC, CPI, and C4C)
Dear Reader,
To read my series of blog posts on CPI, you can click on the links below:
- My adventure in learning CPI || Part 1 || All about SAP Cloud
- My adventure in learning CPI || Part 2 || Deployment Models
- My adventure in learning CPI || Part 3 || Cloud Security
- SAP Cloud Platform Integration (CPI) || Part 4 || Know your tool
- SAP Cloud Platform Integration (CPI) || Part 5 || Content Modifier
- SAP Cloud Platform Integration (CPI) || Part 6 || Configuring Mail Adapter
- SAP Cloud Platform Integration (CPI) || Part 7 || Maintaining logs by using “Groovy Scripts”, even if the IFlow is not on trace mode.
- SAP Cloud Platform Integration (CPI) || Part 8 || Working with Request Reply
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
SCENARIO:
There is a report in ECC, and the idea is to show the report’s data in C4C. Now, the C4C experts will say that you can create Webservices in ECC and they can be displayed in the “HTML Mashups”which has been provided by SAP, out-of-the-box i.e. by standard.
Now I will tell you what is the problem with Mashups. In the configuration for Mashups you maintain the link to access the report, and the credentials to ECC. Your client’s ECC runs in their private network, and hence, the moment the end-user is outside the company’s network, these reports won’t run. To run these reports you shall need VPN. But, isn’t it much of a trouble for the client, and their end-users? The idea should always be to provide ease to the end-users while transacting.
So what should be done?
SOLUTION:
- [ABAP] Create a webservice
- [CPI] Generate an end-point URL, and share it with [ABAP]. Maintain the Connection details as shown below, and Deploy the IFlow to generate the end-points.
- [ABAP] Share the structure in the form of abcd.wsdl to [CPI], otherwise, the [CPI] person can extract the structure from SE80 from the package in which the [ABAP] has created the Service defination.
- [ABAP] Create a proxy program to send the report’s data. [ABAP/ CPI]Please take a note of the Logical Port name maintained in the program.
- [ABAP /CPI] Enter the TCode, SOAMANAGER. Typically this TCODE when entered, opens in your webbrowser. Now, go to Web Service Configuration.
- [ABAP/ CPI] Search for the consumer proxy program as show below:
- [ABAP/ CPI] By Manual Configuration, create Logical Ports using the same Logical Port, as mention in the proxy program (refer point number 4).
- [ABAP/ CPI] Below is the configuration details for the Logical Port created:
- [ABAP/ CPI] Execute the program in SE80 to send the report data to CPI, so that you can see the incoming Payload which is to be shared with the [C4C] consultant.
- [CPI] Below is the Payload which you can see in the TRACE mode.
- [C4C] Create a custom Business Object in SDK.
- [C4C] Here is the code for the Business Object, which you can creting seeing the payload shared by the [CPI]. Basically, the elements decalred are going to be the columns of the Data Store which you are going to
import AP.Common.GDT as apCommonGDT; [WithAdministrativeData][ChangeHistory] businessobject SaleOrder_Report { [Label ("Report Name")] element ZReportName : LANGUAGEINDEPENDENT_LONG_Text; [Label ("External ID")] element ZExternalID : ID; [Label ("Internal ID")] element ZInternalID : BusinessPartnerInternalID; [Label ("Sales Order Number")] element ZSONumber : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Sales Order Item Number")] element ZSOItem : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Purchase Order Number")] element ZPONumber : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Purchase Order Date")] element ZPODate : Date; [Label ("Quality")] element ZQuality : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Grade")] element ZGrade : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Thickness")] element ZThickness : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Width")] element ZWidth : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Length")] element ZLength : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Finish")] element ZFinish : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Edge Condition")] element ZEdgeCon : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Document Date")] element ZDocDate : Date; [Label ("Quantity")] element ZQuantity : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Basic Rate")] element ZBasicRate : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Product Type")] element ZProdType : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Reason for Rejection")] element ZROR : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Part Weight Min")] element ZPWtMin : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Part Weight Max")] element ZPwWtMax : LANGUAGEINDEPENDENT_MEDIUM_Text; [Label ("Creation Date")] element ZCreationDate : Date; }
- [C4C] A script (.absl) for the “Event-BeforeSave” to be created, and below is the script for it.
import ABSL; import AP.FO.BusinessPartner.Global; foreach (var each5 in this) { if (each5.SAP_SystemAdministrativeData.CreationDateTime == each5.SAP_SystemAdministrativeData.LastChangeDateTime) { each5.ZCreationDate = each5.SAP_SystemAdministrativeData.CreationDateTime.ConvertToDate(); } } foreach (var each2 in this) { var QueryUpdate = SaleOrder_Report.QueryByElements; var SelUpdate = QueryUpdate.CreateSelectionParams(); var CurrentDate = Context.GetCurrentSystemDate(); var CurrentDate1 = Context.GetCurrentGlobalDateTime().ConvertToDate(); SelUpdate.Add(QueryUpdate.ZCreationDate, "E", "EQ", CurrentDate); var ResultUdpate = QueryUpdate.Execute(SelUpdate); if (ResultUdpate.Count() > 0) { ResultUdpate.Delete(); } } foreach (var each in this) { var Query = Customer.QueryByBusinessObjectCustomer; var SelectionPar = Query.CreateSelectionParams(); SelectionPar.Add(Query.ExternalID.content, "I", "EQ", each.ZExternalID.RemoveLeadingZeros()); var result = Query.Execute(SelectionPar); if (result.Count() > 0) { foreach (var custinfo in result) each.ZInternalID = custinfo.InternalID; } }
- [C4C] Create a Data Source on the custom Business Object created. Follow the screeshots below
- [C4C] Create a custom OData Service. Select the Business Object, Select the elements/ fields, Assign the workcenter, Save the OData Service, and Activate it. Share the link with [CPI] Consultant.
- [CPI] Connect the End event to the Receiver using an OData adapter.
- [CPI] In the Message Mapping, maintain the .xsd file generated in the Target, and seeing the incoming payload from ECC, create a structure for the source.
- [CPI] Make the necessary mapping as per the Mapping Sheet shared by Business Team.
- [ABAP/ CPI] Now run the program in SE38, and this will do the following:
- From SE38, the consumer proxy program will send the data from the ERP to CPI, bases on the Transport Settings mainted in SOAMANGER.
- The Data comes to CPI, and gets consumed by the Receiver i.e. C4C on the basis of the OData Adapter Connection setting, and hits C4C.
- In C4C, you may create a report on top of the Data Source created in step number 14, and view the data.
Hope you had a good read.
If you wish to know more, or have any queries on this blog, then please feel free to drop a comment.
Thanks & Regards,
its all very useful thanks mam.
Please do posting more it will be very useful
Hi Sookrithi,
I am trying to sending the webservice data from ECC to CPI.
I have followed above steps but i am receiving the below error when trying to send the data from ECC SPROXY T-code.
Error : Inbound processing in endpoint at /XXXXX failed with message "Fault:Message part {http://schemas.xmlsoap.org/ws/2005/02/rm}CreateSequence was not recognized. (Does it exist in service WSDL?)"
Hi Tarakram,
Were you able to resolve this issue?
Let me know what the solution was?
Hi Tarakaram,
How do you solve this issue?
Hi Sookriti Mishra
In Step 1, You had mentioned to create a Web Service [ABAP]. So in this step we have to create the web service of Proxy program we are creating in Step 4? If not then of which object we have to create the web service?
Great blog.