on 05-26-2015 8:44 AM
Hi, everybody
I want to create an Inventory Transfer (IT) from its Inventory Transfer Request (ITR) using DI API.
I have 2 related problems:
(1) The foll. fields link the IT with its ITR:
In ITR, it is DocEntry.
In IT, it is BaseRef.
So, I have to insert the value of ITR.DocEntry into IT.BaseRef.
I used the foll. SDK command:
oOWTR.Lines.BaseRef = 101
But it seems that the field name is invalid.
See the picture and code below.
What is the correct field name to use?
(2) I wish to close the ITR once its requirements have been fulfilled.
(i.e change its DocStatus from "O" to "C")
How can we achieve this?
Do we have to create an Action Query to modify DocStatus?
I know this is forbidden.
So, how can we do this safely with SDK?
Thanks
Leon Lai
---------------------------------------------------------------------------------------
Dim oOWTR As SAPbobsCOM.StockTransfer = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer)
oOWTR.DocDate = Date.Today()
oOWTR.FromWarehouse = "MAIN"
oOWTR.Lines.ItemCode = "DAIRY006"
oOWTR.Lines.WarehouseCode = "AB009"
oOWTR.Lines.ProjectCode = "AB009"
oOWTR.ToWarehouse = "AB009"
oOWTR.Lines.Quantity = 1000
oOWTR.Lines.BaseRef = 101 ' << This field name is invalid
If oOWTR.Add = 0 Then
SBO_Application.MessageBox("Inventory transfer Added!!")
Else
SBO_Application.MessageBox(oCompany.GetLastErrorDescription)
End If
Hi Leon,
you don't have to set 'BaseRef'. You need to fill following fields :
oOWTR.Lines.BaseType
oOWTR.Lines.BaseEntry
oOWTR.Lines.BaseLine
This is doing the linking. And you don't have to worry about closing the document. It is done automatically when all lines are copied ( SBO standard behaviour ).
If you don't copy all lines you and therefor the ITR stays open, you can use oOWTR.Close() to close the document.
regards,
Maik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
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.