Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error while creating vendor contact person using vmd_ei_api

JeetOP
Participant
0 Likes
2,513

Hi,

while craeting vendor contact person using maintain_bapi of vmd_ei_api class iam getting error like 'Specify address number or address handle'.

code :

 

CALL FUNCTION 'BAPI_PARTNEREMPLOYEE_GETINTNUM'
EXPORTING
quantity =
1
IMPORTING
* RETURN =
contactid = lv_contactid
* QUANTITY =
* TABLES
* CONTACT =
.



*
ls_contacts1-
task = 'I'.
ls_contacts1-data_key-parnr = lv_contactid.
"ls_knvk-parnr.
ls_contacts1-
data-abtnr = '0002'."ls_knvk-abtnr.
ls_contacts1-
data-pafkt = '02'."ls_knvk-pafkt.
ls_contacts1-
data-parau = 'BNotes'."ls_knvk-parau.
ls_contacts1-datax-abtnr =
'X'.
ls_contacts1-datax-pafkt =
'X'.
ls_contacts1-datax-parau =
'X'.


* Inserting Phone ,Fax and email.
ls_phone-contact-
task = 'I'. "Phone
ls_phone-contact-
data-telephone = '89655696569'.
ls_phone-contact-
data-extension = '778548'.
ls_phone-contact-datax-telephone =
'X'.
ls_phone-contact-datax-extension =
'X'.
APPEND ls_phone TO lt_phone.
ls_phone-contact-
task = 'I'.
ls_phone-contact-
data-r_3_user = 'X'.
ls_phone-contact-
data-telephone = '89845589369'.
ls_phone-contact-
data-extension = '858588'.
ls_phone-contact-datax-updateflag =
'X'.
ls_phone-contact-datax-telephone =
'X'.
ls_phone-contact-datax-extension =
'X'.
ls_phone-contact-datax-r_3_user =
'X'.
APPEND ls_phone TO lt_phone.

ls_fax-contact-
task = 'I'.
ls_fax-contact-
data-fax = '8896589'.
ls_fax-contact-
data-extension ='44521'.
ls_fax-contact-datax-fax =
'X'.
ls_fax-contact-datax-extension =
'X'.
APPEND ls_fax TO lt_fax.

ls_contacts1-address_type_3-
communication-phone-current_state = ' '.
ls_contacts1-address_type_3-
communication-phone-phone = lt_phone.
ls_contacts1-address_type_3-
communication-fax-current_state = ' '.
ls_contacts1-address_type_3-
communication-fax-fax = lt_fax.
ls_contacts1-address_type_3-
communication-fax-current_state = ' '.
ls_contacts1-address_type_3-
communication-fax-fax = lt_fax.
ls_contacts1-address_type_3-
task = 'I'.
ls_contacts1-address_type_3-POSTAL-
data-FIRSTNAME = 'Roger'.
ls_contacts1-address_type_3-postal-
data-lastname = 'Fedrer'.
ls_contacts1-address_type_3-POSTAL-datax-FIRSTNAME =
'X'.
ls_contacts1-address_type_3-postal-datax-lastname =
'X'.
APPEND ls_contacts1 TO lt_contacts1.

ls_vendor1-
header-object_instance = p_lifnr.
ls_vendor1-
header-object_task = 'M'.
ls_vendor1-central_data-contact-contacts = lt_contacts1.
ls_vendor1-central_data-contact-current_state =
'X'.
ls_vendor1-central_data-central-
data-adrnr = ls_adrnr.
ls_vendor1-central_data-central-datax-adrnr =
'X' .
APPEND ls_vendor1 TO lt_vendor1.

gs_vmds_extern-vendors = lt_vendor1.

DATA:gs_succ_messages TYPE cvis_message,
gs_vmds_error
TYPE vmds_ei_main,
gs_err_messages
TYPE cvis_message,
gs_vmds_succ
TYPE vmds_ei_main.
* Call the Method for creation of Vendor.
CALL METHOD vmd_ei_api=>maintain_bapi
EXPORTING
is_master_data = gs_vmds_extern
IMPORTING
es_master_data_correct = gs_vmds_succ
es_message_correct = gs_succ_messages
es_master_data_defective = gs_vmds_error
es_message_defective = gs_err_messages.

if sy-subrc  = 0.

commit work.

Please suggest which fields else i have to pass??

Hi,

while craeting vendor contact person using maintain_bapi of vmd_ei_api class iam getting error like 'Specify address number or address handle'.

code :

 

CALL FUNCTION 'BAPI_PARTNEREMPLOYEE_GETINTNUM'
EXPORTING
quantity =
1
IMPORTING
* RETURN =
contactid = lv_contactid
* QUANTITY =
* TABLES
* CONTACT =
.



*
ls_contacts1-
task = 'I'.
ls_contacts1-data_key-parnr = lv_contactid.
"ls_knvk-parnr.
ls_contacts1-
data-abtnr = '0002'."ls_knvk-abtnr.
ls_contacts1-
data-pafkt = '02'."ls_knvk-pafkt.
ls_contacts1-
data-parau = 'BNotes'."ls_knvk-parau.
ls_contacts1-datax-abtnr =
'X'.
ls_contacts1-datax-pafkt =
'X'.
ls_contacts1-datax-parau =
'X'.


* Inserting Phone ,Fax and email.
ls_phone-contact-
task = 'I'. "Phone
ls_phone-contact-
data-telephone = '89655696569'.
ls_phone-contact-
data-extension = '778548'.
ls_phone-contact-datax-telephone =
'X'.
ls_phone-contact-datax-extension =
'X'.
APPEND ls_phone TO lt_phone.
ls_phone-contact-
task = 'I'.
ls_phone-contact-
data-r_3_user = 'X'.
ls_phone-contact-
data-telephone = '89845589369'.
ls_phone-contact-
data-extension = '858588'.
ls_phone-contact-datax-updateflag =
'X'.
ls_phone-contact-datax-telephone =
'X'.
ls_phone-contact-datax-extension =
'X'.
ls_phone-contact-datax-r_3_user =
'X'.
APPEND ls_phone TO lt_phone.

ls_fax-contact-
task = 'I'.
ls_fax-contact-
data-fax = '8896589'.
ls_fax-contact-
data-extension ='44521'.
ls_fax-contact-datax-fax =
'X'.
ls_fax-contact-datax-extension =
'X'.
APPEND ls_fax TO lt_fax.

ls_contacts1-address_type_3-
communication-phone-current_state = ' '.
ls_contacts1-address_type_3-
communication-phone-phone = lt_phone.
ls_contacts1-address_type_3-
communication-fax-current_state = ' '.
ls_contacts1-address_type_3-
communication-fax-fax = lt_fax.
ls_contacts1-address_type_3-
communication-fax-current_state = ' '.
ls_contacts1-address_type_3-
communication-fax-fax = lt_fax.
ls_contacts1-address_type_3-
task = 'I'.
ls_contacts1-address_type_3-POSTAL-
data-FIRSTNAME = 'Roger'.
ls_contacts1-address_type_3-postal-
data-lastname = 'Fedrer'.
ls_contacts1-address_type_3-POSTAL-datax-FIRSTNAME =
'X'.
ls_contacts1-address_type_3-postal-datax-lastname =
'X'.
APPEND ls_contacts1 TO lt_contacts1.

ls_vendor1-
header-object_instance = p_lifnr.
ls_vendor1-
header-object_task = 'M'.
ls_vendor1-central_data-contact-contacts = lt_contacts1.
ls_vendor1-central_data-contact-current_state =
'X'.
ls_vendor1-central_data-central-
data-adrnr = ls_adrnr.
ls_vendor1-central_data-central-datax-adrnr =
'X' .
APPEND ls_vendor1 TO lt_vendor1.

gs_vmds_extern-vendors = lt_vendor1.

DATA:gs_succ_messages TYPE cvis_message,
gs_vmds_error
TYPE vmds_ei_main,
gs_err_messages
TYPE cvis_message,
gs_vmds_succ
TYPE vmds_ei_main.
* Call the Method for creation of Vendor.
CALL METHOD vmd_ei_api=>maintain_bapi
EXPORTING
is_master_data = gs_vmds_extern
IMPORTING
es_master_data_correct = gs_vmds_succ
es_message_correct = gs_succ_messages
es_master_data_defective = gs_vmds_error
es_message_defective = gs_err_messages.

if sy-subrc  = 0.

commit work.

Please suggest which fields else i have to pass??

7 REPLIES 7
Read only

former_member187748
Active Contributor
0 Likes
1,790

Hi Abhijeet,

please check is there values in ls_adrnr or not as shown in bold here.

ls_vendor1-central_data-central-data-adrnr = ls_adrnr.
ls_vendor1-central_data-central-datax-adrnr =
'X' .

if every data is passed correctly, then please use this instead of commit work

BAPI_TRANSACTION_COMMIT

Read only

0 Likes
1,790

Hi sanjeev,

Thanks for suggestion but ls_adrnr has value and even its populating into ls_vendor1.

iam using bapi_transaction_commit also. but still getting same error.

Read only

0 Likes
1,790

Hi Abhijeet,

here i am showing you some scn help to use maintain bapi of vmd_ei_api class, i think you are missing some data to be uploaded along with there are methods in lsmw, bdc too for this, please go through below links carefully , i hope you will able to solve your problem.

Vendor Master Upload Program - ABAP Development - SCN Wiki

Read only

0 Likes
1,790


Hi sanjeev,

i went through the link, i am getting same error while using maintain_bapi to create vendor extension for company code.Kindly suggest some sample code.

i tried with passing organisational address into contact person structure of vms_ei_api (vendor structure) still no improvement.

Please suggest missing field if any.

Or else will bdc approach be a good idea?

Read only

0 Likes
1,790

Abhijeet,

through BDC you can achieve it, search into google or in this forum to create vendor contact i.e. "bdc to create vendor contact person"

I hope you will get many links, please see these links which might help you

Vendor Master Upload Program - ABAP Development - SCN Wiki

BDC for XK01 (Create Vendor) - ABAP Development - SCN Wiki

Read only

JeetOP
Participant
0 Likes
1,790


Hi sanjeev,

i went through the link, i am getting same error while using maintain_bapi to create vendor extension for company code.Kindly suggest some sample code.

i tried with passing organisational address into contact person structure of vms_ei_api (vendor structure) still no improvement.

Please suggest missing field if any.

Or else will bdc approach be a good idea?

Read only

JeetOP
Participant
0 Likes
1,790

Which FM or bapi can i use to update/create vendor contact person details?

Im able to update vendor address detail using bapi_addressorg_change. but its not apply for contact person...

Please suggest.!