Wednesday, July 27, 2016

Integrating one SAP Cloud for Customer system to multiple ECC systems

In this blog, my colleague has described how to integrate from multiple back end systems to one C4C System. That’s clear.

Now what if Accounts should be replicated from C4C to two ECC Systems?


Above scenario is possible with combination of a Custom field on C4C and SDK Enhancement Option implementation(BADI). More info on C4C BADI here.



1. Create a custom field e.g. Back-end System which identifies which system the Account should replicate to.



2. Create Communication System SAPERP1 and its relevant outbound communication arrangement. This communication arrangement should further point to the PO/HCI interface connected to SAPERP1.

3. Create Communication System SAPERP2 and its relevant communication arrangement. This communication arrangement should further point to the PO/HCI interface connected to SAPERP2.




4. Implement a BADI in C4C which determines the correct receiver system. i.e. Create Enhancement option Implementation (BADI) for RecipientSystemDeterminationbyBuinessObject in SDK. This BADI is available in C4C and is called for outbound service interfaces from C4C to SAP CRM or SAP ECC. This enhancement option could be used to determine the receiver system for business object instances if several possible systems have been defined.



Restrictions

This enhancement option can currently be used for the following service interfaces:

  • Business Partner Replicate
  • Business Partner Relationship Replicate
  • Opportunity Replicate
  • Quote Request
  • Sales Order Request
  • Pricing Request

Each business object instance is sent to one receiver system. Sending one instance to several systems is not supported.

a. Create a new Customer Solution:




b. Click the context menu to add new item.



c. Create Enhancement implementation for BADI RecipientSystemDeterminationbyBuinessObject




d. Implementation is created with Filter object and Script objects as shown below.



e. Specify for which Outbound scenario, this implementation should be executed. In our case, its Account replication to ECC. So choose “Request Customer Replication to ERP”





f. In order to consider the custom field “Back-end System” in SDK add item “References to Customer-Specific Fields” and choose the field “BackendSystem”.




g. Save and activate object “CustomerObjectReferences1”, so that this fields becomes available in the scrips.




h. Add the logic to determine the relevant System in DETERMINE.absl

I. Read Business Object CommunicationSystem to get all the recipient systems in C4C.
II. Identify the individual systems based on the System ID.
III. Get the Customer details.
IV. Check whether the “Back-end System” is flagged.
V. Pass back the Businessystem UUID.

Example code:




f. As soon as a customer is created, the above implementation should be hit and the relevant recipient system is determined. Above BADi could also be used for various other outbound scenarios from C4C. More info on BADi could be found in the Repository Explorer in SDK.

Code Snippet:

import AP.Common.Global;
import AP.FO.BusinessPartner.Global;
import AP.CRM.Global;
import DocumentServices.Global;
var result : ReceiverDeterminationBusinessSystem;
var Cust;
var uksys ;
var nlsys; 
/* Get all the systems in the c4c system */
var Recipents = CommunicationSystem.ParticipatingBusinessSystem.QueryByElements.Execute(); 
/* UK System and NL System */
foreach( var system in Recipents){
   if( system.BusinessSystemID == "TE5CLNT100" ){
      uksys = system.UUID;
   };
   if( system.BusinessSystemID == "TE0CLNT100" ){
      nlsys = system.UUID;
   };
}; 
/* Get the Customer which is being created */
Cust = Customer.Retrieve(InputData.UUID); 
/* Get the Customer */
if( Cust.Common.GetFirst().IsSet() ){ 
   /*Check whether the UK System is flagged on Customer*/
   if ( !Cust.CurrentCommon.BackendSystem.IsInitial() ){ 
      /* Replicate Customer to UK system */
      result.BusinessSystemUUID = uksys.content ;
   };
};
return result;

1 comment: