cancel
Showing results for 
Search instead for 
Did you mean: 

Creating delevery notes in SAP SDK

Former Member
0 Kudos

Hi,

Can anyone tell me how to create Delevery Notes and Invoice Based on Sales Order using DIAPI .

regards,

Chaminda ratnayake

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chamnida,

There is an example called '05.OrderAndInvoice' from SDK Samples. I coped function from that example. You same logic to created Deliver Note also.

Private Sub CreateInvoice()

' init the invoice object

oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)

oInvoice.CardCode = cmbCustomer.Text

Dim sNewObjCode As String

Dim i As Integer

' Get last added document number (the order that was added)

oCompany.GetNewObjectCode(sNewObjCode)

' this loop adds the different items to the invoice object

i = 0

Do

oInvoice.Lines.BaseEntry = sNewObjCode

oInvoice.Lines.BaseLine = i

oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders

oInvoice.Lines.TaxCode = TableLines.Rows(i).Item(4)

i += 1

If i <> TableLines.Rows.Count Then

oInvoice.Lines.Add()

End If

Loop Until i = TableLines.Rows.Count

' Try to add the invoice object to the database

lRetCode = oInvoice.Add()

If lRetCode <> 0 Then ' If the addition failed

oCompany.GetLastError(lErrCode, sErrMsg)

MsgBox(lErrCode & " " & sErrMsg) ' Display error message

Else

cmdInvoice.Enabled = True

MsgBox("inv Added to DataBase", MsgBoxStyle.Information, "Order Added")

End If

End Sub

HTH

B Ravi Shankar

Answers (0)