cancel
Showing results for 
Search instead for 
Did you mean: 

Get DocNum of last approved invoice added in addon

kinyanjui_kamau
Participant
0 Kudos
117

I have an addon running and I am trying to get the last DocNum of an approved invoice in SAP B1.

For example if 2 invoices have been approved, the DocNums show to be the same once approved but before that are added as documents.

I use the query below to fetch the last DocNum:

rs.DoQuery("SELECT MAX(T0.\"DocNum\") AS \"DocNum\" FROM OINV T0 INNER JOIN NNM1 T1 ON T0.\"Series\" = T1.\"Series\" WHERE T0.\"BPLId\" = '" + branch + "'");
rs.MoveFirst();

The problem with this is that it returns the same document number for the 2 invoices that I add back to back.

Is there a way to get the just added document in SDK. Invoices are not being added through the addon, they are added through the regular add button but I need to catch the proper Document Number just added.

Accepted Solutions (0)

Answers (0)