Hi Guys,
Good day!
Do you have any idea on how to import GL Transactions in AX 2012? We tried using MS Excel Add-inn but we got some errors that we don’t understand. Looking forward to hear from you guys.
Thanks!
Regards,
AML
Hi Guys,
Good day!
Do you have any idea on how to import GL Transactions in AX 2012? We tried using MS Excel Add-inn but we got some errors that we don’t understand. Looking forward to hear from you guys.
Thanks!
Regards,
AML
You should import them as an open journal. You have not said what you are doing and what the error is.
Hi AdamRoue,
Thanks for the reply!
We tried importing the transaction in MS Excel using Add-in with two tables involve(LedgerJournalTable and LedgerJournalTrans) but doesn’t work for us. Can you share to us your approach on how are we going to import this transactions?
Your reply is fully appreciated!
Thanks!
Regards,
AML
Hi AML,
you can import from text file or csv file using X++ code.
Best Regards,
Mahesh Amundla.
Hi Mahesh,
Can you share to us the code?
Your response is fully appreciated.
Regards,
AML
static void textFileGLPosting(Args _args)
{
Ledgerjournalname ledgerjournalname;
LedgerjournalTable ledgerjournalTable;
LedgerjournalTrans ledgerjournalTrans;
ledgerjournalTransTaxExtensionIN ledgerjournalTransTaxExtensionIN;
LedgerjournalCheckPost LedgerjournalCheckPost;
NumberSeq numberSeq;
Container con;
FileIOPermission permission;
TextIO textIO, textIO1;
Dialog dialog;
DialogField dialogField;
boolean FLAG = true;
Filename Filename;
LineNum lineNumber = 1;
CustAccount custAccNum;
#File
;
dialog = new Dialog(“Posting Payment Journal”);
dialogField = dialog.addField(ExtendedTypeStr(“FilenameOpen”),“Source file”);
if (dialog.run())
{
Filename = dialogField.value();
permission = new fileIOpermission(filename,“RW”);
permission.assert();
textIO = new TextIO(filename,#io_read);
textIO.inFieldDelimiter(’|’);
select ledgerjournalname where ledgerjournalname.JournalName == “HDFC-BR”; //Journal Name
ttsBegin;
ledgerjournalTable.JournalName = ledgerjournalname.JournalName;
ledgerjournalTable.initFromLedgerJournalName();
ledgerjournalTable.initValue();
ledgerjournalTable.JournalNum = JournalTableData::newTable(ledgerjournalTable).nextJournalId();
ledgerjournalTable.insert();
ttsCommit;
if(textIO)
{
while(textIO.status() == IO_Status::Ok)
{
con = textIO.read();
if(con)
{
ttsBegin;
numberSeq = NumberSeq::newGetVoucherFromId((ledgerjournalname.NumberSequenceTable));
ledgerjournalTrans.initValue();
ledgerjournalTrans.LineNum = lineNumber;
ledgerjournalTrans.Voucher = numberSeq.voucher();
ledgerjournalTrans.JournalNum = ledgerjournalTable.JournalNum;
ledgerjournalTrans.AccountType = LedgerJournalACType::Cust;
custAccNum = subStr(conPeek(con,2),1,9); //Cust Account
ledgerjournalTrans.parmAccount(custAccNum,ledgerjournalTrans.AccountType);
ledgerjournalTrans.Txt = conPeek(con,1); //Cust Name
ledgerjournalTrans.AmountCurCredit = conPeek(con,3); //Amount
ledgerjournalTrans.TransDate = str2Date(conPeek(con,4),123); //Date
ledgerjournalTrans.OffsetAccountType = ledgerjournalTable.OffsetAccountType;
ledgerjournalTrans.OffsetLedgerDimension= ledgerjournalTable.OffsetLedgerDimension;
ledgerjournalTrans.DefaultDimension = CustTable::find(conPeek(con,2)).DefaultDimension;
ledgerjournalTrans.OffsetDefaultDimension= CustTable::find(conPeek(con,2)).DefaultDimension;
ledgerjournalTrans.TransactionType = LedgerTransType::Payment;
ledgerjournalTrans.PaymId = conPeek(con,5);
ledgerjournalTrans.PaymentNotes = conPeek(con,7);
ledgerjournalTrans.DocumentNum = conPeek(con,9);
ledgerjournalTrans.setTaxInfoOfCompany_IN(CompanyInfo::find());
ledgerjournalTrans.insert();
ledgerjournalTransTaxExtensionIN.TaxModelDocLineExtensionIN::initFromBaseTable(ledgerjournalTrans);
ledgerjournalTransTaxExtensionIN.TaxInformation_IN = TaxInformation_IN::findDefaultbyLocation(ledgerjournalTrans.CompanyLocation_IN).RecId;
ledgerjournalTransTaxExtensionIN.insert();
ttsCommit;
lineNumber++;
}
}
LedgerjournalCheckPost = LedgerjournalCheckPost::newledgerjournalTable(ledgerjournalTable,NoYes::Yes);
LedgerjournalCheckPost.run();
}
}
}
Hi Mahesh,
Good day!
Can I have a sample copy of the text file you used by this code? If its ok to you? I just want to see how the data looks like or is being placed in the text file?
Your reply is fully appreciated.
Thanks!
Regards,
AML
Hi Mahesh ,
Could you share me the text file or CSV file with column names and data ?
Hi Mahesh ,
Could you share me the text file or CSV file with column names and data ?