If you download a partner role from R/3 to CRM, a sales area-independent relationship is created in addition to the sales area-dependent partner function in CRM. You can no longer delete this from R/3 by a download in the standard system since a relevant object does not exist in R/3. So when you change the relationship (partner role from ECC) and download to CRM system rather than updating the existing relationship a new record gets created. The old records still remain in the system.
To delete the OLD relationship that exists in CRM system in BUT050 table.
There is an SAP Note which is valid for only CRM Release 3.0 - 4.0.
497146 - Rel. in CRM remains after download of partner function Deletion
· Sales Org
· Relationship category – ZW/ZR
Standard Function Module: CRM_BUPA_MTCS_REL
Create an Implicit Function Module:Z0CR_DELETE_REL_ECC_CRM
ET_REL_EXTERN is the structure will be having the data that is downloaded from ECC.
Get all the data like partner, partner2, sales org, relationship category.
check for the relationship category and sales org.
Check if there is already an entry in CRM with the ET_REL_EXTERN data
2 .Steps to be done if the record already exists in CRM
· Delete the relationship from CRM using the FM BUPA_RELATIONSHIP_REMOVE.
· Delete the record from ET_REL_EXTERN, if we don't remove the record from this structure then it will create a new record in CRM with this data
To test (Debug) this functionality (FM):
Change the used/Password for CRM System maintained in SM59 of ECC system.
In ECC system in SM59 we need to save the ID/PASSWORD and then we can use the user to debug the FM.
Before Relationship Change in ECC
· In ECC system below three customers are having ZW relationship maintained as in below screen shots.
In In CRM system
Define the queue with the partner1, partner2 and relationship category
Then download the queue: R3AR4
Then check the queues SMQ2/SMQ1.
Go to SMW01 and check the BDOC Generated:
N Now check the tables in CRM, only one relationship should exist.