cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module or BAPI to Delete Contact Persons

Former Member
0 Kudos

Is there any function module to delete contact persons (table knvk)? We have been unsuccessful with SD_CUSTOMER_MAINTAIN_ALL which seems to only implement updates and deletes.

Accepted Solutions (0)

Answers (4)

Answers (4)

bruno_esperanca
Contributor
0 Kudos

Do you still need this? I might be able to help.

I have created a class to create/edit vendor contacts, it shouldn't be too difficult to delete as well.

Check it out here, might give you a few ideas:

Best,

Bruno

Former Member
0 Kudos

The "answer" seems to be to use SD_CUSTOMER_MAINTAIN_ALL but to just accept that it doesn't actually delete the contact. Instead the contact is removed from the customer. In technical terms KNVK-KUNNR is cleared and the contact remains in the system but not attached to any customer.

**********************************************************************
  DATA: lt_xknvk     TYPE fknvk_tab,
        lt_yknvk     TYPE fknvk_tab,
        ls_fknvk     TYPE fknvk,
        ls_kna1      TYPE kna1.
**********************************************************************

  DATA contact TYPE parnr VALUE '0000123456'.

  " Old Data
  SELECT SINGLE * FROM knvk INTO CORRESPONDING FIELDS OF ls_fknvk WHERE parnr = contact.
  APPEND ls_fknvk TO lt_yknvk.
  SELECT SINGLE * FROM kna1 INTO ls_kna1 WHERE kunnr = ls_fknvk-kunnr.

  " New Data
  ls_fknvk-kz = 'D'. " Delete
  APPEND ls_fknvk TO lt_xknvk.

  CALL FUNCTION 'SD_CUSTOMER_MAINTAIN_ALL'
    EXPORTING
      pi_postflag = 'X'
    TABLES
      t_xknvk     = lt_xknvk
      t_yknvk     = lt_yknvk
    EXCEPTIONS
      OTHERS      = 1.
Former Member
0 Kudos

Hi,

I'm afraid you are right.

No function module seems existing to delete properly a contact person.

BUT I strongly advise against direct deletion of KNVK records.

KNVK is related to several complex address tables. Moreover, contact persons could be present as partner function in master data tables or transactional data.

This is surely one of the worst action you can do.

There are several ways to achieve such deletion.

1/ batchinput ==> XD02, in the overview screen, select the contact person with ok-code /06, then delete it with ok-code /14

2/ delete it via DEBMAS idoc. segment E1KNVKM with MSGFN field = 003

3/ Starting with release ECC 2005, class CMD_EI_API can be used to delete or maintain customers. This includes deletion of contact persons.

Hope this helped

Best regards

Alain

Former Member
0 Kudos

Hi Alain,

I've a related question on deletion of the contacts. In case the contact is deleted from XD02, would the CMD_EI_API class trigger the methods to synchronize and delete the business partners from BUT000, BUT050/51/52 and CVI_CUST_CT_LINK tables?

Would really appreciate your input on CVI.

Thank you,

Vishal Parikh

Former Member
0 Kudos

Use the FM "ISAI_CONTACT_DELETE" to delete the contact person of a customer.

Former Member
0 Kudos

We have now been using ISAI_CONTACT_DELETE for a couple of months now. It works in most cases but in many cases it generates strange error. For example we regularly get the error "Problem with IDOC processing" and cannot explain it.

former_member202528
Active Contributor
0 Kudos

Hi,

I guess there is no FM or BAPI for thsi purpose.

although below process is not advisable, but you can delete the entry from table directly in debug mode, provided proper access to you. Pls contact ur tech folks for deleting, they might have the access.

BR,

Krishna