Code to create General Journal X++ (Dynamics AX 2012)
This post is mainly to guide you on how to use ledger dimension in AX 2012.
static void legerDimCreateGLJournal(Args _args)
{
AxLedgerJournalTable journalTable;
AxLedgerJournalTrans journalTrans;
container accCon;
container offSetCon;
;
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("GenJrn");
journalTable.save();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmAccountType(LedgerJournalACType::Ledger);
//LedgerDimension => Ledgeraccount, DAX 2009
accCon = ["500200", "500200", 0];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(accCon));
journalTrans.parmAmountCurDebit(2000);
//OffsetLedgerDimension => OffsetLedgerAccount, DAX 2009
offSetCon = ["500300", "500300", 0];
journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );
journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetCon));
journalTrans.save();
info(strFmt("Journal %1 created", journalTable.ledgerJournalTable().JournalNum));
}
How to post with Financial dimensions:
Format :
["DisplayValue", "MainAccount", NumberOfDimensions, "DimensionName", "DimensionValue"];
E.g:
accCon = ["500200-Invent", "500200", 1, "Department", "Admin_1"]
AxdDimensionUtil::getLedgerAccountId(accCon)
No comments:
Post a Comment