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

issue with BAPI: BAPI_ADDRESSCONTPART_CHANGE

MartinMaruskin
Active Contributor
0 Likes
2,559

Hi,

I'm trying to utilize BAPI BAPI_ADDRESSCONTPART_CHANGE to change first and last name of Contact Person associated with Customer. See below my ABAP code. Strange thing is that the BAPI call doesn't do any change. I do not see change to first and last name of Contact Person neither in XD03 or VAP3 t-codes.

DATA: lt_return      LIKE bapiret2 OCCURS 10  WITH HEADER LINE,

           lt_bapiad3vl   TYPE TABLE OF bapiad3vl  WITH HEADER LINE,

           lt_bapiad3vl_x TYPE TABLE OF bapiad3vlx WITH HEADER LINE,

          address_number LIKE adrc-addrnumber,

          person_number  LIKE adrp-persnumber.

PARAMETERS: p_first TYPE name1_gp DEFAULT 'firstname1',

                         p_last  TYPE name1_gp DEFAULT 'lastname1'.

lt_bapiad3vl-firstname = p_first.

lt_bapiad3vl-lastname  = p_last.

APPEND lt_bapiad3vl.

MOVE: 'X' TO lt_bapiad3vl_x-firstname,

       'X' TO lt_bapiad3vl_x-lastname,

       'U' TO lt_bapiad3vl_x-updateflag.

APPEND lt_bapiad3vl_x.

CALL FUNCTION 'BAPI_ADDRESSCONTPART_CHANGE'

   EXPORTING

     obj_type_p  = 'BUS1006001' "Person object BOR object type

     obj_id_p    = '0000152955'    "Person object BOR object key = KNVK-PARNR person no

     obj_type_c  = 'KNA1'           "Company address owner BOR object type

     obj_id_c    = '0000099009'   "BOR company address owner object key = KNA1-KUNNR customer no

     context     = '0005'

   IMPORTING

     address_number = address_number

     person_number  = person_number

   TABLES

     bapiad3vl   = lt_bapiad3vl

     bapiad3vl_x = lt_bapiad3vl_x

     return      = lt_return.

I tried to use a call of BAPI_TRANSACTION_COMMIT after my BAPI call however result is the same: no change to the data. Sy-subrc is always equal to zero. Return table lt_return has no rows. So there is no indication of what can be wrong.

I guess that there is maybe issue within export parameters:

obj_id_p

obj_id_c


However I'm using them as provided in the comments of my ABAP code. Any hints of what can be wrong? Thanks in advance.

m./

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,539

Dear Martin;

I searched for your issue and found out that this bapi could be used for update data in table ADRP but not KNVK. It's better to use SD_CUSTOMER_MAINTAIN_ALL instead.

5 REPLIES 5
Read only

Former Member
0 Likes
1,539

Would you please test input data with BAPI_ADDRESSCONTPART_GETDETAIL.

Got any result?




Read only

0 Likes
1,539

If I use same input data that I'm providing to BAPI_ADDRESSCONTPART_CHANGE also to BAPI_ADDRESSCONTPART_GETDETAIL I'm getting proper data. Basically the same data that I can see in XD03.

Read only

Former Member
0 Likes
1,539

Please check when you are using BAPI whether customer or contact person is locked.

Read only

0 Likes
1,539

Neither Customer nor Contact Person are having any deletion flags set.

Read only

Former Member
0 Likes
1,540

Dear Martin;

I searched for your issue and found out that this bapi could be used for update data in table ADRP but not KNVK. It's better to use SD_CUSTOMER_MAINTAIN_ALL instead.