on 10-09-2006 8:23 AM
I'm having a problem using the V6.7 DI SDK with VB 6.
My code loops through a collection, creating stock transfer entries in SAP BO. The User requirement is to add detail lines to the stock transfer until the from warehouse code changes after which a new stock transfer is created for all items originating from this warehouse, etc.
So I have declared a stock transfer object:
Private SAPStockTransfer As SAPbobsCOM.StockTransfer
Set SAPStockTransfer = SAPCompany.GetBusinessObject(oStockTransfer)
After which I set the appropriate properties of the stock transfer object and add the stock transfer lines as appropriate.
When the warehouse changes I firstly call the add() method of the stock transfer object then I reset the stock transfer object as follows:
Set SAPStockTransfer = Nothing
Set SAPStockTransfer = SAPCompany.GetBusinessObject(oStockTransfer)
The problem is at this stage, the SAPStockTransfer is not re-initialized, as I would have expected, but persists the previously held values.
Am I doing something wrong?
Hi Marinos,
Try calling the garbage collector before re-inistialising the Objects.
Try this:
Set SAPStockTransfer = Nothing
GC.Collect
Set SAPStockTransfer = SAPCompany.GetBusinessObject(oStockTransfer)
If this doesn't work try passing the parameters of the stock transfer into a procedure that will create the Stock Obj, instanciate it, do the stock transfer and the kill the stock obj
<b>
(Set SAPStockTransfer = Nothing
GC.Collect)</b>
Call this procedure for each transfer. This must work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to use:
System.Runtime.InteropServices.Marshal.ReleaseComObject(SAPStockTransfer)
instead of:
Set SAPStockTransfer = Nothing
Hope this helps.
Dulce.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Marinos,
I think there is no problem with the idea, setting the object variable into Nothing. Why don't you try to declare it as Dim SAPStockTransfer As SAPbobsCOM.StockTransfer if you are not using it globally in a module. Hope this helps...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
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.