cancel
Showing results for 
Search instead for 
Did you mean: 

How to find the DocEntry of a new Invoice?

malcolm-weller
Explorer
0 Kudos
592

I can create an invoice using the DI API SAPbobsCOM ok but can anyone tell me how to obtain the unique reference number [DocEntry] of the new OINV record?

After oInvoice.Add it would be nice if oInvoice.DocEntry were set so that I could retrieve it, but it is not.

Thanks for any help offered.

Mal.

rahuljain257
Participant
0 Kudos

As @Nagarajan k pointed out - You needed to query the table and get the doc Entry on the basis of your document number order by created date desc.

The document number you will get it from your diApi method.

malcolm-weller
Explorer
0 Kudos

I was hoping that oCompany.GetNewObjectCode(DocEntry) would return the new OINV.DocEntry value into my DocEntry variable but unfortunately it returns the value BEFORE the one just created. E.g. my code generates OINV.DocEntry=1000 but GetNewObjectCode returns 999.

My code is;

Set OINV = oCompany.GetBusinessObject(13)
RetVal = OINV.Add
OINV.DocNum = DocNum
OINV.Lines.ItemCode = ItemCode
OINV.Lines.Add
RetVal = OINV.Add
oCompany.GetNewObjectCode(DocEntry)

Am I using GetNewObjectCode incorrectly?

Thanks,

Mal.

Accepted Solutions (0)

Answers (3)

Answers (3)

malcolm-weller
Explorer
0 Kudos

Hi Nagarajan,

Yes, I am looking for OINV.DocEntry.

The reason is that I want to retain it in an external system for easy access to the Invoice when payments come through (minutes to months later). Unless you can tell me a better way to do this?

Thanks,

Mal.

msundararaja_perumal
Active Contributor
0 Kudos

Hello,

For SQL Server:

Usually you may use the incremental value from the last docentry. But this may not be the case when multiple document numbering series is used, as you have to validate against the current document series being used for the next no. to be generated.

For HANA:

If are still using the previous versions for HANA, the docentry is very much random and it was fixed in the later versions of HANA revisions. In HANA too if the multiple document numbering series is used you need to consider the current document's numbering series.

Thanks.

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Are you looking for OINV.DocEntry?

Regards,

Nagarajan