Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

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

replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question