Skip to Content
Author's profile photo SHALINI Singhal

Pick List in SAP Business One SDK

Pick List is used to pick items from the warehouse and to pack them for shipping.

To access the window from the SAP Business One Main Menu, choose Inventory  Pick and Pack  Pick List

For more information on Pick List, you can refer to following link:

https://help.sap.com/doc/saphelp_sbo92/9.2/en-US/44/c4c1cd7ca22e17e10000000a114a6b/frameset.htm

Pick List in SAP Business One SDK:

The PickLists object supports the picking process of items from the warehouse.

Pick List is exposed as a BoObjectTypes (PickLists) in SAP Business One SDK. Here is how to use it:

Scenario1: Items are NOT managed by Batches / Serial Numbers in the Base Document (Sales Order) and Warehouses are NOT allocated by Bin Locations

  • Add Pick List in Released Status for all Items on Sales Order
SAPbobsCOM.Documents oDocuments = null;
SAPbobsCOM.Document_Lines oDocument_Lines = null;
SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oDocuments = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
oDocuments.GetByKey(376);
oDocument_Lines = oDocuments.Lines;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPickLists_Lines = oPickLists.Lines;
for (int i = 0; i < oDocument_Lines.Count; i++)
{
    if (i > 0)
        oPickLists_Lines.Add();
    oDocument_Lines.SetCurrentLine(i);
    oPickLists_Lines.BaseObjectType = "17";
    oPickLists_Lines.OrderEntry = oDocuments.DocEntry;
    oPickLists_Lines.OrderRowID = i;
    oPickLists_Lines.ReleasedQuantity = oDocument_Lines.Quantity;
}
int RetVal = oPickLists.Add();
  • Update Pick List by picking all Items in Pick List
SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
if (oPickLists.GetByKey(1))
{
    oPickLists_Lines = oPickLists.Lines;
    for (int i = 0; i < oPickLists_Lines.Count; i++)
    {
        oPickLists_Lines.SetCurrentLine(i);
        oPickLists_Lines.PickedQuantity = oPickLists_Lines.ReleasedQuantity;
    }
    int RetVal = oPickLists.Update();
}
  • Delete Rows from Pick List When Pick List is in Picked Status

There is no Delete method in Pick List Object.

1. First set Picked Quantity as 0 in Pick List and Update Pick List

SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
if (oPickLists.GetByKey(14))
{
    oPickLists_Lines = oPickLists.Lines;
    for (int i = 0; i < oPickLists_Lines.Count; i++)
    {
        oPickLists_Lines.SetCurrentLine(i);
        oPickLists_Lines.PickedQuantity = 0;
    }
    int RetVal = oPickLists.Update();
}

2. Set Released Quantity as 0 in Pick List and Update Pick List

SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
if (oPickLists.GetByKey(14))
{
    oPickLists_Lines = oPickLists.Lines;
    for (int i = 0; i < oPickLists_Lines.Count; i++)
    {
        oPickLists_Lines.SetCurrentLine(i);
        oPickLists_Lines.ReleasedQuantity = 0;
    }
    int RetVal = oPickLists.Update();
}

Scenario2: When Items are managed by Batches / Serial Numbers and Warehouses are NOT allocated by Bin Locations

  • Update Pick List and assign Batches / Serial Numbers to all Items in Pick List

You cannot assign Batches / Serial Numbers to Pick List when Batches / Serial Numbers are not assigned to base document (Sales Order). First you have to assign Batches / Serial Numbers to base document (Sales Order) then Update Pick List with Batches / Serial Numbers.

1. Assign Batches / Serial Numbers to the Items in Sales Order

SAPbobsCOM.Documents oDocuments = null;
SAPbobsCOM.Document_Lines oDocument_Lines = null;
oDocuments = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
oDocuments.GetByKey(371);
oDocument_Lines = oDocuments.Lines;
oDocument_Lines.SetCurrentLine(0);
oDocument_Lines.BatchNumbers.BatchNumber = "B1_001";
oDocument_Lines.BatchNumbers.Quantity = 2;
oDocument_Lines.BatchNumbers.Add();
oDocument_Lines.BatchNumbers.BatchNumber = "B1_002";
oDocument_Lines.BatchNumbers.Quantity = 8;

oDocument_Lines.SetCurrentLine(1);
oDocument_Lines.BatchNumbers.BatchNumber = "B2_001";
oDocument_Lines.BatchNumbers.Quantity = 4;
oDocument_Lines.BatchNumbers.Add();
oDocument_Lines.BatchNumbers.BatchNumber = "B2_002";
oDocument_Lines.BatchNumbers.Quantity = 16;
int RetVal = oDocuments.Update();

2. Update Pick List with Batches / Serial Numbers same as Base Document (Sales Order)

SAPbobsCOM.Documents oDocuments = null;
SAPbobsCOM.Document_Lines oDocument_Lines = null;
SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oDocuments = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
oDocuments.GetByKey(371);
oDocument_Lines = oDocuments.Lines;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPickLists.GetByKey(7);
oPickLists_Lines = oPickLists.Lines;
for (int i = 0; i < oPickLists_Lines.Count; i++)
{
    oDocument_Lines.SetCurrentLine(i);
    oPickLists_Lines.SetCurrentLine(i);

    oPickLists_Lines.PickedQuantity = oPickLists_Lines.ReleasedQuantity;
    for (int j = 0; j < oDocument_Lines.BatchNumbers.Count; j++)
    {
        if (j > 0)
        {
oPickLists_Lines.BatchNumbers.Add();
        }
        oDocument_Lines.BatchNumbers.SetCurrentLine(j);
        oPickLists_Lines.BatchNumbers.BaseLineNumber = i;
        oPickLists_Lines.BatchNumbers.BatchNumber = oDocument_Lines.BatchNumbers.BatchNumber;
        oPickLists_Lines.BatchNumbers.Quantity = oDocument_Lines.BatchNumbers.Quantity;
    }
}
int RetVal = oPickLists.Update();
  • Update Pick List and Partially Pick Items in Pick List
SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPickLists.GetByKey(12);
oPickLists_Lines = oPickLists.Lines;

// When Item on Row 1 has 10 Quantity and You want to Pick Only 3 Quantity
oPickLists_Lines.SetCurrentLine(0);
oPickLists_Lines.PickedQuantity = 3;
//Pick 1 Quantity of Batch "B1_001" for Item on Row 1
oPickLists_Lines.BatchNumbers.BatchNumber = "B1_001";
oPickLists_Lines.BatchNumbers.Quantity = 1;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 0; //BaseLineNumber is Row Number on PKL1

//Pick 2 Quantity of Batch "B1_002" for Item on Row 1
oPickLists_Lines.BatchNumbers.Add();
oPickLists_Lines.BatchNumbers.BatchNumber = "B1_002";
oPickLists_Lines.BatchNumbers.Quantity = 2;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 0;

// When Item on Row 2 has 20 Quantity and You want to Pick Only 4 Quantity
oPickLists_Lines.SetCurrentLine(1);
oPickLists_Lines.PickedQuantity = 4;
//Pick 3 Quantity of Batch "B2_001" for Item on Row 2
oPickLists_Lines.BatchNumbers.BatchNumber = "B2_001";
oPickLists_Lines.BatchNumbers.Quantity = 3;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 1;

//Pick 1 Quantity of Batch "B2_002" for Item on Row 2
oPickLists_Lines.BatchNumbers.Add();
oPickLists_Lines.BatchNumbers.BatchNumber = "B2_002";
oPickLists_Lines.BatchNumbers.Quantity = 1;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 1; //BaseLineNumber is Row Number on PKL1
int RetVal = oPickLists.Update();

Scenario3: When Items are managed by Batches / Serial Numbers and Warehouses are allocated by Bin Locations

  • Update Pick List and allocate Batches / Serial Numbers and Bin Location When a Pick List is in Released Status
SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPickLists.GetReleasedAllocation(14);
oPickLists_Lines = oPickLists.Lines;

// Item in Row 1 has two Batches and two Bin Locations 
oPickLists_Lines.SetCurrentLine(0);
oPickLists_Lines.BatchNumbers.BatchNumber = "B1_001"; ;
oPickLists_Lines.BatchNumbers.Quantity = 2;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 0;

oPickLists_Lines.BinAllocations.BinAbsEntry = 6;
oPickLists_Lines.BinAllocations.Quantity = 2;
oPickLists_Lines.BinAllocations.BaseLineNumber = 0;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;

oPickLists_Lines.BatchNumbers.Add();
oPickLists_Lines.BatchNumbers.BatchNumber = "B1_002"; ;
oPickLists_Lines.BatchNumbers.Quantity = 8;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 0;

oPickLists_Lines.BinAllocations.Add();
oPickLists_Lines.BinAllocations.BinAbsEntry = 14;
oPickLists_Lines.BinAllocations.Quantity = 8;
oPickLists_Lines.BinAllocations.BaseLineNumber = 0;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 1;

// Item in Row 2 has two Batches and two Bin Locations 
oPickLists_Lines.SetCurrentLine(1);
oPickLists_Lines.BatchNumbers.BatchNumber = "B2_001"; ;
oPickLists_Lines.BatchNumbers.Quantity = 4;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 1;

oPickLists_Lines.BinAllocations.BinAbsEntry = 3;
oPickLists_Lines.BinAllocations.Quantity = 4;
oPickLists_Lines.BinAllocations.BaseLineNumber = 1;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;

oPickLists_Lines.BatchNumbers.Add();
oPickLists_Lines.BatchNumbers.BatchNumber = "B2_002"; ;
oPickLists_Lines.BatchNumbers.Quantity = 16;
oPickLists_Lines.BatchNumbers.BaseLineNumber = 1;

oPickLists_Lines.BinAllocations.Add();
oPickLists_Lines.BinAllocations.BinAbsEntry = 43;
oPickLists_Lines.BinAllocations.Quantity = 16;
oPickLists_Lines.BinAllocations.BaseLineNumber = 1;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 1;
int RetVal = oPickLists.UpdateReleasedAllocation();
  • Update Pick List and Pick quantity in Pick List
SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPickLists.GetByKey(14);
oPickLists_Lines = oPickLists.Lines;
oPickLists_Lines.SetCurrentLine(0);
oPickLists_Lines.PickedQuantity = 1;
oPickLists_Lines.BatchNumbers.SetCurrentLine(0);
oPickLists_Lines.BatchNumbers.BaseLineNumber = 0;
oPickLists_Lines.BatchNumbers.BatchNumber = "B1_001"; ;
oPickLists_Lines.BatchNumbers.Quantity = 1;
oPickLists_Lines.BinAllocations.SetCurrentLine(0);
oPickLists_Lines.BinAllocations.BaseLineNumber = 0;
oPickLists_Lines.BinAllocations.BinAbsEntry = 6;
oPickLists_Lines.BinAllocations.Quantity = 1;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
int RetVal = oPickLists.Update();
  • Update Pick List and Fully Deallocate Batches / Serial Numbers in Pick List
SAPbobsCOM.PickLists oPickLists = null;
SAPbobsCOM.PickLists_Lines oPickLists_Lines = null;
oPickLists = (SAPbobsCOM.PickLists)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPickLists.GetReleasedAllocation(14);
oPickLists_Lines = oPickLists.Lines;

oPickLists_Lines.SetCurrentLine(0);
oPickLists_Lines.BatchNumbers.SetCurrentLine(0);
oPickLists_Lines.BatchNumbers.Quantity = 0;
oPickLists_Lines.BinAllocations.SetCurrentLine(0);
oPickLists_Lines.BinAllocations.Quantity = 0;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
oPickLists_Lines.BatchNumbers.SetCurrentLine(1);
oPickLists_Lines.BatchNumbers.Quantity = 0;
oPickLists_Lines.BinAllocations.SetCurrentLine(1);
oPickLists_Lines.BinAllocations.Quantity = 0;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 1;

oPickLists_Lines.SetCurrentLine(1);
oPickLists_Lines.BatchNumbers.SetCurrentLine(0);
oPickLists_Lines.BatchNumbers.Quantity = 0;
oPickLists_Lines.BinAllocations.SetCurrentLine(0);
oPickLists_Lines.BinAllocations.Quantity = 0;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
oPickLists_Lines.BatchNumbers.SetCurrentLine(1);
oPickLists_Lines.BatchNumbers.Quantity = 0;
oPickLists_Lines.BinAllocations.SetCurrentLine(1);
oPickLists_Lines.BinAllocations.Quantity = 0;
oPickLists_Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 1;
int RetVal = oPickLists.UpdateReleasedAllocation();

The above code is useful when you want to fully deallocate Batches / Serial Numbers in Pick List. If you want to partially deallocate Batches / Serial Numbers in Pick List then you have to mention Batches / Serial Numbers and Bin Locations in the code from which you want to deallocate.

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Marcus Tastler
      Marcus Tastler

      Wonderful, thanks!

       

      Author's profile photo Bilal Sultan
      Bilal Sultan

      Dear SHALINI Singhal,

      i need to change the batch number in picklist lines.

      i guess i should deallocate and allocate another batch,

      i’m using below code to deallocate one line with one batch (Warehouse is managed by bin)

      PickList.Lines.SetCurrentLine(0);
      PickList.Lines.BatchNumbers.SetCurrentLine(0);
      PickList.Lines.BatchNumbers.Quantity = 0;
      PickList.Lines.BinAllocations.SetCurrentLine(0);
      PickList.Lines.BinAllocations.Quantity = 0;
      PickList.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
      PickList.UpdateReleasedAllocation();

       

      I’m getting success but the pick list is now broken look at below image

      i can’t pick, Release or do any operation on this picklist now.

       

      I’ve also tried to just change the Batch number using below Code

      PickList.Lines.SetCurrentLine(0);
      PickList.Lines.BatchNumbers.SetCurrentLine(0);
      PickList.Lines.BatchNumbers.BatchNumber = "NewBatchNumber";
      PickList.UpdateReleasedAllocation();

      but it’s not working either.

      Please Advise.

      Maria Trinidad MARTINEZ GEA i also couldn't alter the batch number on service layer

      Thanks in Advanced.

      Author's profile photo SHALINI Singhal
      SHALINI Singhal
      Blog Post Author

      Dear Bilal Sultan,

      First you have to change the assigned batches in the Sales Order (or base document), then only you will be able to assign new batches in the picklist.

      Thanks & regards,

      Shalini Singhal

      Author's profile photo praveen gupta
      praveen gupta

      How to get picklist with picklist no

      using DI Server?

      Please give me reply soon.