05-23-2006 6:17 AM
Hi All,
I am using BDC for transaction XD02 to change the customer account. For addition/deletion/modification of contact person (under general data->contact person tab), I do not want to use BDC for table control because of some problems. To overcome such problems, I can use transaction VAP1 to create and VAP2 for change. But I am not able to find out the functionality for deletion of contact person. I have also tried standard BAPI option but could not get much. Please help me to find the soultion to delete contact person for given customer, other than BDC for XD02 transaction.
-Tejal
05-23-2006 6:30 AM
Dear Tejal,
You can use SCAT tool for recording the transaction XD02 for deleting the contact person information.
Its just like recording the sequence like we do it in SHDB.
Go to transaction SCAT, create a test case and save it. The same test case once recorded properly can be used for no.of customers in a single shot.
Lakshminarayanan
05-23-2006 6:42 AM
Hi,
Thanks, If I have understood rightly,I can not go for transaction recording as table control can contain multiple records with the same name and on the screen, I do not have an option to uniquely identify the record. Because of this, some other record with the same name gets deleted/modified.
-Tejal
05-23-2006 6:55 AM
Hi,
so try to number your contact persons - i use the fields Kunnr and KNVK-PAFKT (01-99) as "key-fields" to identify the contact-persons for modifying and deleting with Batch Input to XD02.
Andreas
05-23-2006 6:57 AM
Hi,
Imagine there is a customer code: 103069.
If we go to XD02, then on the contact person tab, for this customer if there is only one contact person or multiple contact persons you can use the option of SCAT for deleting the person. But the thing is you must know and identfy the contact person which you are going to delete before running this SCAT.
Other than this you can go to KNVK table against the field KNVK-PARNR same contact person can be updated. So from this table you can also identify which contact person you are going to delete.
Lakshminarayanan
05-23-2006 7:18 AM
Hi Andreas,
Right now I am using the same logic. But for this positioning logic, data which I am getting in form of internal table and records displayed on the screen should be in the same order. So based on order in my internal table, I delete the record from the same position from my screen. But I am not able to find out exactly on what basis, table control screen is sorted. Normally, it is in ascending order of name1, but say, if there are multiple records with the same name, I am not able to find the second field for sorting criteria.
So if I have indicator in my internal table to delete a record and order of the same record is different on screen, some another record will get deleted.
-Tejal
Message was edited by: Tejal
05-23-2006 7:25 AM
Hi Tejal,
Say imagine in your internal table you are having the customer code, parnr(contact person no) and name1(contact person).
You can sort the internal table by:
sort itab by kunnr parnr.
so after this sort if you look into your internal table it will contain customer codes sorted in the ascending order and against it you can get the contact person no as well as name. Once this is done, it might help you to identify which sy-tabix you need to delete.
Hope this will be useful to you.
Lakshminarayanan
05-23-2006 8:13 AM
Hi Lakshminarayanan,
I tried your suggestion. But sorting based on PARNR for given KUNNR does not bring the records in the same order as that of table control on screen. i.e. records fetched from KNVK table by providing KUNNR and sorted in ascending/descending order of PARNR is different from sequence maintained on screen in XD03 transaction.
-Tejal
05-23-2006 8:33 AM
Hi Tejal,
For eg. there is a customer code 'HONEY' and against this customer code i update three contact persons
say in the order 1. TEJAL
2. LAKSHMI
3. SAP
After saving XD02, if you go to KNVK table and see, the entries are arranged as:
itab-PARNR itab-KUNNR itab-sy-tabix itab-NAME1
0000000035 HONEY 1 TEJAL
0000000036 HONEY 2 LAKSHMI
0000000037 HONEY 3 SAP
So, this same sequence is maintained in XD02, while you delete the entry sy-tabix = 2 from the internal table,
automatically the entry from XD02 with the same sequence gets deleted. You need to arrange and sort your internal table accordingly as mentioned above.
Lakshminarayanan
05-23-2006 9:30 AM
Hi Lakshminarayanan,
Thanks, I have tried this and sequence on screen is sorted first on name1 and then on PARNR.
-Tejal
02-28-2012 4:54 PM
You can try the FM "ISAI_CONTACT_DELETE" to delete the contact person of a customer.
05-16-2022 3:06 PM
Hi all, late but never too late and for all future queries regarding this issue.
Depending on your release you can use class/method cmd_ei_api=>maintain( ),
maybe this coding example helps you:
...
method delete_contact_relation using p_parnr type char10endif.
...
09-27-2023 12:30 PM
Hi all,
I tried this code, but when contact is in de sales area, the program doesn´t delete the contact because it is active in roles.
Anyone have tried delete a contact with data in the sales area? .
Thanks a lot of for your help!!
Mª del Mar.