Skip to Content
0
Former Member
Aug 09, 2016 at 08:19 AM

DI API: One pick undoing another?

250 Views

Hi and thanks for reading,

I think I must be doing something wrong in my code because when an order line splits into multiple picking lines then when I set the picked quantity on one of the lines it undoes the picked quantity on the other lines.

example:

line 0 on the order has 10 of product ABC, which we released to pick becomes line 0, 5 in location A and line 1, 5 in location B. when I pick location A everything is find but when I pick location B then the picked quantity resets to zero on location A . And if I then try to pick location A again the picked quantity on Location B resets to zero.

Here is my function for setting an individual pick line, SAP 9.1 PL 08 is there anyone out there that could shed some light?

static string Pick(string picklist, string strlinenum, string qty, string strbinabs,string userid,string strPkl2LinNum)
{
try
{
int picklistid = Convert.ToInt32(picklist);
int linenum = Convert.ToInt32(strlinenum);
int Pkl2LinNum = Convert.ToInt32(strPkl2LinNum);
int binabs = Convert.ToInt32(strbinabs);
double quantity = Convert.ToDouble(qty);

SAPbobsCOM.PickLists oPickList = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPickList.GetByKey(picklistid);
oPickList.Lines.SetCurrentLine(linenum);
oPickList.Lines.PickedQuantity = quantity; //? do we need this..
oPickList.Lines.BinAllocations.BinAbsEntry = binabs;
oPickList.Lines.BinAllocations.Quantity = quantity; //..when we have this
oPickList.Name = userid;
Console.WriteLine(oPickList.Lines.ReleasedQuantity);
Console.WriteLine(oPickList.Lines.PickedQuantity);
Console.WriteLine(oPickList.Lines.OrderEntry);
Console.WriteLine(oPickList.Lines.OrderRowID);
oPickList.Remarks = DateTime.Now.ToString();

if (oPickList.Update() != 0)
{
return oCompany.GetLastErrorDescription();
}
else
{
return "Picked.";
}
}
catch (Exception e)
{
return e.Message;
}
}