relation bw CustTrans,LedgerTrans tables (AX2009)

hello all,
good day.
In my requirement I need to display Ledger Accounts from LedgerTrans table wrt to CustTrans table
I’m bit confuse how the fields LedgerTransType ,LedgerPostingType fields populated in Ledger trans table
Let’s have a look on the tables

  1. CustTrans table

AccountNum(CustAccount)

Voucher

AmountMst

TransType(LedgerTransType)

Customer_1

V1

100

Exchange adjustment

Customer_1

V2

200

Sales order

2) LedgerTrans table


Voucher

AccountNum(LedgerAccount)

AmountMst

Posting(LedgerPostingType)

TransType

V1

AcNum1( Posting profile for the cust group )

100

Exchange rate profit



V1

AcNum2 (Exchange rate profit account)

-100

Exchange rate profit



V2

AcNum1

300

Customer balance

Sales order

V2

AcNum3

-300

Sales order revenue

Sales order

Outpoot should be like this


Customer_1

V1

100

Exchange adjustment

AcNum2

Customer_1

V2

200

Sales order

AcNum3

could you please share your experience to solve this.

How do you decide that you want to shown AcNum2 and AcNum3 and not AcNum1? What about additional transactions, such as for taxes?

we can do this by credit(CustTrans),Debit(LedgerTrans Account num) and vice versa . I think so. may be i’m wrong…

as one of my client request we did like this…

I f(custTrans.TransType == LedgerTransType::Sales)

{

select _ledgerTrans where _ledgerTrans.TransDate == custTrans.TransDate

&& _ledgerTrans.Voucher == custTrans.Voucher

&& _ledgerTrans.Posting == LedgerPostingType::SalesRevenue;

_accountNum = LedgerTable::find(_ledgerTrans.AccountNum).AccountNum;

}

else if(custTrans.TransType == LedgerTransType::Tax)

{

_accountNum = ‘’;

}

else if(custTrans.TransType == LedgerTransType::ExchAdjustment)

{

_ledgerTrans = LedgerTrans::findVoucherDate(custTrans.Voucher, custTrans.TransDate);

if (_ledgerTrans.Posting == LedgerPostingType::ExchRateGain)

_accountNum = Currency::accountProfit(_ledgerTrans.CurrencyCode);

else

_accountNum = Currency::accountLoss(_ledgerTrans.CurrencyCode);

}

like this I need all possible scenarios…

I think if we find out how the fields LedgerPostingType,LedgerTransType populated in these tables, then we may be map these tables in some scenarios…

Could you please guide me how to find out the fields (LedgerPostingType,LedgerTransType) populated in ledgerTransTable

The easiest way to find where is a field is populated is checking its cross-references and filtering by Reference = Write.

I did the same …

I found below piece of code in different classes…

fieldnum(LedgerTrans, Posting),

ledgerTrans.Posting == LedgerPostingType::VAT_IN)

_ledgerTrans.Posting == LedgerPostingType::None

this.Posting == LedgerPostingType::TransferOpeningClosing

_ledgerTrans.Posting == LedgerPostingType::PaymentFee

But in my scenario I need to find the piece of code as below.

i.e like ledgerTrans.Posting = LedgerPostingType::PaymentFee

if you show the standard code in Axapta where it is populated, it would be helpful…

Thanks,

krishna