cancel
Showing results for 
Search instead for 
Did you mean: 

two serialnumbers to oPurchaseDeliveryNotes : Error -2035

Former Member
0 Kudos

Hello,

I'am trying to add two Items every with one Serial Number to a PurchaseDeliveryNote.

I'am using SAP 2007 A SP 0 PL 35.

If I add only the first part, it works. If I add only the 2nd Item it also works.

But both Items every with one Serialnumber I get the Error:

[PDN1.WhsCode][line: 0] , 'This entry already exists in the following tables (ODBC -2035)'

I'am using Company.StartTransaction() and EndTransaction to Rollback for the same situation.

The Serialnumbers are not in the OSRI.

Here is the part of the code.

SAPbobsCOM.Documents myDok = null;

SAPbobsCOM.Document_Lines myLines = null;

SAPbobsCOM.SerialNumbers mySerien = null;

myDok = ( (SAPbobsCOM.Documents)

(globals.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes)) );

myDok.CardCode = "S18001";

myLines = myDok.Lines;

myLines.ItemCode = "X2991";

myLines.Quantity = 1.0;

myLines.BaseEntry = 1368;

myLines.BaseLine = 2;

myLines.BaseType = 22;

mySerien = myLines.SerialNumbers;

mySerien.ManufacturerSerialNumber = "Ser_X2991_Aug18b";

mySerien.BaseLineNumber = 0; // in DocLines

myLines.Add();

myLines.ItemCode = "X2992";

myLines.Quantity = 1.0;

myLines.BaseEntry = 1368;

myLines.BaseLine = 3;

myLines.BaseType = 22;

mySerien = myLines.SerialNumbers;

mySerien.ManufacturerSerialNumber = "Ser_X2992_Aug18b";

mySerien.BaseLineNumber = 1; // in DocLines

/*

// only 1. part works:

myLines.ItemCode = "X2991";

myLines.Quantity = 1.0;

myLines.BaseEntry = 1368;

myLines.BaseLine = 2;

myLines.BaseType = 22;

mySerien = myLines.SerialNumbers;

mySerien.ManufacturerSerialNumber = "Ser_X2991_Aug18b";

mySerien.BaseLineNumber = 0; // in DocLines

*/

/*

// only this modified 2nd part also works:

myLines.ItemCode = "X2992";

myLines.Quantity = 1.0;

myLines.BaseEntry = 1368;

myLines.BaseLine = 3;

myLines.BaseType = 22;

mySerien = myLines.SerialNumbers;

mySerien.ManufacturerSerialNumber = "Ser_X2992_Aug18b";

mySerien.BaseLineNumber = 0; // in DocLines

*/

What I'am doing wrong ?

It is also possible to add Items with serialnumbers in the SBO menu for a user.

Does SBO sets additional properties ? How can I know if its a problem of my source ?

Please give me some hints .

Accepted Solutions (0)

Answers (2)

Answers (2)

robert_daniels
Explorer
0 Kudos

We got it working

I was having the same issue, then I tried adding the document through SAP Client and noticed a system message confirming the batch during batch selection. For us the problem was we had lowercase BatchNumber in OIBT, and I was trying to receive it as the uppercase BatchNumber. Our solution was:

update ibt1 set BatchNum = UPPER(BatchNum)

update oibt set BatchNum = UPPER(BatchNum)

Nussi
Active Contributor
0 Kudos

Hi Henry,

Serial Numbers are unique - for each quantity you have only 1 serialnumber.

if you have more quantity witht the same "serie" you have to use Batches !

lg David

Former Member
0 Kudos

Thank you for your comment, but I have 2 Items:

X2991 with Serialnumber Ser_X2991_Aug18b and

X2992 with Ser_X2992_Aug18b , so I get two Document-Lines for two Items. Every Item only has a Quantity of 1.

Former Member
0 Kudos

I think that setcurrecntline is missing. Try it as

myLines.Add();

myLines.SetcurrentLine(1);

myLines.ItemCode = "X2992";

myLines.Quantity = 1.0;

Nussi
Active Contributor
0 Kudos

Hi Henry,

ok - the serial numbers are different - than it's ok.

than i agree with petr -> try to implement setcurrentline

lg David

Former Member
0 Kudos

I have inserted the myLines.SetCurrentLine(1); but I get the same error.

Former Member
0 Kudos

Thank You for Your Replies Petr and David.

Now I have tried the following:

For the purchase order I create a new Goods Receipt PO with Business One and the same Quantity. Then

I look for the DocEntry, use GetbyKey and save the Doc-structure as XML.

Then I have Deleted the records with SystemSerialNumber, change the SerialNumbers and tried to add it as new PurchaseDeliveryNote.

But I get also the same Error.

The Source of the XML comes from a correct PurchaseDeliveryNote, I look if I can drop some other Property-Lines to get a Document with myDok.Add() .

Nussi
Active Contributor
0 Kudos

Hi Henry,

i helped already some people regarding this.

[maybe this helps you|;

i posted there a sample - compare it with your code

lg David

Former Member
0 Kudos

Hi David,

Thank You for this link.

I have compared with my version, used SetCurrentLine also in SerialNumbers, changed InternalSerialNumber to ManufacturerSerialNumber, substitute BaseLineNumber to my BaseDoc,

modified with and without Base-Doc-Entry but I can't Add my new PurchaseDeliveryNote .

Is there a new handling in 2007 ?

Nussi
Active Contributor
0 Kudos

hi,

i don't see any changes in 2007 for serialnumbers.

in sdk it looks the same.

lg David

Former Member
0 Kudos

Hello David, hello Petr, Hello All

If I use the XML-File from an existing PurchaseDeliveryNote with dropped DocNum,Reference1,Systemserialnumbers

and substitute the ManufacturerSerialnumbers, then I also can´t Add this as new Document.

If I delete the Lines and Serialnumber for the 2nd Item in the XML-File, then add is possible for this part of the document. With the XML-Test fewer mistakes with Add(), = Serialnumbers or SetCurrentline possible.

I decide a difference, that Serialnumbers.BaseLineNumer expected as the Number of the Line from Document-Lines when I generate the structure for the document with only one item and one Serialnumber, in this case 0.

The Document_Lines.BaseLine is referred to the Line-Number in the Purchase Order, which can be greater than 0, if the delivered Item is in a higher line. But in the exported XML-File the Serialnumbers.BaseLineNumer is equal the Document_Lines.BaseLine and is so expected. But this may not the cause for the problem.

Does anybody have other hints ?

Nussi
Active Contributor
0 Kudos

well henry,

i ran out of ideas, but one thing i want to mention:

when you want to create a document with a serial that already exists in a previous document than you get the

error message from your first post.

you can only have the same serial once on stock.

lg David