How to get Sales Order Number for a given Invoice Number...

SOLVED

I'm trying to figure out how to relate Sales Order Number to Invoice Number in the data (for extract and reporting). There is a screen in the front-end that does this titled "Sales - Looking up Invoice xxxxxxx". It shows both the Invoice Number and the Sales Order number at the top right, so I know there's a way to relate these two, but I can't find it in the DataDict or by looking through the tables.

There is a way that *almost* works:

titrec to titlu via sSource=sSource1 (which contains the Invoice Number), then titlu to tsalordr via sPONum=sSONum (which contains the Sales Order number).

This works much of the time, but not always. There is a specific Invoice number I've looked up in the front-end which shows me the Invoice Number and Sales Order number, but that same Invoice Number doesn't exist in titrec.sSource (nor does the corresponding SO Number exist in titlu.sPONum), so my approach above doesn't find a match. Sage must be using something else to relate these two, but I don't know what it is.

Does anyone know the "official" way to do this?