I'm working on a report where i have to display information about vendor invoices, one of the requirements is to display related ledgeraccount for pending invoices. So i figured out that this info is im table subledgerjournalaccountentry or subledgerjournalentry. The thing is i can't figure out how to get the ledgeraccount starting from table vendinvoiceinfo table.

The only clue i got that i have to use the sourcedocument header or sourcedocumentline fields and from there probably go to accountingdistribution. I figured this out through excessive debugging of the form subledgerjournalaccountentry but the datasource is a tmp table (subledgerjournalaccountentrytmptable).

Any idea what i'm missing here?

Thanks in advance.