cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create AP Invoice from PO using SDK

RamBilasYadav
Participant
0 Kudos

Hi,

I want to create an A/P Invoice thru SDK for which already the Purchase Order has been entered thru the front-end. How to do it? Using SBO objects I am loading the particular PO. But after that how to transfer everything in the PO to AP Invoice.

Thanx in advance.

with regards,

Ram.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member185703
Active Contributor
0 Kudos

Hi Ram,

You could check out e.g. this SDK sample:

C:\Program Files\SAP\SAP Business One SDK\Samples\COM DI\VB.NET\05.OrderAndInvoice ... in case you installed the SDK package (i.e. helpfiles & samples etc.)

Regards,

Frank

RamBilasYadav
Participant
0 Kudos

Hi Frank,

Thanx.

Which version are you using? I am using 2004 .2.B. I am not having that folder which you have mentioned. Can you please mail it to my id ram.yadav@coconut.co.in

With Regards,

Ram.

former_member185703
Active Contributor
0 Kudos

Hi Ram,

Please note that the SDK package is part of the product installation package from 2005A on.

If you are a SAP Business One partner you should be able to download it from SAP Servicemarketplace, - or am I wrong?

Regards,

Frank

Former Member
0 Kudos

Hi Ram,

Herewith an example:

        oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseInvoices)
        oPOrder.GetByKey(sOrder)
        oInvoice.CardCode = oPOrder.CardCode
        oInvoice.CardName = oPOrder.CardName
        oInvoice.Address = oPOrder.Address
        oInvoice.Address2 = oPOrder.Address2
        oInvoice.AgentCode = oPOrder.AgentCode
        oInvoice.Comments = oPOrder.Comments
        oInvoice.ContactPersonCode = oPOrder.ContactPersonCode
        oInvoice.DocDate = oPOrder.DocDate
        oInvoice.DocDueDate = oPOrder.DocDate
        oInvoice.FederalTaxID = oPOrder.FederalTaxID
        oInvoice.JournalMemo = "Based on Sales Order " & sOrder
        oInvoice.NumAtCard = oPOrder.NumAtCard
        oInvoice.Project = oPOrder.Project
        oInvoice.Reference1 = oPOrder.Reference1
        oInvoice.Reference2 = oPOrder.Reference2
        oInvoice.SalesPersonCode = oPOrder.SalesPersonCode
        oInvoice.SummeryType = oPOrder.SummeryType
        For i = 0 To oPOrder.Lines.Count - 1
            oPOrder.Lines.SetCurrentLine(i)
            If i > 0 Then
                oInvoice.Lines.Add()
            End If
            oInvoice.Lines.BaseEntry = oPOrder.DocEntry
            oInvoice.Lines.BaseLine = oPOrder.Lines.LineNum
            oInvoice.Lines.BaseType = 22
        Next
        If oInvoice.Add() <> 0 Then
            oApplication.MessageBox("Error: " & oCompany.GetLastErrorDescription)
        End If
        System.Runtime.InteropServices.Marshal.ReleaseComObject(oInvoice)

Hope it helps,

Adele

RamBilasYadav
Participant
0 Kudos

Hi Adele,

Thanx for the code.

Actually I want to load from the Purchase order to the A/P Invoice on the screen. that is, it should give me the same effect of selecting the Purchase Order in the AP Invoice screen and then clicking the Copy All option. Am I clear? I dont want to do the whole conversion thru the code. I want to trigger the copying of Purchase Order into the AP Invoice in the front end.

With Regards,

Ram.