Create and post General Ledger journal with financial Dimensions Value using X++

Hello!,

I am using Ax2012.

I am trying to create and post general ledger journal with financial dimensions Value but i am getting an error as Financial dimension value does not exist.

I Have given my code please help me solve the issue.

static void LearningGeneralJournal(Args _args)
{
    AxLedgerJournalTable    journalTable;
    AxLedgerJournalTrans    journalTrans;
    container               acctPattern;
    container               offSetAcctPattern;
    LedgerJournalTable      ledgerJournalTable;
    LedgerJournalTrans      ledgerJournalTrans;
    ledgerJournalCheckPost  ledgerJournalCheckPost;
    
    journalTable = new AxLedgerJournalTable();
    journalTrans = new AxLedgerJournalTrans();

    //Journal Name
    journalTable.parmJournalName("GenJrn");
    journalTable.save();
    journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
    journalTrans.parmTransDate(systemDateGet());
    journalTrans.parmCurrencyCode("USD");
    journalTrans.parmAmountCurDebit(200);
    journalTrans.parmAccountType(LedgerJournalACType::Ledger);
    acctPattern = ["420100", "420100",2,"Agreement","OU_3566","Training"];
    journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern)); 
    journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );
    offSetAcctPattern = ["0101", "0101",0,"00000036","OU_3566","Training"];
    journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offSetAcctPattern));
    journalTrans.save();

    ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
    ledgerJournalCheckPost.run();


    info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));
   }

I couldnt able to find the financial dimension value.

Thanks.

What error you are getting?

Financial dimension value OU_3566 does not exist.

Can you explain your pattern, offSetAcctPattern = [“0101”, “0101”,0,“00000036”,“OU_3566”,“Training”];

Please refer this,

blogs.msdn.microsoft.com/…/

0101- is the display value
0101- MainAccount
00000036 - dimensionAttribute Name
OU_3566 - dimensionAttribute Value

The same as like what u have sent in the link if i give the values in the link I am getting the error in the value “country”

That is an example, country could be the attribute name.

Have you checked if the dimension value is valid? General ledger → setup - financial dimensions

Hey thanks I just checked the dimension value . For agreement there is no dimensional value.I changed and it is working properly .
Thank you so much for your help.