Skip to Content
0
Former Member
Jan 09, 2012 at 10:39 AM

Try to add batchnumber, but UDF went wrong

386 Views

Hello everyone,

What I am trying to do now is use DI API to add a group of batchnumbers in sap b1 with UDF,

But i found out that UDF will only add the first line, and the following lines just repeat the first line.

And the rest which isn't UDF write in correctly.

Ex:

What I want to Import:

BatchNumber Quantity U_Type U_Memo

8575 2 A 12:31

8576 1 B 11/20

8577 3 C 11/03

Result:

BatchNumber Quantity U_Type U_Memo

8575 2 A 12:31

8576 1 A 12:31

8577 3 A 12:31

Part of my code:

receipt.Lines.BatchNumbers.BaseLineNumber = BaseLine;
receipt.Lines.BaseEntry = int.Parse(ReceiptData.Rows<i>["DocEntry"].ToString());
receipt.Lines.Quantity = double.Parse(ReceiptData.Rows<i>["PlannedQuantity"].ToString());
receipt.Lines.BatchNumbers.BatchNumber = ReceiptData.Rows<i>["BatchNumber"].ToString();
receipt.Lines.BatchNumbers.Quantity = double.Parse(ReceiptData.Rows<i>["BatchQuantity"].ToString());
receipt.Lines.BatchNumbers.UserFields.Fields.Item("U_Type").Value = ReceiptData.Rows<i>["Type"].ToString();
receipt.Lines.BatchNumbers.UserFields.Fields.Item("U_Memo").Value = ReceiptData.Rows<i>["Memo"].ToString(); 
receipt.Lines.BatchNumbers.SetCurrentLine(BatchLine++);
receipt.Lines.BatchNumbers.Add();

I found a similar post here Link: [Weird problem with upload data to batches in inventory transaction|http://forums.sdn.sap.com/thread.jspa?threadID=2008936]

I tried the opinion that to check the BaseLineNumber

But still doesn't work...

Could anyone help me out of this?

Thanks for reading!