cancel
Showing results for 
Search instead for 
Did you mean: 

Add PickList DiApi with batchnumbers

Former Member
0 Kudos

Hi,

I'm trying to create a picklist using the DIAPI, but I'm having problems.

Error Message is:  "Internal error (-2007) occurred"

SAP 9 PL 7.

My Code:


public void UpdatePickingList(int id)

        {

            PickLists pk = c.GetBusinessObject(BoObjectTypes.oPickLists);

          

            pk.PickDate = Convert.ToDateTime("15/02/2014"); ;

            pk.Lines.BaseObjectType = "17";

            pk.Lines.ReleasedQuantity = 1;

            pk.Lines.OrderEntry = 32;

            pk.Lines.OrderRowID = 0;

          

            int i = pk.Lines.Count;

            pk.Lines.BatchNumbers.SetCurrentLine(0);

            pk.Lines.BatchNumbers.BatchNumber = "XPTO1234";

            //pk.Lines.BatchNumbers.Location = "MG";//"MG-MATERIAL_ALOCADO";

            pk.Lines.BatchNumbers.Quantity = 1;

            pk.Lines.BatchNumbers.Add();

            pk.Lines.BinAllocations.SetCurrentLine(0);

         

          

            pk.Lines.BinAllocations.BinAbsEntry = 36;

            pk.Lines.BinAllocations.Quantity = 1;

            pk.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;

            //pk.Lines.BinAllocations.BaseLineNumber = 0;

            pk.Lines.BinAllocations.Add();

            pk.Lines.Add();

         

         

            int iErro = pk.Add();

            if (!iErro.Equals(0))

            {

                string sErro = c.GetLastErrorDescription();

     

    }

        }

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

The following SAP Note http://service.sap.com/sap/support/notes/1958889, says:

"In order to add a Bin Location to an Item in a Pick List via the DI API, the Pick List must already be created"

This mean you can NOT allocate before adding the PickList.

Beni.

Former Member
0 Kudos

I keep having trouble, see:

"Cannot add row without complete selection of batch/serial numbers".


            PickLists pk = c.GetBusinessObject(BoObjectTypes.oPickLists);

           

            pk.PickDate = Convert.ToDateTime("15/02/2014"); ;

            pk.Lines.BaseObjectType = "17";

            pk.Lines.ReleasedQuantity = 1;

            pk.Lines.OrderEntry = 32;

            pk.Lines.OrderRowID = 0;

           

            pk.Lines.Add();

          

          

            int iErro = pk.Add();

            if (!iErro.Equals(0))

            {

                string sErro = c.GetLastErrorDescription();

            }

            pk = null;

            int iPick = 6;

            pk = c.GetBusinessObject(BoObjectTypes.oPickLists);

            pk.GetByKey(iPick);

            int i = pk.Lines.Count;

            pk.Lines.BatchNumbers.SetCurrentLine(0);

            pk.Lines.BatchNumbers.BatchNumber = "XPTO1234";

            pk.Lines.BatchNumbers.Location = "MG-MATERIAL_ALOCADO";

            pk.Lines.BatchNumbers.Quantity = 1;

            pk.Lines.BatchNumbers.Add();

            pk.Lines.BinAllocations.SetCurrentLine(0);

            pk.Lines.BinAllocations.BinAbsEntry = 36;

            pk.Lines.BinAllocations.Quantity = 1;

            pk.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;

            pk.Lines.PickedQuantity = 1;

            //pk.Lines.BinAllocations.BaseLineNumber = 0;

            pk.Lines.BinAllocations.Add();

            iErro = pk.Update();

            if (!iErro.Equals(0))

            {

                string sErro = c.GetLastErrorDescription();

            }


The same problem occurs when I use the following code:


PickLists pk = c.GetBusinessObject(BoObjectTypes.oPickLists);

           

            pk.PickDate = Convert.ToDateTime("15/02/2014"); ;

            pk.Lines.BaseObjectType = "17";

            pk.Lines.ReleasedQuantity = 1;

            pk.Lines.OrderEntry = 32;

            pk.Lines.OrderRowID = 0;

           

            pk.Lines.Add();

          

          

            int iErro = pk.Add();

            if (!iErro.Equals(0))

            {

                string sErro = c.GetLastErrorDescription();

            }

            pk = null;

            int iPick = 0;

            pk = c.GetBusinessObject(BoObjectTypes.oPickLists);

            pk.GetByKey(iPick);

            pk.Lines.BinAllocations.BinAbsEntry = 36;

            pk.Lines.BinAllocations.Quantity = 1;

            //pk.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;

            pk.Lines.PickedQuantity = 1;

            //pk.Lines.BinAllocations.BaseLineNumber = 0;

            pk.Lines.BinAllocations.Add();

            iErro = pk.Update();

            if (!iErro.Equals(0))

            {

                string sErro = c.GetLastErrorDescription();

            }

Former Member
0 Kudos

Hi,

Try without pk.Lines.BatchNumbers.Add();  (line 26) and pk.Lines.BinAllocations.Add();  (line 33).

Beni.

Former Member
0 Kudos

continue with the same error:

"Cannot add row without complete selection of batch/serial numbers".

also tried without pk.Lines.add() and assigning the pk.Lines.SetCurrentLine(0); 

0 Kudos

Hey Brian:

  Did you have solution for this? I am having the same problem here! Thank You!

Former Member
0 Kudos

Hey Bo Peng

So I am not sure if this is what is causing your issue here but in 8.82 you could not add a batch to a picklist without first adding it to the order the pick list was based on.