cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in new lines in updating a Draft

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Giorgio,

i checked it and it seems to be bug in DI API for draft object. There isnt working correctly updating of draft, works only for adding new. Solution for you should be to create another one draft with adding lines from existing and new one or report this bug to SAP.

Former Member
0 Kudos

thank you very much Petr!

now I'll think of some workaround.

ps: is it just an updating problem for drafts, or are other document involved?

Nussi
Active Contributor
0 Kudos

Hi,

should be only a draft problem.

i updated already hundreds of other documents (Invoice / Orders / ...) and never faced that problems.

follow Petr's suggestion and make a bug report.

lg David

Former Member
0 Kudos

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.

Answers (0)