Application Development 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: 

Updating contract conditions using BAPI_CUSTOMERCONTRACT_CHANGE

Former Member
0 Kudos
1,404

Hi,

I am trying to update the conditions of a contract line item using the bapi BAPI_CUSTOMERCONTRACT_CHANGE. However, the BAPI is inserting a new line into the conditions for same condition type instead of changing the value.

Could you please help me with the parameters i need to pass into the BAPI to update condition values?

Currently i am passing the following

BAPICOND-ITM_NUMBER = '000010'.

BAPICOND-COND_ST_NO = '010'.

BAPICOND-COND_COUNT = '01'.

BAPICOND-COND_TYPE = 'YGAF'.

BAPICOND-cond_updat = 'X'.

BAPICOND-COND_VALUE = '15'.

BAPICONDX-ITM_NUMBER = '000010'.

BAPICONDx-updateflag = 'U'.

BAPICONDX-COND_ST_NO = '010'.

BAPICONDX-COND_COUNT = '01'.

BAPICONDX-COND_TYPE = 'YGAF'.

Thank you so much in advance.

Ravi

1 ACCEPTED SOLUTION

Former Member
0 Kudos
652

Hi,

REPORT y_OTC_bapi .


data: header_in like BAPISDH1 occurs 0 with header line.
data: header_inx like BAPISDH1X occurs 0 with header line.
data: return like BAPIRET2 occurs 0 with header line.
data: item_in like BAPISDITM occurs 0 with header line.
data: item_inx like BAPISDITMX occurs 0 with header line.
data: var like BAPIVBELN-VBELN value '0040000366'.


header_in-SALES_ORG = '0060'.
header_in-DISTR_CHAN = '10'.
header_in-DIVISION = '10'.
header_in-DATE_TYPE = '10242001'.
header_in-CT_VALID_F = '10242000'.
header_in-CT_VALID_T = '10312003'.
header_in-PURCH_NO_S = '054Z03M01'.
header_in-PO_DAT_S = '10312003'.

header_inx-updateflag = 'U'.
*header_inx-SALES_ORG = ''.
*header_inx-DISTR_CHAN = 'X'.
*header_inx-DIVISION = 'X'.
*header_inx-DATE_TYPE = 'X'.
*header_inx-CT_VALID_F = 'X'.
*header_inx-CT_VALID_T = 'X'.
*header_inx-PURCH_NO_S = 'X'.
*header_inx-PO_DAT_S = 'X'.

item_in-ITM_NUMBER = '000010'.
item_in-MATERIAL = '000000000022626260'.
item_in-PLANT = 'RL01'.
item_in-TARGET_QTY = '600'.
item_in-TARGET_QU = 'PC'.
*MATL_GROUP =
append item_in.

item_inx-updateflag = 'U'.
*item_inx-ITM_NUMBER = 'X'.
*item_inx-MATERIAL = 'X'.
*item_inx-PLANT = 'X'.
*item_inx-TARGET_QTY = 'X'.
*item_inx-TARGET_QU = 'X'.
**MATL_GROUP =
*append item_inx.


CALL FUNCTION 'BAPI_CUSTOMERCONTRACT_CHANGE'
  EXPORTING
    salesdocument               = var
    contract_header_in          = header_in
    contract_header_inx         = header_inx
*   SIMULATION                  =
*   BEHAVE_WHEN_ERROR           = ' '
*   INT_NUMBER_ASSIGNMENT       = ' '
*   LOGIC_SWITCH                =
*   NO_STATUS_BUF_INIT          = ' '
  tables
    return                      = return
    CONTRACT_ITEM_IN            = item_in
    CONTRACT_ITEM_INX           = item_inx
*   PARTNERS                    =
*   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                 =
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
 IMPORTING
   RETURN        = return.

Thanks

Parvathi

2 REPLIES 2

Former Member
0 Kudos
653

Hi,

REPORT y_OTC_bapi .


data: header_in like BAPISDH1 occurs 0 with header line.
data: header_inx like BAPISDH1X occurs 0 with header line.
data: return like BAPIRET2 occurs 0 with header line.
data: item_in like BAPISDITM occurs 0 with header line.
data: item_inx like BAPISDITMX occurs 0 with header line.
data: var like BAPIVBELN-VBELN value '0040000366'.


header_in-SALES_ORG = '0060'.
header_in-DISTR_CHAN = '10'.
header_in-DIVISION = '10'.
header_in-DATE_TYPE = '10242001'.
header_in-CT_VALID_F = '10242000'.
header_in-CT_VALID_T = '10312003'.
header_in-PURCH_NO_S = '054Z03M01'.
header_in-PO_DAT_S = '10312003'.

header_inx-updateflag = 'U'.
*header_inx-SALES_ORG = ''.
*header_inx-DISTR_CHAN = 'X'.
*header_inx-DIVISION = 'X'.
*header_inx-DATE_TYPE = 'X'.
*header_inx-CT_VALID_F = 'X'.
*header_inx-CT_VALID_T = 'X'.
*header_inx-PURCH_NO_S = 'X'.
*header_inx-PO_DAT_S = 'X'.

item_in-ITM_NUMBER = '000010'.
item_in-MATERIAL = '000000000022626260'.
item_in-PLANT = 'RL01'.
item_in-TARGET_QTY = '600'.
item_in-TARGET_QU = 'PC'.
*MATL_GROUP =
append item_in.

item_inx-updateflag = 'U'.
*item_inx-ITM_NUMBER = 'X'.
*item_inx-MATERIAL = 'X'.
*item_inx-PLANT = 'X'.
*item_inx-TARGET_QTY = 'X'.
*item_inx-TARGET_QU = 'X'.
**MATL_GROUP =
*append item_inx.


CALL FUNCTION 'BAPI_CUSTOMERCONTRACT_CHANGE'
  EXPORTING
    salesdocument               = var
    contract_header_in          = header_in
    contract_header_inx         = header_inx
*   SIMULATION                  =
*   BEHAVE_WHEN_ERROR           = ' '
*   INT_NUMBER_ASSIGNMENT       = ' '
*   LOGIC_SWITCH                =
*   NO_STATUS_BUF_INIT          = ' '
  tables
    return                      = return
    CONTRACT_ITEM_IN            = item_in
    CONTRACT_ITEM_INX           = item_inx
*   PARTNERS                    =
*   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                 =
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
*   WAIT          =
 IMPORTING
   RETURN        = return.

Thanks

Parvathi

0 Kudos
602

👎 (-1)

I don't understand why this answer is marked as an "accepted solution" because it doesn't say anything about the contract conditions (the question).