cancel
Showing results for 
Search instead for 
Did you mean: 

deleting address usage not replicating in CRM

Former Member
0 Kudos

Hello Friends,

Below is the code to replicate the problem i have in my system. This report will check if the BP in processing has address usage of type 0003 which is Forwarding address in our system, then delete it and assign the standard address of BP as forwarding address usage 0003.

The problem is when performing deletion the CRM system is not updated correctly. BDOC created doesnot deletes the entry in CRM.

Note :- You must change BP data in BP screen. This report runs in R/3.

Steps:-

1. Create a new BP.

2. Run program.

2.1 Add two addresses to BP.

3. Assign the non-standard as forwarding address or any other address

usage you will put in the code. " lt_add-ADDRESSTYPE = '0003'.

4. save it.

This will trigger BDOC's to update CRM system. After the run you can see

the difference between the BP address usage in two systems.

Please advise what can be done?

Regards,

Pankaj

************************************************************************************************************************

REPORT Z_BP_CHANGE .

DATA: W_BUT020 TYPE BUT020,

W_BUT021 TYPE BUT021,

GUID TYPE BUT020-GUID,

TASK TYPE BU_UPDFLAG.

DATA : LT_ADD TYPE BAPIBUS1006_ADDRESSUSAGE occurs 0 with header line,

LT_ADD_X TYPE bAPIBUS1006_ADDRESSUSAGE_X occurs 0 with header line,

LT_RETURN TYPE STANDARD TABLE OF BAPIRET2.

PARAMETER BP TYPE BU_PARTNER.

*CHANGE ISU PARTNER

CALL FUNCTION 'ISU_S_PARTNER_CHANGE'

EXPORTING

X_PARTNER = BP

EXCEPTIONS

NOT_FOUND = 1

FOREIGN_LOCK = 2

NOT_AUTHORIZED = 3

CANCELLED = 4

INPUT_ERROR = 5

GENERAL_FAULT = 6

OTHERS = 7.

SELECT SINGLE * FROM BUT021 INTO W_BUT021 WHERE PARTNER = BP AND ADR_KIND = '0003'.

*CHECK IF ADDRESS USAGE IS ALREADY ASSIGNED. IF YES DELETE ASSIGNMENT

IF SY-SUBRC = 0.

SELECT SINGLE * FROM BUT020 INTO W_BUT020 WHERE PARTNER = BP AND ADDRNUMBER = W_BUT021-ADDRNUMBER.

GUID = W_BUT020-ADDRESS_GUID.

TASK = 'D'.

*DELETE EXISTING ADDRESS USUAGE.

PERFORM UPDATE_BP USING TASK.

ENDIF.

CLEAR: GUID, W_BUT021, W_BUT020, TASK.

REFRESH: lt_add_x, lt_add.

*ADD STANDARD ADDRESS USAGE

SELECT SINGLE * FROM BUT020 INTO W_BUT020 WHERE PARTNER = BP AND XDFADR = 'X'.

GUID = W_BUT020-ADDRESS_GUID.

TASK = 'I'.

*ADD STANDARD ADDRESS USUAGE.

PERFORM UPDATE_BP USING TASK.

  • MAINTAIN BP ADDRESS

FORM UPDATE_BP USING TASK TYPE BU_UPDFLAG.

lt_add-ADDRESSTYPE = '0003'.

lt_add-STANDARDADDRESSUSAGE = 'X'.

append lt_add.

lt_add_x-STANDARDADDRESSUSAGE = 'X'.

lt_add_x-ADDRESSTYPE = 'X'.

lt_add_x-UPDATEFLAG = TASK.

append lt_add_x.

CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'

EXPORTING

BUSINESSPARTNER = BP

ADDRESSGUID = GUID

ACCEPT_ERROR = 'X'

TABLES

ADDRESSUSAGE = lt_add

ADDRESSUSAGE_X = lt_add_x

RETURN = LT_RETURN.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDFORM. "UPDATE_BP

Edited by: PANKAJ ARORA on Apr 22, 2008 4:15 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi pankaj,

Could not see any problem in your code. Just try and see the return table of the BAPI 'BAPI_BUPA_ADDRESS_CHANGE'. Hope this is not returning any error message.

Plese check for the unique GUID also.

Regards

Sourabh

Former Member
0 Kudos

Hello Sourabh,

Thanx for your reply. The return is empty. All the changes are carried out perfectly except the updates in CRM. and only when the program does the deletion of the address usage, the BODC to CRM doesnot delete the address. It seems middleware buffering issue to me but not sure.

Did you try to run this report and reproduce the problem in your system?

Regards,

Pankaj