Skip to Content
0
Jun 03, 2011 at 03:08 PM

Error closing sales order using di api - SAP 8.81

657 Views

Hi

I am trying to close a sales order with the following code but I get the following error -

"Document rows cannot be closed concurrently with the other document modifications you have made "

Can anyone suggest anything please ?

Many Thanks

Regards Andy

ret = doc.GetByKey(CInt(recset.Fields.Item(0).Value))

If ret = -1 Then

' loop through lines of the order

For lc = 0 To doc.Lines.Count - 1

doc.Lines.SetCurrentLine(lc)

If doc.Lines.LineStatus <> BoStatus.bost_Close Then

doc.Lines.LineStatus = BoStatus.bost_Close

GoTo skip

End If

Next

skip:

If doc.Update <> 0 Then

B1Connections.diCompany.GetLastError(errcode, errmsg)

B1Connections.theAppl.MessageBox(errmsg)

message("Error closing order " & recset.Fields.Item(0).Value & " " & errmsg)

Else

message("Closed order " & recset.Fields.Item(0).Value)

' set udfs on sales order and del note ?

End If

Else

message("Cannot open order " & recset.Fields.Item(0).Value)