Hi Guys,
I am using following code:
static void Demo_CreateGLJournalPost(Args _args)
{
AxLedgerJournalTable journalTable;
AxLedgerJournalTrans journalTrans;
container acctPattern;
container offSetAcctPattern;
LedgerJournalTable ledgerJournalTable;
ledgerJournalCheckPost ledgerJournalCheckPost;
MainAccountNum mainaccountid;
;
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("CR NOTE_56");
journalTable.save();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("USD");
journalTrans.parmAmountCurDebit(5);
journalTrans.parmAccountType(LedgerJournalACType::Cust);
journalTrans.parmLedgerDimension(DimensionStorage::getDynamicAccount("C-00001", LedgerJournalACType::Cust));
journalTrans.parmOffsetAccountType(LedgerJournalACType::Ledger);
offSetAcctPattern = ["SALES RETURNS","41290.10"];
journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offSetAcctPattern));
journalTrans.save();
ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
ledgerJournalCheckPost.run();
info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));
}
Here I am able to post general journal but for account type OffsetAccount, OffsetAccount is not assigned ie. its blank because of which posting is getting failed.
Pls suggest what might be going wrong.. Thanks.