Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Issue while posting GeneralJournal through code x++ in ax 2012(Ref. code and Screen shot).

$
0
0

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.


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>