Skip to Content
0
Mar 26, 2010 at 01:36 PM

Problem with BAPI_SALESORDER_CHANGE

362 Views

Hi Experts,

I am facing a problem with the BAPI_SALESORDER_CHANGE. I am using it in a user exit to update sales order upon creation of delivery and I am getting the error message' Enter a document number'. The problem is that I have passed the document number to the BAPI. When I use the BAPI in SE37 with the same parameters, there is no error message.

I have debugged to check where the eroor message is coming from. It is from the subroutine BELEG_LESEN of the program MV45AF0B_BELEG_LESEN (line 36):

if vbak-vbeln is initial.

message e045.

endif.

This routine is called in the FM SD_SALES_DOCUMENT_READ (line 61) just after the statement VBAK-VBELN = DOCUMENT_NUMBER.

I have also debugged both calls and found a difference as follows:

1. In SE37, when the statement VBAK-VBELN = DOCUMENT_NUMBER is executed, both (SAPLV45A)VBAK-VBELN and (SAPMV45A)VBAK-VBELN are assigned the order number.

2. When i debug the call in the user exit, only the (SAPLV45A)VBAK-VBELN is assigned the order number and (SAPMV45A)VBAK-VBELN remains initial and that is why i am getting the error message.

Can anybody please tell me why the (SAPMV45A)VBAK-VBELN is not assigned the order number same as when I test in SE37?

Is there any solution for this problem?

Thanks,

Vitz.