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: 

BAPI_SALESORDER_CHANGE: Error-Item not found

Former Member
0 Kudos

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.

5 REPLIES 5

former_member195402
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos

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

0 Kudos

But Im not creating any sales order here.Just updating it.

0 Kudos

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