cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

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