Skip to Content
0

SAP B1 DI API Set batch numbers to auto-select batches on Inventory Transfer

Nov 16, 2017 at 02:13 PM

179

avatar image
Former Member

Hello,

I have the following code that I am using to transfer goods from one warehouse to another. Some items are batched.

How do I get to set batch numbers to auto-select in the same way you have the option of pressing the "auto select" button when on the B1 client?

Any help appreciated.

SAPbobsCOM.StockTransfer sboSTs = SboConnection.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer);

// Set properties of the Inventory Transfer object
// Add the header
sboSTs.DocDate = DateTime.Now;
sboSTs.TaxDate = DateTime.Now;
sboSTs.FromWarehouse = "01";
sboSTs.ToWarehouse = "06";
sboSTs.JournalMemo = jobNumber;

// Add the lines
dictionary.ToList().ForEach(x =>
{
sboSTs.Lines.ItemCode = (x.Value.First().Profile.Replace("*", "X") + "-" + x.Value.First().Grade);
sboSTs.Lines.FromWarehouseCode = "01";
sboSTs.Lines.WarehouseCode = "06";
sboSTs.Lines.Quantity = x.Value.Sum(s => Convert.ToDouble(s.Quantity));
sboSTs.Lines.ProjectCode = jobNumber;
sboSTs.Lines.BatchNumbers.Quantity = x.Value.Sum(s => Convert.ToDouble(s.Quantity));
sboSTs.Lines.Add();
});

Kinyanjui

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Konstantin Lobaj Mar 20 at 02:21 PM
0

Hi,

I think you can not assign batch number automatically through DI API. You will have to look them up in the OBTQ and set them according to quantity.

Also have a look at this: https://archive.sap.com/discussions/thread/2104024

Share
10 |10000 characters needed characters left characters exceeded