Skip to Content
0
Former Member
Mar 23, 2009 at 02:37 PM

Another User modified Table (ODBC -2039) - purchase order

101 Views

I have following scenario:

In SBO are purchase orders for one vendor where in document line is user field for storing some informations. After setting this user field to all lines (manualy) I want to recreate this purchase orders and create one purchase order for each value in user field and close lines in former orders.

For example - purchase orders lines:

docentry itemcode userfield

1 12 a

1 12 b

1 12 a

1 12 a

1 12 b

1 12 c

2 12 c

2 12 a

After recreating I want to have:

docentry itemcode userfield

3 12 a

3 12 a

3 12 a

3 12 a

4 12 b

4 12 b

5 12 c

5 12 c

Hope is clear this explanation what I want.

Im doing it so, that I create new purchase order for each value in user field - with no problem. After creating new orders Im going through old orders and Im closing the lines. And here is sometime problem with error Another user... I found out, that this problem is only when in order, where I want close line, exist already closed line and not allways.

When I try to simulate this problem, everything works. When I create order, manualy close one line in this order and wait few days and try to apply this scenario, it will falls.

This problems occurs since PL30 and in PL47 it is same.

The code I have for this is:

obj = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
                            obj.GetByKey(docentry)
                            obj.Comments = " xxx"
                            err_code = obj.Update()
                            If err_code <> 0 Then
                                oCompany.GetLastError(err_code, err_msg)
                                SAP.Connection.oSBOApplication.MessageBox(err_msg, 1, "OK")
                            End If
                            obj.Lines.SetCurrentLine(3)
                            obj.Lines.LineStatus = SAPbobsCOM.BoStatus.bost_Close
                            err_code = obj.Update()
                            If err_code <> 0 Then
                                oCompany.GetLastError(err_code, err_msg)
                                SAP.Connection.oSBOApplication.MessageBox(err_msg, 1, "OK")
                            End If

The double update of order is there, because when one line is closed, DI API will not allow make update of lines...

Any help is highly appreciated. Thanks