Create JV through code


   I just wrote a piece of code to create General Journal voucher

 when i run that code it seems to me ok. but when i go to General Journal form it showing blank field

while i check from back end (in LedgerJournalTrans Table). it showing exact data.

so my question is that why it is not showing in form.

AXVersion AX2012r3 And code is given below


public void importGJVoucher(Filename    _fileName)
    LedgerJournalNameId         journalName;
    CommaIo                     Io;
    str                         column1,column2,column3,column7;
    DimensionDisplayValue       column4,column8;
    Amount                      column5,column6;
    Voucher                     voucher;
    container                   data;
    NumberSeq                   numberseq;
    MainAccountNum              ledgerAccount;
    GeneralJournalAccountEntry  GJAEntry;
    CustAccount                 custAccount;
    VendAccount                 vendAccount;
    LedgerJournalName           ledgerJournalName;
    LedgerJournalTable          ledgerJournalTable;
    LedgerJournalTrans          ledgerJournalTrans,ledgerJournalTrans1;
    DimensionAttributeValueCombination  DAVCombination;

    Io          = new CommaIo(_fileName,'r');
    data        =;
    journalName = 'JV';

    // Create Journal Header
    LedgerJournalName               = LedgerJournalName::find(journalName);
    LedgerJournalTable.JournalNum   = NumberSeq::newGetNum(LedgerParameters::numRefJournalNum()).num();
    LedgerJournalTable.JournalName  = journalName;
    LedgerJournalTable.JournalType  = LedgerJournalType::Daily;
    voucher                         = NumberSeq::newGetVoucherFromCode(NumberSequenceTable::find(ledgerJournalName.NumberSequenceTable).NumberSequence).voucher();
    while(Io.status() == IO_Status::Ok)
        data    =;
        column1 = conPeek(data, 1);
        column2 = conPeek(data, 2);
        column3 = conPeek(data, 3);
        column4 = conPeek(data, 4);
        column5 = conPeek(data, 5);
        column6 = conPeek(data, 6);
        column7 = conPeek(data, 7);
        column8 = conPeek(data, 8);

        // Create Journal Line
        LedgerJournalTrans.JournalNum           = ledgerJournalTable.JournalNum;
        LedgerJournalTrans.TransDate            = str2Date(column1,123);//systemDateGet();
        LedgerJournalTrans.AccountType          = LedgerJournalACType::Ledger;
        LedgerJournalTrans.Txt                 = column3;

        select * from DAVCombination
        join ledgerJournalTrans1
        where DAVCombination.RecId          == ledgerJournalTrans1.LedgerDimension
            && DAVCombination.DisplayValue  == column4;
        LedgerJournalTrans.LedgerDimension  = ledgerJournalTrans1.LedgerDimension;

       // ledgerJournalTrans.LedgerDimension      = column4;
        LedgerJournalTrans.Voucher              = voucher;
        LedgerJournalTrans.AmountCurDebit       = column5;
        LedgerJournalTrans.AmountCurCredit      = column6;
        LedgerJournalTrans.OffsetAccountType= LedgerJournalACType::Ledger;
        LedgerJournalTrans.TransactionType  = LedgerTransType::GeneralJournal;
        LedgerJournalTrans.Approved         = NoYes::Yes;

        select * from GJAEntry
        where GJAEntry.LedgerAccount        == column8;
        LedgerJournalTrans.OffsetLedgerDimension    = GJAEntry.LedgerDimension;
        //ledgerJournalTrans.OffsetLedgerDimension    = column8;

        if(LedgerJournalTrans.validateWrite() && column1 != "0")
    info(strFmt(" General Number %1 has been created", LedgerJournalTable.JournalNum));


Pls  help me.

thanks in advance

  • taukeer ahmed
    i go to General Journal form it showing blank field

    Are you not able to see the journal header (or) lines (or) Both?

  • In reply to Kranthi:

    Journal Header is Ok
    But in the Line not showing data
    pls help me.
    its urgent
  • In reply to taukeer ahmed:

    In the line only its showing current date and voucher number which is come automatic.
  • In reply to taukeer ahmed:

    If you have the data in table and it is not showing in the form, then you are not inserting the data in related inner joined tables (look at the form data sources to find the inner joined data sources).
    Example - If you are in a legal entity related to India, then you should be filling data in LedgerJournalTransTaxExtensionIN