cancel
Showing results for 
Search instead for 
Did you mean: 

DI - Creating an invoice based on a delivery

Former Member
0 Kudos

What's the easiest way of creating an invoice based on a delivery? Is there a method in the SAPbobsCOM.Documents object that I can use to convert, or do I need to create two document objects and copy the value of each property accross?

I noticed the DI SDK help mentions a .Net code sample called "Order and Invoice" but I don't seem to have it install - can anyone tell me where I can download thing from?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

barend_morkel2
Active Contributor
0 Kudos

Trinidad is right,

and the project you are looking for would be in:

C:\Program Files\SAP Manage\SAP Business One SDK\Samples\COM DI\VB.NET\05.OrderAndInvoice

Former Member
0 Kudos

I don't have these sample files installed and neither does someone else who I've asked. Does this mean we have the wrong version of the DI SDK installed?

Are the samples not available online anywhere?

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jon,

You should have a CD with the SDK Development version on it. If you install the DI that is in this CD on Customer Mode you will see that you have the DI Help files, DI Samples, UI Help files,....

In SDN there are some samples on the main Business One page, but the one you are asking for is not there.

Here you have the code to create the Invoice from an existent Order:

oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)

oInvoice.CardCode = CustomerCode

'If you added your order in the same command just before you can use oCompany.GetNewObjectCode() to obtain the doc entry of your order

' for each invoice line to link to the order line

oInvoice.Lines.BaseEntry = OrderDocEntry

oInvoice.Lines.BaseLine = i 'Line number on the order

oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders

oInvoice.Lines.Add()

' 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)

End If

Regards

Trinidad.

Former Member
0 Kudos

Thanks Trinidad that works great.

Answers (1)

Answers (1)

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jon,

If you have the SDK DI API Development version installed you should have a directory called samples including all the SDK samples (DI API, UI API, DI Server,...). Just in the same directory as your SDK help files.

Please have a look to your SDK installation CD, it should be there.

Regards

Trinidad.