cancel
Showing results for 
Search instead for 
Did you mean: 

generating sales order through DI

former_member209699
Contributor
0 Kudos

Hi,

I want to know how do I know that what is the docentry or docnum for the sales order that I added trrough DI API by using my own screen.

I am using UDT not UDO.

regards:

Sandeep Saini | Roorkee | India on Nov 20, 2008 4:07 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sandeep,

You can get the DocEntry of the document you have just added by calling "GetNewObjectKey" on the company object after adding the document:

Private Sub GetNewKey()
    
    Dim oOrder As SAPbobsCOM.Documents
    Set oOrder = oCompany.GetBusinessObject(oOrders)
    
    oOrder.CardCode = "C1000"
    oOrder.DocDueDate = DateTime.Now
    oOrder.Lines.ItemCode = "A1000"
    lRetCode = oOrder.Add()
    
    Dim test As String
    test = oCompany.GetNewObjectKey
                                                                     
    If lRetCode <> 0 Then
            oCompany.GetLastError oError, errMsg
            MsgBox (oError & " " & errMsg) ' Display error message
    Else
            MsgBox "Order Added."
     End If
End Sub

Regards,

Niall

SAP Business One Forums

former_member209699
Contributor
0 Kudos

Thanks.

You deserved the full point as my little problem is now solved.