Skip to Content
author's profile photo
Former Member

Creating delevery notes in SAP SDK

Hi,

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

regards,

Chaminda ratnayake

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    author's profile photo
    Former Member
    Posted on Sep 28, 2007 at 06:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded