Skip to Content
author's profile photo Former Member
Former Member

Out of stock with 500 lines.

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 21, 2009 at 07:58 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 24, 2009 at 04:04 AM

    Please refer to the following thread for performance tips.

    Optimizing Matrix Drop down List

    Kind Regards, Yatsea

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.