Avoiding WAITING queues for BUPA_REL BDOCs for performance
I would like to share some ideas how one could avoid WAITING queues when processing BUPA_REL BDOCs.
When we create a relationship between two business partners, CRM system generates one BUPA_REL BDOC and two queues, respectively for each individual business partner. In most of the cases, it is not causing any problems, because SAP CRM is intended to operate with many pairs of business partners, considered these pairs are not linked to each other.
However, sometimes there are scenarios, when one BP is linked to many business partner, e.g. when you operate with corporate account and its employees. In these cases the relationships are often generated massively and should be replicated across the landscape (e.g. SAP ERP) in the meaningful time frame.
In this case, we will see many individual queues waiting for the related partner to be processed within its own queue. For N relationships, we will then have N individual queues waiting for one big queue with N entries. This is illustrated n the picture above.
Such a design was implemented in order to ensure the consistency of the BP processing. BUPA_MAIN BDOCs are processed within the same queues (CSABUPA*) and therefore this mechanism ensures that we will never create a relationship to the non-existing BP, as we will always be waiting the previous queue to finish.
However, sometimes, this can be ignored as all BP could have been created and replicated beforehand. In this case, we do not need a main BP queue and therefore the individual queues won’t be waiting for anything. This can significantly speed up a performance (as much, as many you have dialog work processes configured in the system).
Processing of the BUPA_REL is happening inside the FM BUPA_MWX_BDOC_CREATE_REL pair by pair. The queues are written into the table LS_CLASSIC_BDOC-CRMW_BUPR_HEAD.
If you skip writing a main BP queue into this table, this queue will not be generated, and the others will not be waiting for it.
But as I said this can only be implemented for the partners which have been already replicated and only for some specific business cases as all the negative consequences probably are not discovered yet. You can do a check against the table CRMM_BUT_CUSTNO to get information, whether the BP has been already replicated or not.
To implement a logic, you can register your own function in CRMC_BUT_CALL_FU or use an implicit enhancement.
Please do not consider it as SAP recommendation. Implement it carefully as it’s totally on your own risk. In case of problems or doubts, open an incident to SAP.