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

BAPI_CONTRACT_CHANGE performance Issue

mdejesus
Participant
2,697

Hi Experts,

Good day!

We are experiencing performance issue when using BAPI_CONTRACT_CHANGE to add new items in an existing contract (ME32K).

It approximately takes 30 seconds to add 1 record. Below are the structure of the BAPI that we are using.

CALL FUNCTION 'BAPI_CONTRACT_CHANGE'
EXPORTING
PURCHASINGDOCUMENT = contract_number
TABLES
ITEM = lt_items
ITEMX = lt_itemsx
ITEM_COND_VALIDITY = lt_cond_validit
ITEM_COND_VALIDITYX = lt_cond_validityx
ITEM_CONDITION = lt_cond
ITEM_CONDITIONX = lt_condx
RETURN = lt_return.

I'm populating below fields under item table while all required fields for the other table

1. Vendor material number, material number, price date, target quantity = constant 99999, po unit, net price and material long

Tried to read below blog but the SAP note for the BAPI performance issue is for support pack 601602 and 603, while we have higher support pack already.

https://blogs.sap.com/2015/05/11/performance-issue-during-purchasing-document-and-goods-movement-wit...

We also did below changes to see if performance issue can be resolve

1. Instead of calling the BAPI per contract item, we have populated the ITEM table with all the contract item and call BAPI once to create all the items. But this approach will stop creation of other contract item if one encounters an error.

Please let us know if you encounter the same and have fix it.

Many thanks!

Best regards,

Marc.

1 ACCEPTED SOLUTION
Read only

mdejesus
Participant
1,986

Hi All,

Thanks for all your replies. We actually solved this issue by calling the BAPI per 3000 items (or depends on the parameter but not exceeding 9000) instead of calling it per item.

The bad side for this is that if one item fails, then the rest will not be posted. We just need to make sure that all items are free of error before calling the BAPI.

Thank you!

Many thanks!

Marc.

5 REPLIES 5
Read only

ThangaPrakash
Active Contributor
1,986

Marc A De Jesus Did you get chance to take ST12 trace and check which call is taking more runtime?

Read only

ThangaPrakash
Active Contributor
0 Likes
1,986

@Marc A De Jesus I remember we also had similar issue and then after debugging we found that it is because of some TEXT reading, please refer to below SAP notes which is

2277232 - BAPI: Text fetched in BAPI_SAG_GETDETAIL and BAPI_CONTRACT_GETDETAIL when unneeded valid from 605 to 618

2286454 - BAPI: Text reading slows processing of Outline Agreements valid from 600 to 618

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
1,986

We can use ANST transaction to identify relevant SAP Notes. Other that that, I'd recommend reaching out to SAP Support with this. If there is a correction but you're unable to find it it is an issue and perhaps the SAP Note needs to be updated. SAP Support can do this if someone opens an incident.

Read only

mdejesus
Participant
1,987

Hi All,

Thanks for all your replies. We actually solved this issue by calling the BAPI per 3000 items (or depends on the parameter but not exceeding 9000) instead of calling it per item.

The bad side for this is that if one item fails, then the rest will not be posted. We just need to make sure that all items are free of error before calling the BAPI.

Thank you!

Many thanks!

Marc.

Read only

0 Likes
1,986

Hi Marc

I know its very old post, but do you mind sharing the code for creating the new line items using BAPI_CONTRACT_CHANGE?

Thanks
Surya