‎2005 Dec 28 4:04 PM
Hello all
I am working on a BAPI to receive info from an external system and either create or maintain Customer data (KNA1, KNVK) on SAP.
I am having a problem with the functionality of the BAPI
BAPI_ADDRESSCONTPART_CHANGE which I call from within my own BAPI.
The problem occurs when I attempt to insert a telephone number and a mobile number for the contact person.
I create the customer and then attempt to insert the telephone information using the tables BAPIADTEL and BAPIADTEL_X.
***landline data
IF NOT personal_data-tel1_numbr IS INITIAL.
MOVE: personal_data-tel1_numbr TO BAPIADTEL-telephone,
'X' TO bapiadtel_x-telephone,
'X' TO bapiadtel_x-std_no,
'X' TO bapiadtel_x-r_3_user,
'I' TO bapiadtel_x-updateflag,
'X' TO BAPIADTEL-std_no,
'1' TO BAPIADTEL-r_3_user.
ENDIF.
IF NOT personal_data-tel1_ext IS INITIAL.
MOVE: personal_data-tel1_ext TO BAPIADTEL-extension,
'X' TO bapiadtel_x-extension,
'I' TO bapiadtel_x-updateflag.
ENDIF.
APPEND: bapiadtelx, bapiadtel.
CLEAR: bapiadtelx, bapiadtel.
**mobile number data
MOVE: personal_data-mob_number TO bapiadtel-telephone,
'X' TO bapiadtel_x-telephone,
'X' TO bapiadtel_x-std_no,
'X' TO bapiadtel_x-r_3_user,
'I' TO bapiadtel_x-updateflag,
space TO bapiadtel-std_no,
'3' TO bapiadtel-r_3_user.
APPEND: bapiadtelx, bapiadtel.
CLEAR: bapiadtelx, bapiadtel.
***call Change BAPI
DATA: gobj_type_p LIKE bapi4003_1-objtype_p,
gobj_id_p LIKE bapi4003_1-objkey_p,
gobj_type_c LIKE bapi4003_1-objtype_c,
gobj_id_c LIKE bapi4003_1-objkey_c,
gobj_id_ext LIKE bapi4003_1-extension,
gcontext LIKE bapi4003_1-context,
MOVE: 'BUS1006001' TO gobj_type_p,
knvk-parnr TO gobj_id_p,
'KNA1' TO gobj_type_c,
kunnr TO gobj_id_c,
'0005' TO gcontext.
CALL FUNCTION 'BAPI_ADDRESSCONTPART_CHANGE'
EXPORTING
obj_type_p = gobj_type_p
obj_id_p = gobj_id_p
obj_type_c = gobj_type_c
obj_id_c = gobj_id_c
context = gcontext
TABLES
bapiadtel = bapiadtel
bapiadtel_x = bapiadtelx
return = gt_return.
Prior to calling this code, the customer and contact person have already been created.
When I use this code, the above BAPI creates the mobile number twice in the contact person data, and inserts the landline number in the company contact details. I have tried various combination (example creating the
landline number first and then creating the mobile number) but nothing seems to work.
Has anyone had this problem and if so, can you tell me the solution please!!
Thanks and best regards
Kevin
‎2005 Dec 28 4:09 PM
Use the FM BAPI_ADDRESSORG_SAVEREPLICA' .This basically overites the address for vendor/customer/plant .
CALL FUNCTION 'BAPI_ADDRESSORG_SAVEREPLICA'
EXPORTING
obj_type = la_objet
obj_id = la_id
context = la_context
iv_check_address = ''
IMPORTING
return = wa_return
address_number = w_adrnum
TABLES
bapiad1vl = it_ad1vl
bapiadtel = it_adtel
bapiadfax = it_adfax
bapiadtlx = it_adtlx
bapiadsmtp = it_adsmtp
bapiad_rem = it_ad_rem
bapicomrem = it_comrem.
Let me know if you have questions .