cancel
Showing results for 
Search instead for 
Did you mean: 

"Enter the document number" in BAPI_SALESORDER_CHANGE.

Former Member
0 Kudos

Hi,

I've got the following error:

Call of BAPI_SALESORDER_CHANGE gives us an error V1 045 "Enter the document number". We are sure the call is proper (document number is send). The errors occurs in function module SD_SALES_DOCUMENT_READ in lines 60 and 61:

60 VBAK-VBELN = DOCUMENT_NUMBER.

61 PERFORM BELEG_LESEN(SAPMV45A).

In line 60 field VBAK-VBELN is set but in form BELEG_LESEN(SAPMV45) is initial. The value of field is checked in MV45AF0B_BELEG_LESEN line 53.

53 if vbak-vbeln is initial.

54 message e045.

55 endif.

The error occurs only when we have mass changing of sales order and posting deliveries in reference to sales order. Single operation doesn't make any problem.

Our system:

SAP_APPL 470 with SAPKH47026

SAP_BASIS 620 with SAPKB62059

Anyone met it before? I'm quite confused.

Best regards:

Lukasz Tylutki

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Firstly Wishing you a very Happy and Prosperous New Year

I got the same error in same function module and same line.

"Call of BAPI_SALESORDER_CHANGE gives us an error V1 045 "Enter the document number". We are sure the call is proper (document number is send). The errors occurs in function module SD_SALES_DOCUMENT_READ in lines 60 and 61:

60 VBAK-VBELN = DOCUMENT_NUMBER.

61 PERFORM BELEG_LESEN(SAPMV45A).

In line 60 field VBAK-VBELN is set but in form BELEG_LESEN(SAPMV45) is initial. The value of field is checked in MV45AF0B_BELEG_LESEN line 53.

53 if vbak-vbeln is initial.

54 message e045.

55 endif."

Kindly help me on to solve this issues.

Thanks a lot for ur help in advance....

Naidu

0 Kudos

Hi Lukasz,

If I understand correctly the problem occurs with multiple calls of the BAPI within the same program call. As a general rule of thumb, this could be due to parts of the program not properly initialized. Don't try to correct the BAPI - it's hopeless.

I suggest you make use of the suggestion in note 760068 to start a new task.

This can be achieved as follows:

Call function 'XXXXXX' starting new task 'BLABLA'

performing yyyyy on end of task

...rest of function interface (only export and tables)...

wait until semaphore = 'X'.

...

form yyyyy

receive results from function 'XXXXXX'

importing...

tables...

exceptions....

semaphore = 'X'.

endform.

This way all data are initalized in a different LUW, thus not influencing the next function executions. An alternative would be to submit programs for each function call, passing the interface through export-import parameters, but it doesn't look as nice.

Best regards,

Stratis

Former Member
0 Kudos

Hi, Stratis

I've already started this solution. Thanks a lot for confirmation of method choosen

Best regards:

Lukasz Tylutki

Former Member
0 Kudos

I've received other solution proposed by SAP. See details below.

Development has provided some sample coding on how to refresh the data.

However, please note that this only a suggestion and you will need to

test thoroughly before implementing it. The Note too clearly mentions

that each problems needs to be analysed separately. Please keep in mind

Note 170183 before proceeding.

Sample code:

******************************************************************

FIELD-SYMBOLS <TMCB> TYPE TMCB.

ASSIGN ('(SAPLMCS1)TMCB') TO <TMCB>.

IF SY-SUBRC = 0.

CLEAR <TMBC>.

UNASSIGN <TMBC>.

ENDIF.

******************************************************************

You have two options to place this code:

1. After each BAPI call (after commit work) like below

BAPI_SALESOREDER_CHANGE

BAPI_TRANSACTION_COMMIT

<< Insert your coding(Clear TMBC)

BAPI_INCOMINGINVOICE_CREATE

BAPI_TRANSACTION_COMMIT

<< Insert your coding(Clear TMBC)

OR

2. Into the USEREXIT_REFRESH_DOCUMENT (MV45AFZA) as a single point.

Then it will automatically run in both BAPIs.

0 Kudos

Hi Lukasz,

I hope you understand this relates to the exact symptom of not updating statistics as described in that note, rather than the one you mention. Please try it, but I'm afraid you will be disappointed by what it will do.

Sorry,

Stratis

rmazzali
Active Contributor
0 Kudos

Fill the document number with the leading zeroes.

pls. reward if helpful

regards

Roberto

Former Member
0 Kudos

Hi,

It isn't problem. I'm sure i've got all the needed zeroes. The same code works very good with one transaction.

I've found note number 760068 I think it is the problem solution (no solution) .

Regards:

Lukasz Tylutki

rmazzali
Active Contributor
0 Kudos

Then you could change the logic and call the BAPI once for each doc.

Roberto

Former Member
0 Kudos

The problem occurs even if I change differrent documents. As I've understood note 760068 the problem is general in SD BAPI when we make differrent operations using BAPI from the same group as mentioned in note: "Teses are side effects which can occur if the BAPIs partly access the same programs internally".

My process is: change SO and post delivery.

Lukasz Tylutki