Link Geneal Journal to Vendor Transaction

I have linked the tables General Journal Entry to General Journal Account entry.

I am now trying to link the table GeneralJournaltEntry to VendTrans to retrieve the invoice and account number. I have joined on the field

GENERALJOURNALENTRY.SUBLEDGERVOUCHER = VENDTRANS.VOUCHER

This join will not work as there may be several different invoices or account numbers in VENDTRANS.

Please can anyone advise how I can get the invoice and account number from the GL tables.

Thanks

It will return all the invoices(that matches your criteria) as you are not mentioning any other criteria.
Do you want to get invoices related to a specific order or voucher number or posting date…? Please be specific.
Note - You may have to consider the voucherDataAreaId.

Apologies, I am not familiar with the data but I think it will be by order.

I need to link the following query to vendtrans to get the invoice for each order. I cannot find the field voucherdataareaid

SELECT GJE.JOURNALNUMBER,GJE.SUBLEDGERVOUCHER FROM GENERALJOURNALACCOUNTENTRY GJAE
INNER JOIN GENERALJOURNALENTRY GJE ON
GJAE.GENERALJOURNALENTRY = GJE.RECID

Thanks

You need to join vendTrans
VendTrans.Voucher == GJE.SUBLEDGERVOUCHER
vendTrans.DataAreaId == GJE.SubledgerVoucherAreaId

Thanks, but I don’t think this join is what is required.

We have a voucher (voucher A) in the VENDTRANS record that contains several records. The voucher has different invoices in each record. I need to be able to link the specific record from General Ledger to the specific record in Vend Trans.

If you have multiple invoices on same voucher, you may not exactly flow back from generalJournalEntry tables to the related vendTrans. You need to rethink about your implementation.
What exactly is your main requirement, so that we may think about the alternatives…