Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

  • Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.