I got the field I was looking for.
The TransId field is available in all the transaction tables, and it keeps increasing whenever you add any transaction like AP Invoice, AR Invoice, etc.
Suppose the last trans id is 100
Now if you make AP Invoice, the AP Invoice and its JE will both get Trans Id 101.
Next If you make AR Invoice, the AR Invoice and its JE will both get Trans Id 102.
Next if you make a manual Journal Entry, it will get Trans Id 103.
This is the true sequence of entry, not the Creation Date which is based on System Date which can be changed.
The following query works:
SELECT DocDate AS PostingDate, 'AP Invoice' AS TransType, DocEntry, DocNum, CreateDate, TransId FROM OPCH
UNION
SELECT DocDate AS PostingDate, 'AR Invoice' AS TransType, DocEntry, DocNum, CreateDate, TransId FROM OINV
UNION
SELECT DocDate AS PostingDate, 'Incoming Payment' AS TransType, DocEntry, DocNum, CreateDate, TransId FROM ORCT
UNION
SELECT DocDate AS PostingDate, 'Outgoing Payment' AS TransType, DocEntry, DocNum, CreateDate, TransId FROM OVPM
UNION
SELECT RefDate as PostingDate, 'Journal Entry' AS TransType, Number as DocEntry, Number as DocNum, CreateDate, TransId FROM OJDT
ORDER BY TransId DESC
It will display all the transactions (you can add UNIONs for other tables).
If you want to avoid displaying 2 rows: one for the original document and one for the Journal Entry,
you can add WHERE clause for OJDT table.
However, if I add the OPOR table in the UNION, the Trans Id column is NULL in all the rows in OPOR table.
So the sequence will display only those transactions which have an associated Journal Entry.
There seems to be no way to display all transactions (including those which do not create Journal Entry) in sequence.
If so, then the above query can be simply reduced to a simple Select query on OJDT table ordered by TransId, where we can display the type of the original document , i.e. whether AP Invoice or AR Invoice or Incoming Payment, etc.
If there is any solution to display Purchase Orders, Sales Orders and other transactions in the sequence of entry, it will be appreciated.
Thanks.