04-05-2011 5:38 AM
Hi,
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.
04-05-2011 6:27 AM
Hi,
I think, your fm call is to early and the sd document still isn't available in database tables vbak and vbap.
Regards,
Klaus
04-05-2011 6:45 AM
Im only using the BAPI which triggers this FM internally.
But still the VBAP values are available in the subroutine but gets cleared after that.
04-05-2011 7:28 AM
Yes,
but in sales order creation you are going thru a different code:
* Anlegen <= Here from sales order creation
IF SVBAP-TABIX = 0.
CLEAR: MAEPV,
MAAPV,
MTCOM,
XVBUP,
XVBAPF,
KONDD,
XVBAP.
*VBAP = XVBAP. " Getuntes clear
HVBAP = XVBAP. " Getuntes clear
*HVBAP = XVBAP. " Getuntes clear
VBAP = XVBAP. " Getuntes clear
*MTCOM = MTCOM. " Getuntes clear
MOVE-CORRESPONDING XVBAP TO VBAPD. " Getuntes clear
*VBAPD = VBAPD. " Getuntes clear
CLEAR: HVBKD, *HVBKD.
* Steuerflag für Textverarbeitung initialisieren
CLEAR NO_TEXT_COPY-ITEM.
clear no_text_copy-check.
ELSE.
* Ändern <= Here from SE37
VBAP = XVBAP.
It's a completely different behaviour!
Regards,
Klaus
04-06-2011 5:04 AM
But Im not creating any sales order here.Just updating it.
04-06-2011 2:14 PM
Hi,
create one custom funcitonal module and place your logic there by passing the required parameter in input to it.
and note that this funciton module must be called using the IN UPDATE TASK addition at the time of calling.
This will work for you.
Regards
Jagesh