Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use LedgerJournalEngine by code ?

1,511 views
Skip to first unread message

anders_riis

unread,
Jan 27, 2010, 9:07:02 AM1/27/10
to
Hi,

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

SysProg

unread,
Jan 27, 2010, 10:18:01 AM1/27/10
to
Hi Anders,

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

anders_riis

unread,
Jan 28, 2010, 1:59:01 AM1/28/10
to
My problem is not to post the journal. I need to create the lines and want to
be 100% sure that all fields are set correct. If you look at the form
"LedgerJournalTransInvoiceRegister" you can see in the datasource
"LedgerJournalTrans" that when the field AccountNum is changed the method
modified is called. In this method
"ledgerJournalEngine.accountModified(ledgerJournalTrans);" is called. Many of
the fields in this form is handled by ledgerJournalEngine, and I want my code
to do the same when I am creating my ledgerJournalTrans by code.

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.

Willy

unread,
Jan 28, 2010, 4:56:01 AM1/28/10
to
Hi Anders,


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)

Johan van Veldhuizen

unread,
Jan 28, 2010, 6:31:01 AM1/28/10
to
Look at the base classes:
JournalTableData
JournalTransData

These are working for inventory transactions as well. This is the preferred
way on creating journals via code.

0 new messages