Skip to Content

Filtering object instances in asynchronous outbound replication scenarios

Have you come across the following requirements with your customer?
“I want to replicate prospects out of C4C, but no accounts. The latter should come from a central ERP system and shall not be editable in C4C.”
“Only accounts of a certain sales area shall be replicated out of C4C.”
“We use CRM OP for our US market. C4C shall only send US opportunities to this CRM.
“…”

What all of these requirements have in common is that the customer wants to use the respective standard outbound replication scenario in general, but in detail he would like to block certain object instances from being sent out of C4C while others shall be sent as usual.
How can this be achieved? The answer is by implementing a simple code snippet in SAP Cloud Application Studio to implement the desired filter! Here are the steps which need to be implemented:

1) Create an enhancement implementation…

2) … and select the enhancement option “CheckBusinessObjectInstanceProcessIntegrationRelevance”.

Once created you will see 2 entities as part of the enhancement implementation:
– Filter parameters (.fltr)
– ABSL coding to perform the filtering (.absl)

3) As a next step you need to specify the filter parameters of your enhancement implementation. Here you need to list the integration scenarios for which the enhancement implementation shall be called. In our case we create a filter for scenario “1297 – Request Business Partner Replication”

4) Now the .absl snippet needs to be coded to implement the actual filter logic. In order to do so you need to know the following:
– The import parameter DataInput contains the object type (e.g. “441 – Business Partner Template”) as well as a list of object UUIDs which have been changed within a save cycle
– The return parameter is structurally equivalent. The object type needs to be handed over from the import parameter, the list of object UUIDs filtered to only contain the object UUIDs which shall be replicated based on certain conditions.

The following is an example to only replicate accounts with an A-rating, i.e. to filter out all non-customer business partner types (such as competitors) as well as all non-A customers:

/*
Add your SAP Business ByDesign scripting language implementation for:
Enhancement Option: CheckBusinessObjectInstanceProcessIntegrationRelevance
Operation: CHECK

Script file signature
—————————-
Parameter: InputData of type BusinessObjectInstanceProcessIntegrationRelevance
Returns: BusinessObjectInstanceProcessIntegrationRelevance

Note:
– To use code completion, press CTRL+J.
*/
import AP.Common.Global;
import AP.FO.BusinessPartner.Global;

var result : BusinessObjectInstanceProcessIntegrationRelevance;

result.ObjectTypeCode = InputData.ObjectTypeCode;

foreach (var bupaUUID in InputData.UUID) {

var customerRoot = Customer.Retrieve(bupaUUID);
// only replicate customers
if (customerRoot.IsSet()) {
// only replicate A-customers
if (customerRoot.ABCClassifications.IsSet()) {
if (customerRoot.ABCClassifications.CustomerABCClassificationCode.content == “A”) {
result.UUID.Add(bupaUUID);}}}}

return result;


Please note:

For the enhancement spot mentioned above, SAP predelivers 2 implementations which are executed in addition to any potential custom implementations:
– Block prospects (ERP Integration): Prospects are blocked in case the customer has set the corresponding option in business configuration
– Block marketing leads: As marketing leads are business partners as well, they are blocked from being repicated by this standard implementation

In general, the enhancement implementations are always called for specific communication scenarios defined as filter parameters. The implementations are cumulative, that means all implementations i.e. filters for the same scenario add up and implement an even stricter filter than all previous implementations.

IMPORTANT:

It is important to know that the filter BADI only gets called for instances which have not been sent out of C4C before. Instances which have been sent out of C4C already before will always be sent in the future, there is no way to block them anymore.

9 Comments
You must be Logged on to comment or reply to a post.
  • Hi,

     

    Can we Stop Replication out for certain System based on logic?

    We have two main system connected to C4,

    1. SMC - Marketing Cloud which should have both Prospect , Customer.
    2. ERP- Stop replicating Account with some logic.\

    BR

    Dhruvin

  • Hi Dhruvin,

    in general receiver system determination can be changed by implementing a different BADI called "RecipientSystemDeterminationbyBusinessObject". Here you can code which system a specific object instance shall be sent to...

    For your specific case however, since ERP integration is done via a different webservice compared to Marketing integration, you can implement the above described filter BADI “CheckBusinessObjectInstanceProcessIntegrationRelevance” just for the ERP scenario (step 3.) and not for Marketing.

    Regards, Marcus

    • Hi Marcus Echter ,

      Thanks for your inputs. Look I have scenarion BP Replication to SAP Business Suite set up for multiple Communication system,

      Now our scenario is "Prospect to Customer" for that I would like to create a filter based on role,type etc but also to be able to "NOT" restrict anything which is being replicated to second system.

      But CheckBusinessObjectInstanceProcessIntegrationRelevance badi doesnt have any input or any parameter to identify which is the Recieving system.

      Also How can I debug that badi?

       

      BR

      Dhruvin

      /
      • Hi Dhruvin,

        any specific reason why you use the above scenario "Business Partner Replication to SAP Business Suite" for ERP integration? Are you integrating a 3rd party ERP or SAP ERP? If the latter, then the correct scenario to use would be "Business Partner Replication to SAP ERP" (not Business Suite). Since this is a different scenario than the one used for SMC, you can implement a specific filter (based on bupa role) just for ERP scenario (via filter parameter) in the above BADI.

        If you use a 3rd party ERP (using the same communication scenario as SMC), you could do either of the following 2 options:

        1. Define a target system specific Communication Arrangement filter via the Admin WoC:

        OR

        2. Implement the receiver determination BADI “RecipientSystemDeterminationbyBusinessObject” which is called after the filter BADI to specify which systems to send a specific instance to.

         

        Debugging should be possible via the regular studio feature, just make sure to change the debugging user to be the same as your UI user.

         

        Cheers, Marcus

         

        /
        • Hi Marcus,

          I have right now a lot of integrations,

          1. SAP Marketing Cloud
          2. MAICONNECT
          3. 3rd Party ERP

          And now tryign to get prospect to customer integration integration to S4/MDG

          But when I am trying to set up Communcation arrangement of BP replication To, I can see only one option.

          Am i missing any scoping for point 1?

          2. Now Badi , I was checking 3 options.

          2.1 Comm. Arrangement Filters

          2.2 Badi : Check BO instance process relavent

          2.3 Reciever System Dtermination.

          Requirement : "Trigger" a Prospect to Customer process from C4C and recieve S4 Customer ID back.

          Which i have already did for "3rd PArty" ERPs using whole custom BO logic and all. But now since we have ERP from SAP We would like to not use Custom developments.

          So In nut shell I would like to filter based on some kind of flag that we send data to MDG(i.e BusinessPartnerReplicatiionSelfIntiatedOut is triggered. now my requirment is not getting fulfilled with 2.1,

          Hence I tried 2.2 I created an Enhancement in C4C without logic but put a BP there but it didnt stop ( is it because i have to have a Comm. Arrangement Filter?)

          2.3 So in this Recipient System Detemination by BO Badi , Shall I remove Business System SAP for not desired cases? is that what you meant? 

          I really thank you for your time and Effort!

          BR

          Dhruvin

          /
          • Hi Dhruvin,

             

            1. CA filters can be defined per CA (i.e. scenario + target system) via an own option in the Admin WoC

             

             

            Please note the filters are static and cannot be extended as of now.

             

            2. 2.1 and 2.2. won’t work in your case as all your integrations to the various systems are rightfully using the same scenario. As I mentioned above only SAP ERP (not S/4) would use an own scenario. The breakpoint probably didn’t stop because you have not defined a filter for the BUPA scenario, otherwise it should…

            2.3 would be a feasible option, but please be aware you can only send to 0, 1 or all systems within the receiver determination BADI. You cannot send the instance to “2 out of 3” systems via that BADI. If that is what you want, you need to send to all systems and filter out 1 system on the middleware based on your flag. Or use option 1. in case it offers a relevant filter for you.

            Regards, Marcus

            /
          • Hi Marcus,

            Thanks again for the details!

            For me I am somehow stuck and i think i have to do some very drastic customer solution but in other side i feel since i am integrating multiple SAP system there Must be a standard solution.

            1. CA Filters can not be used in my case because we need to write Some "Logic" and this filters are very static.

            2. Filters in SDK for  CheckBusinessObjectInstanceProcessIntegrationRelevance

            1001-Request Customer Replication to ERP

            1297-Request Business Partner Replication

            1536-Request Business Partner ERP Replication

            But still it didnt stop.

            However RecipientSystemDeterminationByBusinessObject did stop in debugging.

            But as you suggest  You cannot send the instance to “2 out of 3” systems via that BADI the Problem is If I add my logic and select desired System it will not be replicated to other system(which will be not correct because we want to replicate Prospect to SMC irrespective of logic but need some logic before replication to ERP)

             

            LAST Option : Can I use SAP Standard WSDL and create my own Communication Arrangment and trigger with a button click. Is that even possible?

            Checked not possible. X( 

             

            So I have to do this logic in MW.

            BR
            Dhruvin

             

  • Hi,

    according to the documentation in the SDK, marketing attributes cannot be filtered out by such a BAdI (see screenshot):

    Is there another possibility within the C4 Sales Cloud?

    Of course it could be filtered out on the middleware (CPI), but it’s not our preferred solution.

    Best regards

    Paul

    Marcus Echter 

    /
    • Hi Paul,

      Marketing Attributes can be filtered out via the receiver determination BADI “RecipientSystemDeterminationbyBusinessObject”. The parameters indicating the scenarios are "1978 - Business Attribute Assignment" and "1979 - Business Attribute Set". Simply set the receiver system to a dummy one which does not exist.

      Regards, Marcus