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: 

Need to add multiple plants in contract using bapi BAPI_CONTRACT_CHANGE

former_member539645
Participant
0 Kudos

Hi Experts,

I have one requirement where i have to add multiple plants to a contract using its PURCHASINGDOCUMENT number. I am trying to use bapi BAPI_CONTRACT_CHANGE but it only adds first plant from the table IT_ITEM_COND_VALIDITY however there are 3 plants in the table.

Table data :-

Item No Serial No Plant Valid_from Valid_to

00010 0190847564 1111 20170101 20181101

00010 0190847564 1512 20170101 20181101

00010 0190847564 1113 20170101 20181101

00020 0190847565 1111 20170101 20181101

00020 0190847565 1512 20170101 20181101

00020 0190847565 1113 20170101 20181101

Note: I am trying to add two line items

Function call :-

CALL FUNCTION 'BAPI_CONTRACT_CHANGE'

EXPORTING

PURCHASINGDOCUMENT = PO_NUMBER

TABLES

ITEM_COND_VALIDITY = IT_ITEM_COND_VALIDITY

ITEM_COND_VALIDITYX = IT_ITEM_COND_VALIDITYX

ITEM_CONDITION = IT_ITEM_CONDITION

ITEM_CONDITIONX = IT_ITEM_CONDITIONX

RETURN = IT_RETURN .

this adds only first plant that is 1113 after execution the plant codes in table changes to 1113

Please suggest.

3 REPLIES 3

mmcisme1
Active Contributor

I don't have the system to completely help you out. Are there any other fields in IT_ITEM_COND_VALIDITY? I look at your data, and think that if you gave that to me and told me to process them one at a time - I'd update each one over and over again. They have the exact same data except for plant. Is there another key in the IT_ITEM_COND_VALIDITY that is missing? It might even be a sequential key - just something to make each line different.

Anyway - this is a comment and not an answer, because these are just some thoughts - not really an answer.

Michelle

mmcisme1
Active Contributor
0 Kudos

Another thought - isn't the line item associated with only one plant?

former_member539645
Participant
0 Kudos

Thanks Michelle,

I took the serial number unique and now the program is working fine.

Once again thank you........