Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Create PickList with Batch number and Bin Allocation

Hello Experts,

Can you help me please ! this kind of urgent.

We want to create the pick list based on Sales Order  via DI API, and faced a problem. Our Sales Order contains Batch Number and then we choose the Bin location once creating the pick list without default Bin Location. So, when we create the pick list the lines are not enabled ! We think that we have to set the batch number and the Bin Location for each line in the pick list ?

In the code we created the pick list and then we updated it ( we set the bin location for each line). We tested for a document with only one line, the code works fine but when we create a document with more lines we get this error :

Error:

-10 1470000838 - Invalid "敓楲污湁䉤瑡档畎扭牥䉳獡䱥湩e"; specify a valid "敓楲污湁䉤瑡档畎扭牥䉳獡䱥湩e"


My code is attached !

PickList.txt.zip (1024 B)
Former Member
replied

Hi Hamid,

I tried a minimal example using Demo DB but I just ended up getting the same error as you...

I created an Order with 2 lines :

After a lot of trying ( I never actually had a real life case with batch and bin ) I came up with the following working code

SAPbobsCOM.Documents oOrder = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);

SAPbobsCOM.PickLists oPickList = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);

int docEntry = 381;

oOrder.GetByKey(docEntry);

for (int i = 0; i < oOrder.Lines.Count; i++)

{

    if (i > 0)

        oPickList.Lines.Add();

    oOrder.Lines.SetCurrentLine(i);

    oPickList.Lines.SetCurrentLine(i);

    oPickList.Lines.OrderRowID = i;

    oPickList.Lines.BaseObjectType = "17";

    oPickList.Lines.OrderEntry = docEntry;

    oPickList.Lines.ReleasedQuantity = oOrder.Lines.Quantity;

}

if (oPickList.Add() != 0)

    MessageBox.Show(SBO_Company.GetLastErrorDescription());

else

{

    String PickAbs = SBO_Company.GetNewObjectKey();

    oPickList.GetByKey(Convert.ToInt32(PickAbs));

    for (int i = 0; i < oPickList.Lines.Count; i++)

    {

        oPickList.Lines.SetCurrentLine(i);

        oPickList.Lines.PickedQuantity = oPickList.Lines.ReleasedQuantity;

        oPickList.Lines.BatchNumbers.BatchNumber = "B1-00097";

        oPickList.Lines.BatchNumbers.Quantity = oPickList.Lines.PickedQuantity;

        oPickList.Lines.BinAllocations.BinAbsEntry = 10;

        oPickList.Lines.BinAllocations.Quantity = oPickList.Lines.PickedQuantity;

        oPickList.Lines.BinAllocations.BaseLineNumber = i;//This was the key, if you just handl bins it is automatically set

        oPickList.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;

    }

    if (oPickList.Update() != 0)

        MessageBox.Show(SBO_Company.GetLastErrorDescription());

    else

        MessageBox.Show("Success");

}

regards,

Maik

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question