Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problems in new lines in updating a Draft

hello everyone,

Using DI api, I'm updating a previously created Draft of oStockTransfer type by adding a couple of more lines.

I get no errors, but the new lines look different from those added when the document was created.

The numeric values for example, whose default is 0.00, are NULL, and so are other field like unitMsr, Currency, etc.

I can not understand why, when I'm creating a new document, it is sufficient to assign the MyDoc.Lines.ItemCode = "XYZ" in order to DI api take care of the default values of the Items and fill in the right fields (ItemDescription, MeasureUnit, etc. of the table DRF1 ), WHEREAS when I'm in updating mode of a document, all this doesn't happen.

This is the code I use when I create a new Draft :

oDoc1 = oCompany.GetBusinessObject(BoObjectTypes.oDrafts)

oDoc1.DocObjectCodeEx = BoObjectTypes.oStockTransfer

oDoc1.DocDueDate = Date.Today

oDoc1.DocDate = Date.Today

(. . .)

oDoc1.Lines.ItemCode = "XYZ"

oDoc1.Lines.WarehouseCode = "01"

oDoc1.Lines.Quantity = 10

This is the code I use when I update the previously created Draft:

(before I get TheRightKey with a query)

oDoc1 = oCompany.GetBusinessObject(BoObjectTypes.oDrafts)

oDoc1.DocObjectCodeEx = BoObjectTypes.oStockTransfer

oDoc1.GetByKey(TheRightKey)

(. . .)

oDoc1.Lines.Add()

oDoc1.Lines.SetCurrentLine(oDoc1.Lines.Count - 1)

oDoc1.Lines.ItemCode = "XYZ"

' if I don't fill explicitly the field ItemDescription, it stays NULL!!

oDoc1.Lines.ItemDescription = "Bla-bla-bla"

oDoc1.Lines.WarehouseCode = "01"

oDoc1.Lines.Quantity = 10

' and, as the MeasureUnit is a read-only field, I can't even write

' on it, and it remains NULL !!

My version is SAP 2007A SP0 PL38

thank you in advance for any help.

GB

Edited by: Giorgio Bindelli on Sep 17, 2008 1:14 PM

Former Member
Former Member replied

Im using PL30 and this error seems to be related to drafts only. BTW, you may add lines only to quotation, order and production order and there it works. After creating other types of dicument (for example invoice), you cannot edit lines after adding.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question