Skip to Content
author's profile photo Former Member
Former Member

Created purchase order based in drafts

I need help, I want to create purchase order based in drafts.

Has somebody any sample in SDK??


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2006 at 09:12 AM

    Hi Santiago,

    Please see your Help Filesprovided with the SDK:

    DI-API > Reference > Overview > Objects > Documents. Below on that page you'll find a nice link to the sample below. Replace the <i>vDrafts.DocObjectCode = oInvoices</i> with order and you're set.

    Hope it helps,


    <b>Code (VB from the Help File)</b>

    Sub AddInvoice_Click()
        Dim RetVal As Long
        Dim ErrCode As Long
        Dim ErrMsg As String
        'Create the Documents object
        Dim vDrafts As SAPbobsCOM.Documents
        Set vDrafts = vCmp.GetBusinessObject(oDrafts)
        'Set values to the fields
        vDrafts.DocObjectCode = oInvoices
        vDrafts.CardCode = "BP234"
        vDrafts.HandWritten = tNO
        vDrafts.DocDate = "21/8/2003"
        vDrafts.DocTotal = 264.6
        'Invoice Lines - Set values to the first line
        vDrafts.Lines.ItemCode = "A00023"
        vDrafts.Lines.ItemDescription = "Banana"
        vDrafts.Lines.Quantity = 50
        'Invoice Lines - Set values to the second line
        vDrafts.Lines.ItemCode = " A00033"
        vDrafts.Lines.ItemDescription = "Orange"
        vDrafts.Lines.Quantity = 1
        'Add the Invoice
        RetVal = vDrafts.Add
       'Check the result
        If RetVal <> 0 Then
            vCmp.GetLastError ErrCode, ErrMsg
            MsgBox ErrCode & " " & ErrMsg
        End If
     End Sub

    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.