Skip to Content
0
Sep 09, 2020 at 06:22 AM

BAPI_CONDITION_CONTRACT_CREATE Not able to create for multiple condition type

399 Views

we are trying to create a condition contract using 'BAPI_CONDITION_CONTRACT_CREATE' .We were able to create condition contract with one condition type COND_TYPE = 'RES1' ,but we are not able to create for multiple condition type (COND_TYPE = 'REA1').

While passing the second condition type as same as the first one with order key as same and count as '02' with COND_TYPE = 'REA1' .We are getting return error from BAPI.

CLEAR: HEADDATAIN.
HEADDATAIN-CONTRACT_TYPE = 'ZBBI'.
HEADDATAIN-CUSTOMER_OWNER = '0001200001'.
HEADDATAIN-SALESORG = '1110'.
HEADDATAIN-DISTR_CHAN = '90'.
HEADDATAIN-DIVISION = '00'.
HEADDATAIN-VALIDITY_DATE_FROM = '20191101'.
HEADDATAIN-VALIDITY_DATE_TO = '20191231'.

CLEAR: HEADDATAINX.
HEADDATAINX-CONTRACT_TYPE = 'X'.
HEADDATAINX-CUSTOMER_OWNER = 'X'.
HEADDATAINX-SALESORG = 'X'.
HEADDATAINX-DISTR_CHAN = 'X'.
HEADDATAINX-DIVISION = 'X'.
HEADDATAINX-VALIDITY_DATE_FROM = 'X'.
HEADDATAINX-VALIDITY_DATE_TO = 'X'.


CLEAR: IT_CONDITIONKEYDATAIN.
CLEAR: IT_CONDITIONKEYDATAINX.
CLEAR: IT_CONDITIONITEMDATAIN.
CLEAR: IT_CONDITIONITEMDATAINX.
CLEAR: L_ID.

ADD 1 TO L_ID.
CLEAR: WA_CONDITIONKEYDATAIN.
WA_CONDITIONKEYDATAIN-ORDER_KEY = L_ID.
*WA_CONDITIONKEYDATAIN-TABLE_NO = '163'.
WA_CONDITIONKEYDATAIN-TABLE_NO = '4AB'.
WA_CONDITIONKEYDATAIN-COND_TYPE = 'RES1'.
WA_CONDITIONKEYDATAIN-VALID_FROM = '20191101'.
WA_CONDITIONKEYDATAIN-VALID_TO = '20191231'.
*WA_CONDITIONKEYDATAIN-MATERIAL = 'EP4933-01-302'.
WA_CONDITIONKEYDATAIN-APPLICATIO = 'V'.
APPEND WA_CONDITIONKEYDATAIN TO IT_CONDITIONKEYDATAIN.

CLEAR: WA_CONDITIONKEYDATAINX.
WA_CONDITIONKEYDATAINX-ORDER_KEY = L_ID.
*WA_CONDITIONKEYDATAINX-MATERIAL = 'X'.
APPEND WA_CONDITIONKEYDATAINX TO IT_CONDITIONKEYDATAINX.

CLEAR: WA_CONDITIONITEMDATAIN.
WA_CONDITIONITEMDATAIN-ORDER_KEY = L_ID.
WA_CONDITIONITEMDATAIN-COND_COUNT = '01'.
WA_CONDITIONITEMDATAIN-CALC_TYPE = 'A'.
WA_CONDITIONITEMDATAIN-AMOUNT = 3.
WA_CONDITIONITEMDATAIN-CONDCURR = '%'.
APPEND WA_CONDITIONITEMDATAIN TO IT_CONDITIONITEMDATAIN.

CLEAR: WA_CONDITIONITEMDATAINX.
WA_CONDITIONITEMDATAINX-ORDER_KEY = L_ID.
WA_CONDITIONITEMDATAINX-COND_COUNT = '01'.
WA_CONDITIONITEMDATAINX-CALC_TYPE = 'X'.
WA_CONDITIONITEMDATAINX-AMOUNT = 'X'.
WA_CONDITIONITEMDATAINX-CONDCURR = 'X'.
APPEND WA_CONDITIONITEMDATAINX TO IT_CONDITIONITEMDATAINX.


CALL FUNCTION 'BAPI_CONDITION_CONTRACT_CREATE'
EXPORTING
HEADDATAIN = HEADDATAIN
HEADDATAINX = HEADDATAINX
* WITHDEFAULT =
* MIGRATIONTESTRUN =
IMPORTING
HEADDATAOUT = HEADDATAOUT
CONDITIONCONTRACTNUMBER = CONDITIONCONTRACTNUMBER
TABLES
* ITEMDATAIN =
* ITEMDATAINX =
CONDITIONKEYDATAIN = IT_CONDITIONKEYDATAIN
CONDITIONKEYDATAINX = IT_CONDITIONKEYDATAINX
CONDITIONITEMDATAIN = IT_CONDITIONITEMDATAIN
CONDITIONITEMDATAINX = IT_CONDITIONITEMDATAINX
* ITEMDATAOUT =
* CONDITIONKEYDATAOUT =
* CONDITIONITEMDATAOUT =
* EXTENSIONIN =
* EXTENSIONOUT =
* HEADTEXTIN =
* HEADTEXTOUT =
* ITEMTEXTIN =
* ITEMTEXTOUT =
RETURN = IT_RETURN
* SCALEDATAIN =
* SCALEDATAOUT =
* BVBDATAIN =
* BVBDATAINX =
* BVBDATAOUT =
* CALENDARDATAIN =
* CALENDARDATAINX =
* CALENDARDATAOUT =
.