Tuesday 6 February 2018

LedgerDimension for newly created Customer or Vendor

There are plenty of blogs which shows how to create/merge ledgerDimension for ledgerAccount. 

But the issue is with Vendor or Customer account.

And...
There are plenty of blogs which describes how to import transactions to ledger journal for customer's or vendor's transactions.

But, the problem is, when customer account or vendor account is just created, there where no transactions posted yet for that account in ledger journals.
In such case there is no record in  DimensionAttributeValueCombination.
Such record is created automatically when user creates a record in LedgerJournalTrans with such Customer or Vendor account. Even without posting.

So, how to create an entry for that table for Customer or for Vendor from X++?
Because we need that to import transactions, and without asking users to put 

We need a recId to use it in multitype account in ledger journal

DimensionStorage::accountNum2LedgerDimension(vendTable.AccountNum, LedgerJournalACType::Vend); 

or

DimensionStorage::accountNum2LedgerDimension(custTable.AccountNum, LedgerJournalACType::Cust); 

Those examples are returning recId for such ledgerDimension , ready to use

For example

ledgerJournalTrans.ledgerDimension = DimensionStorage::accountNum2LedgerDimension(custTable.AccountNum, LedgerJournalACType::Cust); 

or if you want to have it  done better

AxLedgerJournalTrans                trans;

trans.parmLedgerDimension(DimensionStorage::accountNum2LedgerDimension(custTable.AccountNum, LedgerJournalACType::Cust));

Enjoy

No comments:

Post a Comment