cancel
Showing results for 
Search instead for 
Did you mean: 

OINV.Canceled base reference

0 Kudos

Good afternoon experts,


I have several canceled invoices, when I query my database their canceled value is 'Y'

There are also several which value is 'C'.

I know they are related, the original should be 'Y' and the canceled should be 'C' but how can I find out the base reference?

For example, the original has a DocEntry = 522 and the Canceled has a DocEntry = 300303. I saw the comments and sometimes it shows "based on document..." but sometimes my client enters some other information.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member225732
Contributor

Dear Luis Alfredo Matute Ochoa,

Please ref below query done for AP Invoice, you can do it for any transactions:

SELECT T0.DocEntry,T0.[DocNum] as "Cancelled DocNum", T1.[BaseRef]as "Suceeding DocNum" FROM OPCH T0 INNER JOIN PCH1 T1 ON T0.[DocEntry] = T1.[DocEntry] WHERE T0.[CANCELED] = 'Y' and T1.[BaseType] =20

Best Regards,

Sandesh Shinde

agustin_marcoscividanes
Active Contributor
0 Kudos

Hi

you have to use the document lines, and in the database is the table INV1 and the fields you have to use are tgrtentry and doctype.

Kind regards

Agustín