In standard, if you delete the partner funcion from ERP system, the relationship will not be deleted automatically and it remains in CRM.
Let me explain the reason firstly:
There is a general data protection scheme in CRM in that nothing should be automatically deleted, the relationship can only be deleted manually in CRM.
It cannot be trigged automatically from R/3. This system is behaving correctly by not deleting the relationship on the CRM side. The deletion of Partner Functions does not mean that the corresponding Relationship is to be deleted, because this relationship may be used within other sales area and therefore would cause inconsistencies.
in order to achieve the behavior that the CRM relationship is also deleted when the partner function is deleted in ERP, the customer can implement the funcion module Z_BUPA_DELETE_RELATIONSHIP in transaction CRMC_BUT_CALL_FU as per note 497146. (The recommandation of the position of this entry is 1400000.)
Please note this function module will only trigger for delta replication. Besides, this function module only takes affect for Partner Functions created/deleted from the time the function module is created and activated.
To remove the inconsistencies already present before you implemented it you can make use of the note 682427.
But, there are still entries existing which could not be removed by the note 682427 if there is entry in table CRMM_BUT_FRG0081. It is due to that the particular relationship may be used within another sales area and therefore would cause other inconsistencies.
Therefore, the note 682427 is only used to delete the relationships in CRM that are no longer assigned a partner function.
To remove the remaining inconsistencies, I will provide you the following two workarounds:
<1> You can use SDIMA to find out the data inconsistency and run a request to bring ERP and CRM synchronized. Creat SDIMA instance and run a request load.
<2> You can also delete all CRM relationships and then perform a new initial load for object CUSTOMER_REL.
Hope this blog helps on partner function deletion issue.