on 10-19-2021 8:38 PM
Dear All, I am having a requirement to Delete customer street address: XD02(from KNA1).I searched for function module for the same but couldn't find it. Also these street address Fields in XD02 are suppressed. SO cant delete the Street address using BDC or LSMW by passing Space .
Only input I have is Customer number and account number.
I will be thankful for kindly helping with function module or solution for above requirement.
Or Kindly provide alternative tcode for XD02 where all the data will be visible and BDC/LSMW can be written.
Regards.
Did you try with MASS ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try following methods
NB: Also you mentionned BDC/LSMW, during SHDB did you check the 'use central address management' box?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Raymond, Thanks for replying. I tried the method BAPI_MAINTAIN and Maintain.
The value KNA1-PSTLZ = 999999 not getting deleted.
Am I correct with below code? Or some thing missed. Kindly guide.
The method doesnt return any error message.
WA_ADDRESS-POSTL_COD1 = '999999'. "”COMNT
WA_ADDRESSX-POSTL_COD1 = 'X'.
WA_CUSTOMER-CENTRAL_DATA-ADDRESS-POSTAL-DATA = WA_ADDRESS.
WA_CUSTOMER-CENTRAL_DATA-ADDRESS-POSTAL-DATAX = WA_ADDRESSX.
WA_CUSTOMER-CENTRAL_DATA-ADDRESS-task = 'D'.
WA_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR = '0000108704'.
WA_CUSTOMER-HEADER-OBJECT_TASK = 'U'.
* WA_CUSTOMER-COMPANY_DATA = WA_COMPANY_CODE.
APPEND WA_CUSTOMER TO WA_CUSTOMERS-CUSTOMERS.
CALL METHOD CMD_EI_API=>INITIALIZE.
CALL METHOD CMD_EI_API=>LOCK( IV_KUNNR = WA_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR ).
CALL METHOD CMD_EI_API=>MAINTAIN_BAPI
EXPORTING
* IV_TEST_RUN = ''
* IV_COLLECT_MESSAGES = 'X'
IS_MASTER_DATA = WA_CUSTOMERS
IMPORTING
ES_MASTER_DATA_CORRECT = WA_CORRECT
ES_MESSAGE_CORRECT = WA_MES_CORRECT
ES_MASTER_DATA_DEFECTIVE = WA_DEFECTIVE
ES_MESSAGE_DEFECTIVE = WA_MES_ERROR.
COMMIT WORK.
CALL METHOD CMD_EI_API=>UNLOCK( IV_KUNNR = WA_CUSTOMER-HEADER-OBJECT_INSTANCE-KUNNR ).
I tried your suggestion.
Got error message: E AM 219 Enter a postal code
WA_ADDRESS-POSTL_COD1 = ' '.
WA_ADDRESSX-POSTL_COD1 = 'X'.
Kept WA_CUSTOMER-CENTRAL_DATA-ADDRESS-task = 'D' as it is.
Also, street Address has several fields-for verifying whether above method works have tried POSTL_COD1 field which is one of the fields in street address.
Kindly help further.
I think you are talking about LSMW/BDC in your latest reply-Am I correct? I cant use LSMW/BDC because of customizing neither I can pass Dummy values as requirement is to delete the street address fields in XD02 which are suppressed and values are still available in KNA1 table and other dependent tables.
If you are talking about the class-method we are discussing then I want to delete the mandatory fields like country/City as well.
I am not anonymizing as need is to delete the street address fields data in prod system.
Can you kindly help further.
You can try using the FM ADDR_DELETE. You will need to pass to it the Address Number. There is code already available on below link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Taha Farosh,
I tried something as below as per the thread:
However it just deletes the Address number from ADRC not from Street address details like Street name or Postal code etc from KNA1.
I will be thankful for kindly helping further.
ls_reference-appl_table = 'KNA1'.
ls_reference-appl_field = 'ADRNR'.
" CONCATENATE sy-mandt lv_addrnumber INTO ls_reference-appl_key.
ls_reference-appl_key = '8100000108695'.
* ls_reference-addr_group = 'BP'.
* ls_reference-owner = 'X'.
" Deletion of an address without dialog
CALL FUNCTION 'ADDR_DELETE'
EXPORTING
address_number = '0002493193'
address_reference = ls_reference
EXCEPTIONS
address_not_exist = 1
parameter_error = 2
internal_error = 3
reference_not_exist = 4
OTHERS = 5.
User | Count |
---|---|
88 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.