cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_CUSTOMERCONTRACT_CHANGE not working

noahzemljic
Explorer
0 Kudos

Hello experts

I have the task to delete the partner from the head data of a contract in Sales and Distribution (SD). I have used the BAPI BAPI_CUSTOMERCONTRACT_CHANGE with the following code:

 " local declarations
DATA:
ls_contract_header_in TYPE bapisdh1,
ls_contract_header_inx TYPE bapisdh1x,
lt_return TYPE bapiret2_t.

DATA(lt_partnerchanges) = VALUE oij_bapiparnrc_t(
( document = '0012345678' updateflag = 'D' partn_role = 'ZM' ) ).
ls_contract_header_inx-updateflag = 'U'.
ls_contract_header_inx-business_partner_no = 'X'.

CALL FUNCTION 'BAPI_CUSTOMERCONTRACT_CHANGE'
EXPORTING
salesdocument = '0012345678'
contract_header_in = ls_contract_header_in
contract_header_inx = ls_contract_header_inx
* simulation =
* behave_when_error = space
* int_number_assignment = space
* logic_switch =
* no_status_buf_init = space
TABLES
return = lt_return
* contract_item_in =
* contract_item_inx =
* partners =
partnerchanges = lt_partnerchanges.
* partneraddresses =
* conditions_in =
* conditions_inx =
* contract_cfgs_ref =
* contract_cfgs_inst =
* contract_cfgs_part_of =
* contract_cfgs_value =
* contract_cfgs_blob =
* contract_cfgs_vk =
* contract_cfgs_refinst =
* contract_text =
* contract_data_in =
* contract_data_inx =
* contract_keys =
* extensionin =
* extensionex = .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
* IMPORTING
* return = lt_return.

As you can see, I am trying to delete the partner. I have two questions: Did I pass over the correct parameter values. Furthermore, I would like to know which parameters I still need to pass over. When I execute the report and look in lt_return, it says that it has an insufficient number of parameters.

Thank you
Noah

Accepted Solutions (1)

Accepted Solutions (1)

olegbash599
Active Participant

try add existing partner number into field P_NUMB_OLD

DATA(lt_partnerchanges) = VALUE oij_bapiparnrc_t(
      ( document = '0012345678' updateflag = 'D' partn_role = 'ZM' P_NUMB_OLD = 'PARTNER_IN_DOC' ) ).

Answers (1)

Answers (1)

venkateshgolla
Active Participant
0 Kudos

the commit would also sloves.

venkateshgolla
Active Participant
0 Kudos

by passing partner changes and update flag to D and role to ZM