error CIL when create ledger journal using X++


I have an error like picture below when Create ledger Journal using Code X++

can you help me ?

Will you be able to show us your code to create journal?


select firstOnly numberSeqTable
where numberSeqTable.RecId == ledgerJournalName.NumberSequenceTable;

/select RecId from mainAccount
join dimensionAttributeValueCombination
where mainAccount.RecId == dimensionAttributeValueCombination.MainAccount
&& mainAccount.MainAccountId == account_get;

if (get_journal_entry != journalentry)
numberSeq = numberSeq::newGetVoucherFromCode(numberSeqTable.NumberSequence);
ledgerJournalTrans.Voucher = numberSeq.voucher();
get_voucher = ledgerJournalTrans.Voucher;

ledgerJournalTrans.Txt = refrence;
get_journal_name = ledgerJournalTrans.Txt;
ledgerJournalTrans.LedgerDimension = 5637153681;
//ledgerJournalTrans.LedgerDimension = mainAccount.RecId;

ledgerJournalTrans.Voucher = get_voucher;
ledgerJournalTrans.Txt = get_journal_name;
//ledgerJournalTrans.LedgerDimension = mainAccount.RecId;
ledgerJournalTrans.LedgerDimension = 5637150618;
get_journal_entry = journalentry;

ledgerJournalTrans.JournalNum = axLedgerJournalTable.ledgerJournalTable().JournalNum;
ledgerJournalTrans.CurrencyCode = currencyid;
ledgerJournalTrans.ExchRate = Currency::exchRate(ledgerJournalTrans.CurrencyCode);

ledgerJournalTrans.AccountType = ledgerJournalACType::Ledger;
ledgerJournalTrans.AmountCurDebit = str2num(debit);
ledgerJournalTrans.AmountCurCredit = str2num(Credit);
ledgerJournalTrans.TransDate = trans_Date;
ledgerJournalTrans.OffsetLedgerDimension = 140567;


//ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes);


It is unable to find the main account from the RecId that you are assigning either to LedgerDimension or OffserLedgerDimesnion. Please check the recId’s. If they are correct try to debug and see why it is not returning the main account.

Hi Kranthi,

so I must join MainAccount Table with DimensionAttributeValueCombination to get RecId ?

Need not be necessary. You should be knowing what values to be updated into ledgerDimesnion and offsetLedgerDimension. Enter a journal line manually with the expected values and see what values are updated in the ledgerJournalTrans table.
I am not really sure about the intention of your code. Are you just doing it for practice (or) is this something a real time logic that you are using to create a journal? Either way, you must think of building a ledgerDimenion/offsetLedgerDimension with the required values rather than hard coding it.

do you have reference code for create ledger journal ?

Here is a simple example from support team,…/

ledgerDimensions = [“131100-USA”,”131100″, 1, “COUNTRY”,”USA”];
can you explain value in code for ledgerdimension like above, because I use only main account, ex ledgerdimension = [“01-10-xxxxx”], like this can use ?

You can use ledgerDimensions = [“131100”,“131100”]


I Have to try that acctPattern = [“01-00-11102”,“01-00-11102”];

but the ledgerdimension/accnumber cannot show in journal line like picture ,

what’s wrong ?


01-00-11102, is that only a main account (or) account and dimension combination?

that only main account, that format in my company using like that.

like this picture


that’s format wrong or what ?


That shouldn’t be a problem. Were you able to enter a journal manually with that main account?
If not check that the main account is allowed in the account structures.

yes , I could enter a journal manually,

i have check the main account was allowed in the account structures


why ledgerdimension couldnot show in journal lines when I use acctPattern = [“01-00-11102”,“01-00-11102”]; ?


I don’t see any problem. Try to debug.