‎2019 Nov 22 9:43 AM
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.
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.
‎2020 Oct 14 1:56 PM
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.
‎2019 Nov 22 10:49 AM
Marc A De Jesus Did you get chance to take ST12 trace and check which call is taking more runtime?
‎2019 Nov 22 12:00 PM
@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
‎2019 Nov 22 10:16 PM
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.
‎2020 Oct 14 1:56 PM
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.
‎2021 Nov 23 11:28 AM
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