Application Development and Automation 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: 
Read only

Error using BAPI_SALESORDER_CHANGE

Former Member
0 Likes
1,633

Hi All,

I am using BAPI_SALESORDER_CHANGE in my Z program and it is throwing an error 'Enter Document Number' but I am passing document number as Input.

E   |V1                  |045   |Enter the document number

I have debugged and found out that VBAK-VBELN is getting cleared in the below code:

SALES_DOCUMENT_READ in lines 60 and 61:

60 VBAK-VBELN = DOCUMENT_NUMBER

61 PERFORM BELEG_LESEN(SAPMV45A)

Error will come from below part:

if vbak-vbeln is initial.

message e045.

endif.

Kindly help me in solving the above issue.

Thanks,

Waseem

1 REPLY 1
Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
884

Hi Waseem,

As mentioned in below SNOTE, call FM SD_SALES_DOCUMENT_INIT before BAPI_SALESORDER_CHANGE.

CALL FUNCTION 'SD_SALES_DOCUMENT_INIT'
            EXPORTING
                 SIMULATION_MODE_BAPI        = 'X'.

Please go through below SNOTE to fix the issue.

  1871065 - BAPI processing is cancelling with error V1045