static void GLImport(Args _args)
{
AxLedgerJournalTable header = new AxLedgerJournalTable();
AxLedgerJournalTrans trans = new AxLedgerJournalTrans();
container
ledgerDim, offsetDim;
LedgerJournalNameId
ledgerJournalNameId = "GeneralJR";
DimensionAttributeValueCombination ledgerDimension;
LedgerJournalACType accType,
offsetAccType;
BankAccountTable
bankAccountTable;
;
accType =
LedgerJournalACType::Ledger;
offsetAccType = LedgerJournalACType::Bank;
header.parmJournalName(ledgerJournalNameId);
header.save();
trans.parmAccountType(accType);
trans.parmJournalNum(header.ledgerJournalTable().JournalNum);
//If account type is Ledger
ledgerDim = ["142102-C-ADMIN","142102","C","ADMIN"];//First is Display value, followed by Main Account and then
dimensions.
//If
account type is other than ledger then Switch case statement can be written to
get RecId from DimensionAttributeValueCombination Table.
trans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(ledgerDim));
trans.parmAmountCurDebit(230);
trans.parmOffsetAccountType(offsetAccType);
switch(offsetAccType)
{
case
LedgerJournalACType::Bank : select firstOnly bankAccountTable
join RecId from ledgerDimension
where ledgerDimension.DisplayValue
== bankAccountTable.AccountID
&&
bankAccountTable.AccountID == "ICICI Bank";
trans.parmOffsetLedgerDimension(ledgerDimension.RecId);
//Same cases has to be written for others like Vendor, Customer.
Except Account type ledger
//If offset account type is ledger then trans.parmOffsetLedgerDimension() will
only be supported.
}
//trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetDim));
trans.save();
}
Hi
ReplyDeleteCan you give me for Ax2009 also.
Regards
Hi Mukesh,
ReplyDeleteI saw your example of retrieving the LedgerDimension for the bank account. I always prefer using the method following method:
DimensionStorage::accountNum2LedgerDimension(accountNum, LedgerJournalACType). This does not work for the retrieval of the LedgerDimension for a ledger account but works a treat for customers, vendors, banks, etc.
Regards
Thanks you very much for sharing these links. Will definitely check this out..
ReplyDeleteswiss taxi
Hello,
ReplyDeleteI got a new requirement in General journal form added Two new button(Generate Template & Upload) created new record by using "Generate template", in excel manually entered all records including 'Account,Offset account' value,
when i click "Upload button" the current records should be inserted into (Ledger journal Trans) table.
My issue when i click "Upload" button all records fetching from (Excel) and inserted into (Ledger journal Trans) except 1.Account ,2. Offset account value.
How should i insert Account and Offset Account values from Excel to Ledger Journal Trans table.
Please revert back.
Is this code work for D365 ?
ReplyDelete