on 2014 Dec 03 6:17 PM
Hi, I have the following picking
Picknumber 5 units 5000 location 02-A-01-5 OrderLine 0
Now, when I want to create the delivery SAP create this picking list
Picknumber 5 units 4500 location 02-A-01-5 OrderLine 0
Picknumber 5 units 250 location 02-A-01-4 OrderLine 0
Picknumber 5 units 250 location 02-A-01-3 OrderLine 0
Based in the location 02-A-01-5 dont have the complete units and get the rest for another location.
When I update the picklist this has only one line and I cant update the picking. and give me internal error -2007
how is the best way to update the picking in this case?
I use this code
SAPbobsCOM.Recordset rs = (SAPbobsCOM.Recordset)Program._conexion2.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
Documents delivery = (SAPbobsCOM.Documents)Program._conexion2.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes);
SAPbobsCOM.Documents oOrder = (SAPbobsCOM.Documents)Program._conexion2.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
SAPbobsCOM.PickLists picking = (SAPbobsCOM.PickLists)Program._conexion2.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
SAPbobsCOM.Items oItem = (SAPbobsCOM.Items)Program._conexion2.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);
bool validadorPicking = picking.GetByKey(Int32.Parse(pick.Value));
bool cadena = oOrder.GetByKey(Int32.Parse(texto1.Value));
#endregion
string cantidadSeleccionada = String.Empty;
Double acumulador =0;
SAPbouiCOM.Matrix _matrix = (SAPbouiCOM.Matrix)oBultosForm.Items.Item("Mtx2").Specific;
for (int j = 1; j <= picking.Lines.Count; j++)
{
picking.Lines.SetCurrentLine(j - 1);
for (int v = 1; v <= _matrix.RowCount; v++)
{
//string codigoProducto = ((SAPbouiCOM.EditText) _matrix.Columns.Item(1).Cells.Item(v).Specific).Value;
//string descripcion = ((SAPbouiCOM.EditText) _matrix.Columns.Item(2).Cells.Item(v).Specific).Value;
cantidadSeleccionada = ((SAPbouiCOM.EditText)_matrix.Columns.Item(3).Cells.Item(v).Specific).Value;
//string cantidadRequerida = ((SAPbouiCOM.EditText) _matrix.Columns.Item(4).Cells.Item(v).Specific).Value;
string ubicacion = ((SAPbouiCOM.EditText)_matrix.Columns.Item(5).Cells.Item(v).Specific).Value;
string linea = ((SAPbouiCOM.EditText)_matrix.Columns.Item(6).Cells.Item(v).Specific).Value;
String _cadena = "select absentry from obin where bincode = '" + ubicacion + "'";
Int32 binAbsEnt = Int32.Parse(DalClass.Seleccionar(Program._conexion2.Conexion2, _cadena));
picking.Lines.BinAllocations.BinAbsEntry = binAbsEnt;
if (linea == (j - 1).ToString())
{
acumulador = Double.Parse(cantidadSeleccionada) + acumulador;
}
}
picking.Lines.PickedQuantity = acumulador;
picking.Lines.BinAllocations.Quantity = acumulador;
}
int _valorRetorno = picking.Update();
Regards
Hi Maik, I tested the code but this set blank values only when the item has many locations.
for (int j = 1; j <= picking.Lines.Count; j++)
{
picking.Lines.SetCurrentLine(j - 1);
for (int v = 1; v <= _matrix.RowCount; v++)
{
//string codigoProducto = ((SAPbouiCOM.EditText) _matrix.Columns.Item(1).Cells.Item(v).Specific).Value;
//string descripcion = ((SAPbouiCOM.EditText) _matrix.Columns.Item(2).Cells.Item(v).Specific).Value;
cantidadSeleccionada = ((SAPbouiCOM.EditText)_matrix.Columns.Item(3).Cells.Item(v).Specific).Value;
//string cantidadRequerida = ((SAPbouiCOM.EditText) _matrix.Columns.Item(4).Cells.Item(v).Specific).Value;
string ubicacion = ((SAPbouiCOM.EditText)_matrix.Columns.Item(5).Cells.Item(v).Specific).Value;
string linea = ((SAPbouiCOM.EditText)_matrix.Columns.Item(6).Cells.Item(v).Specific).Value;
if ((j-1) == Int32.Parse(linea))
{
//picking.Lines.BinAllocations.SetCurrentLine(j);
String _cadena = "select absentry from obin where bincode = '" + ubicacion + "'";
Int32 binAbsEnt = Int32.Parse(DalClass.Seleccionar(Program._conexion2.Conexion2, _cadena));
picking.Lines.BinAllocations.BinAbsEntry = binAbsEnt;
picking.Lines.PickedQuantity = Double.Parse(cantidadSeleccionada);
picking.Lines.BinAllocations.Quantity = Double.Parse(cantidadSeleccionada);
//picking.Lines.BinAllocations.Add();
}
}
}
int _valorRetorno = picking.Update();
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pablo,
I tried to simulate your original post :
//simulated Matrix values
List<Int32> MatrixCellBinAbsEntry = new List<Int32>()
{
105, // "02-A-01-5",
104,// "02-A-01-4",
103 // "02-A-01-3"
};
List<double> MatrixCellQuantity = new List<double>()
{
4500,
250,
250
};
double pickedQtyLine0 = 5000.0; // 4500+250+250
int PickListNumber = 5;
SAPbobsCOM.PickLists oPicklist = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists);
oPicklist.GetByKey(PickListNumber); //Get Picklist No 5
for (int i = 0; i < oPicklist.Lines.Count; i++)
{
oPicklist.Lines.SetCurrentLine(i);
oPicklist.Lines.PickedQuantity = pickedQtyLine0; // 5000 for pickline 0
for (int j = 0; j < MatrixCellBinAbsEntry.Count; j++)//every bin location
{
if (j > 0)
oPicklist.Lines.BinAllocations.Add(); // add new binalloc line
oPicklist.Lines.BinAllocations.BinAbsEntry = MatrixCellBinAbsEntry[j]; // Set bin AbsEntry
oPicklist.Lines.BinAllocations.Quantity = MatrixCellQuantity[j]; //Set bin Quantity
}
}
if (oPicklist.Update() != 0)
{
MessageBox.Show("Error " + SBO_Company.GetLastErrorDescription());
}
else
MessageBox.Show("Success");
In your code you don't add new bin allocation lines.
Be aware that there is more checking needed and that there are a lot of problems in earlier patchlevels handling picklists via SDK.
regards,
Maik
Hi Maik, your code works perfectly! but I have some additional problem. When I update other article I mean this picking list has other lines with other articles, this give me this error.
1470000341 - The article "0102-0380200-00" is not fully allocated to the location" 02
The item has quantities in warehouse. What can be wrong in my code.
Regards.
Hi Pable,
this error means, that the numbers didin't add up.
Every pickline has a picked quantity ( example 5000 ) - now all BinAllocations lines have a quantity ( 4500,250,250 ) -> normally this is not adding up and the error message is given.
Just make sure the numbers are working...
regards,
Maik
User | Count |
---|---|
99 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.