2011 Nov 16 10:27 PM
Hi All;
I have the method cmd_ei_api=>maintain_bapi working and creating customers. I have written a custom FM to wrap around maintain_bapi o add contact people to an existing customer. I have it partially working. I can add a contact but the KNVK-PERNR number is blank after adding the contact. This means I cannot add a 2nd contact person. If I add the contact to the customer using t-code XD02, the PERNR field is correctly filled in by SAP.
Does anyone know how to get the method to create a pernr number? I have set the customer master task to 'M'odify and the contact task to 'I'. When I set the customer master task to 'I', I correctly get an error that the customer already exists.
Any ideas?
Thanks
Stephen
Hi All;
I have the method cmd_ei_api=>maintain_bapi working and creating customers. I have written a custom FM to wrap around maintain_bapi o add contact people to an existing customer. I have it partially working. I can add a contact but the KNVK-PERNR number is blank after adding the contact. This means I cannot add a 2nd contact person. If I add the contact to the customer using t-code XD02, the PERNR field is correctly filled in by SAP.
Does anyone know how to get the method to create a pernr number? I have set the customer master task to 'M'odify and the contact task to 'I'. When I set the customer master task to 'I', I correctly get an error that the customer already exists.
Any ideas?
Thanks
Stephen
2011 Nov 18 4:11 AM
Hi, Stephen Herlick,
Did you solve your problem? I meet the same problem now. Can you share your solution. Thank you very much!
2011 Nov 18 2:35 PM
Hi;
The problem seems to be that the method does not get a new number for the PERNR field in the KNVK table. I did the following which essentially, gets a new number and assigns it to the PERNR field. Not ideal as I feel the method should be doing this for me as it does get a new seuqence number for the Customer Master Record. We really need SAP or Alain Bacchi to answer. Here is a snippet of code that I used.
Hope this helps.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = 'AP'
object = 'PARTNER'
QUANTITY = '1'
SUBOBJECT = ' '
TOYEAR = '0000'
IGNORE_BUFFER = ' '
IMPORTING
NUMBER = PARNR
QUANTITY =
RETURNCODE =
EXCEPTIONS
INTERVAL_NOT_FOUND = 1
NUMBER_RANGE_NOT_INTERN = 2
OBJECT_NOT_FOUND = 3
QUANTITY_IS_0 = 4
QUANTITY_IS_NOT_1 = 5
INTERVAL_OVERFLOW = 6
BUFFER_OVERFLOW = 7
OTHERS = 8.
IF SY-SUBRC = 0.
Add partner type 20
wa_contacts-task = gc_insert.
wa_contacts-data_key-parnr = PARNR.
wa_contacts-data-pafkt = '20'.
wa_contacts-datax-pafkt = 'X'.
wa_contacts-address_type_1 = ''.
wa_contacts-address_type_2 = ''.
wa_contact_addr-fullname = CUST-NAME.
wa_contact_addr-firstname = CONTACT-FIRSTNAME.
wa_contact_addrx-firstname = 'X'.
wa_contact_addr-lastname = CONTACT-LASTNAME.
wa_contact_addrx-lastname = 'X'.
Assign address data directly
wa_contacts-address_type_3-task = gc_insert.
wa_contacts-address_type_3-postal-data = wa_contact_addr.
wa_contacts-address_type_3-postal-datax = wa_contact_addrx.
e-mail address
wa_econtact-task = gc_insert.
wa_econtact-data-std_no = 'X'.
wa_econtact-data-e_mail = CONTACT-E_MAIL.
wa_econtact-datax-std_no = 'X'.
wa_econtact-datax-e_mail = 'X'.
wa_smtp-current_state = ' '.
wa_smtp_st-contact = wa_econtact.
append wa_smtp_st to wa_smtp-smtp.
wa_contacts-address_type_3-communication-smtp = wa_smtp.
wa_contacts-contact_texts = ''.
append wa_contacts to it_contacts.
ENDIF.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |