Skip to Content
author's profile photo
Former Member

Create a Invoice based in a Order

How can I create a Invoice using the object Documents?.

If I have a Document of a Order and i want copy these Order in a Invoice.

I don't want copy field to field.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 28, 2005 at 07:33 AM

    Hi Santiago!

    You can find a good sample how to create docs based on other at ..\SAP Business One SDK\Samples\COM DI\VB.NET\5.OrderAndInvoice\

    <i>Message was edited by: Alexey Grebennikov

    OrderAndInvoice-sample will give you the same what Ibai has told you, i suppose you must not learn it, but should to.. :)</i>

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 28, 2005 at 07:27 AM

    Hi Santiago,

    You should set the values for the fields BaseEntry BaseLine and BaseType for the invoice lines.

    Here you have an example:

    Public Sub baseDocument()
        Dim oinv As SAPbobsCOM.Documents
        Set oinv = sbocompany.GetBusinessObject(oInvoices)
        oinv.CardCode = "CardCode001"
        oinv.DocDueDate = Now
        oinv.Lines.BaseEntry = 105
        oinv.Lines.BaseLine = 0
        oinv.Lines.BaseType = 17
        oinv.Lines.BaseEntry = 105
        oinv.Lines.BaseLine = 1
        oinv.Lines.BaseType = 17
        ret = oinv.Add
        If ret <> 0 Then
            sbocompany.GetLastError ret, errStr
            sboappl.MessageBox ("Error creating the invoice " & ret & " " & errStr)
            sboappl.MessageBox ("Invoice created")
        End If
    End Sub

    Hope helps,

    Ibai Peñ

    Add comment
    10|10000 characters needed characters exceeded