I am calling BAPI_SLESORDER_CHANGE from an enhancement in the include MV45AF0B_BELEG_SICHERN. This will be called after the commit work of sales order. Im using this BAPI for the purpose of changing/updating the Inquiry line item from which the SO is created.
When I execute the BAPI in SE37 by passing the Inquiry no. & item to be updated, it is not giving any error. In my enhancement, I am passing the same values but getting the error: ITEM NOT FOUND.
When I debugged the BAPI, the error is raised in the Fm SD_SALES_ITEM_READ.
In the below code in FM, VBAP is getting filled inside the PERFORM VBAP_BEARBEITEN_VORBEREITEN but when it comes out of this subroutine, the VBAP is initial.
But when executing with SE37, this VBAP value is not getting cleared after the subroutine.
PERFORM XVBAP_LESEN_DIREKT_SVBAP(SAPFV45P) USING ITEM_NUMBER. PERFORM VBAP_BEARBEITEN_VORBEREITEN(SAPFV45P). EVBAP = VBAP.
Please help me out to resolve this issue.