on 08-21-2009 6:40 PM
Good afternoon,
The problem is this I'm trying to create an outlet of inventory (oInventoryGenExit) of 500 items with SAP Business One 2007 pl 44, but create takes a long time, about 30 to 35 minutes. This same thing to SAP Business One 2005A pl 18 in 3 or 4 minutes. Someone knows why this happen. Here is the code.
Dim oMovInventario As SAPbobsCOM.Documents
strInf = " SELECT TOP(500) T0.ItemCode,T2.Quantity,T1.AvgPrice,T0.DfltWH,T2.BatchNum,T0.ItemName FROM OITM T0,OITW T1, OIBT T2 strInf += " WHERE(T2.Quantity > 0) AND T0.ItemCode = T1.ItemCode AND T0.DfltWH = T1.WhsCode AND T0.Canceled = 'N' AND T0.ItemCode = T2.ItemCode AND T0.DfltWH = T2.WhsCode AND T0.ItemCode NOT IN (SELECT U_BPV_COAR FROM ) ORDER BY AvgPrice desc"
oLocalInf = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oLocalInf.DoQuery(strInf)
If oLocalInf.EoF = False Then
oMovInventario = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit)
oMovInventario.DocDate = Pappl.Company.ServerDate
oMovInventario.DocDueDate = Pappl.Company.ServerDate
oMovInventario.TaxDate = Pappl.Company.ServerDate
oMovInventario.UserFields.Fields.Item("U_BPV_CAMO").Value = "931"
oMovInventario.JournalMemo = "Ajuste de Inventario Total"
oMovInventario.Comments = " Salida de Mercancía de Inventario"
oMovInventario.UserFields.Fields.Item("GroupNum").Value = 1
oMovInventario.Comments = "Salida de Mercancia"
p = 1
Do While oLocalInf.EoF = False
If oLocalInf.Fields.Item("AvgPrice").Value > 0 Then
oMovInventario.Lines.ItemCode = oLocalInf.Fields.Item("ItemCode").Value
oMovInventario.Lines.WarehouseCode = oLocalInf.Fields.Item("DfltWH").Value
oMovInventario.Lines.UserFields.Fields.Item("U_BPV_FRAC").Value = "0"
oMovInventario.Lines.Quantity = oLocalInf.Fields.Item("Quantity").Value
oMovInventario.Lines.BatchNumbers.Quantity = oLocalInf.Fields.Item("Quantity").Value
oMovInventario.Lines.BatchNumbers.BatchNumber = oLocalInf.Fields.Item("BatchNum").Value
oMovInventario.Lines.UserFields.Fields.Item("U_BPV_UNME").Value = "UN"
oMovInventario.Lines.Price = oLocalInf.Fields.Item("AvgPrice").Value
If p < oLocalInf.RecordCount Then
oMovInventario.Lines.Add()
End If
End If
p += 1
oLocalInf.MoveNext()
Loop
System.Runtime.InteropServices.Marshal.ReleaseComObject(oLocalInf)
ret = oMovInventario.Add()
If ret Then
Exit Function
End If
End If
Thank you very much for the help.
Edited by: Alejandro Araujo on Aug 21, 2009 7:49 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From other users' posting, you are not alone. I believe this is due to old UDF carried from the previous data structure. If possible, you may export all UDF values to a file and recreate those UDF and reimport data by DTW. Try it in your test environment to see if it can help or not.
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
10 | |
9 | |
5 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.