Skip to Content
avatar image
Former Member

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


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));


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 20, 2018 at 02:21 PM


    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:

    Add comment
    10|10000 characters needed characters exceeded