cancel
Showing results for 
Search instead for 
Did you mean: 

How to create an "Inventory Transfer" from an "Inventory Transfer Request" ?

leon_laikan
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

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

leon_laikan
Participant
0 Kudos

Hi Maik,

I have tried your suggestion, and it works fine!

For Base Type, I used the foll. code which works:

oWTR.Lines.BaseType = InvBaseDocTypeEnum.InventoryTransferRequest

It does not work if I use:

oWTR.Lines.BaseType = 1250000001

Thanks a lot for your support.

Best Regards,

Leon

Answers (0)