Example class for reference: \Classes\TutorialJournalCheckPost\main
Example: Using Ledger Journal
The following is an example of creating a journal with one journal line and then
posting the journal.
static void ExampleLedgerJournal(Args _args)
{
LedgerJournalName LedgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberseq;
LedgerJournalNameId LedgerJournalNameId = 'GenJrn';
BankAccountID BankAccountID = 'EUR OPER';
ledgerAccount offsetAccount = '601500';
amountCur amountCur = 102;
;
ttsbegin;
// Find a ledgerJournalName record
select firstonly LedgerJournalName
where LedgerJournalName.JournalName ==
LedgerJournalNameId;
//Created the ledgerJournalTable
ledgerJournalTable.JournalName =
LedgerJournalName.JournalName;
ledgerJournalTable.initFromLedgerJournalName();
ledgerJournalTable.Name = 'Hotel';
ledgerJournalTable.insert();
numberseq =
NumberSeq::newGetVoucherFromCode(ledgerJournalName.VoucherS
eries);
ledgerJournalTrans.Voucher = numberseq.voucher();
//Generate the transaction line
ledgerJournalTrans.JournalNum =
ledgerJournalTable.JournalNum;
ledgerJournalTrans.CurrencyCode = 'EUR';
ledgerJournalTrans.ExchRate =
Currency::exchRate(ledgerJournalTrans.CurrencyCode);
ledgerJournalTrans.AccountNum = BankAccountID;
ledgerJournalTrans.AccountType =
LedgerJournalACType::Bank;
ledgerJournalTrans.AmountCurCredit = amountCur;
ledgerJournalTrans.TransDate = today();
ledgerJournalTrans.Txt = 'Room Stay';
ledgerJournalTrans.OffsetAccount = offsetAccount;
ledgerJournalTrans.OffsetAccountType =
LedgerJournalACType::Ledger;
ledgerJournalTrans.insert();
info(strfmt('Journal Id:
%1',ledgerJournalTable.JournalNum));
//Post the Journal
ledgerJournalCheckPost =
ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournal
Table,NoYes::Yes);
ledgerJournalCheckPost.run();
ttscommit;
}
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
Subscribe to:
Post Comments (Atom)
Ledger Voucher creation Framework and x++ code to create ledger voucher
Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...
-
Please click here to access Custom Workflow step by step process:
-
FormRun formRun = sender.formRun(); Object inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransO...
This is AX 2009...
ReplyDelete