I need to create an Invoice-register journal by code and need to use the
class LedgerJournalEngine.
Do you know how I can use this class by code and without a FormRun (and
datasource) ? I have seen some examples with ledgerJournalEngine =
LedgerJournalEngine::newBatch(null); but I haven't been able to get this to
work.
I'm working on an Axapta 3.0 SP2
Check out this MSDN link:
http://msdn.microsoft.com/en-us/library/aa478710.aspx
Also check out this blog:
http://daxguy.blogspot.com/2007/07/post-ledger-transactions-via-x.html
What I would do is write a custom class to build your Ledger Journal
transactions and then write another class that extends runbasebatch (to call
your custom class on a batch)
I hope this helps somewhat.
Regards
SysProg
Therefore I need to use the class LedgerJournalEngine and need an example
that works, so I can see how I can use it without a form.
Have you checked out the class AxLedgerJournalTrans_VendInvoiceRegister
already? This class allows you to create the necessary journal lines,
without a form. (Use it with class AxLedgerJournalTable)
All necessary parameters can be set by code. Posting can be done after the
journal is created. Ax creates the ledger voucher for you, thereby respecting
all business logic.
Hope it helps,
Willy (blog at http://dynamics-ax-live.blogspot.com)
These are working for inventory transactions as well. This is the preferred
way on creating journals via code.