axapta - Create a new record in form LedgerJournalTransCustPaym through x++ code -
i need create reord in ledgerjournaltrans
through x++ code.
while debugging found out class ledgerjournalengine_custpayment
used initiate form as
ledgerjournalengine_custpayment = new ledgerjournalengine_custpayment(element)
and later
ledgerjournalengine.initvalue(ledgerjournaltrans);
also after assiging accountnum
methods executed @ modified()
method of datasource field ledgerjournaltrans:accountnum
element.accountnummodifiedpost();
etc.
while trying achieve same through code not able initiate class ledgerjournalengine_custpayment
, other methods in form ledgerjournaltranscustpaym
system does.
pls help.. joyce
ledgerjournalengine* classes used forms work , execute code before/after events , datasource actions. you're trying do, make more sense complete of necessary ledgerjournaltrans fields, .insert(). here code wrote want though using engine some:
static void job81(args _args) { ledgerjournalengine_custpayment ledgerjournalengine; ledgerjournaltable ledgerjournaltable; ledgerjournaltrans ledgerjournaltrans; numberseq numberseq; voucher voucher; ; // selects header inserting select firstonly ledgerjournaltable ledgerjournaltable.journalnum == 'gb 0056226'; if (!ledgerjournaltable) throw error ("unable find journal table record"); ledgerjournaltrans.initvalue(); numberseq = numberseq::newgetnumfromcode(ledgerjournaltable.voucherseries); if (numberseq) { ledgerjournaltrans.voucher = numberseq.num(); voucher = ledgerjournaltrans.voucher; } ledgerjournaltrans.journalnum = ledgerjournaltable.journalnum; ledgerjournaltrans.transdate = systemdateget(); ledgerjournaltrans.accounttype = ledgerjournalactype::cust; ledgerjournaltrans.accountnum = '100003'; ledgerjournalengine = ledgerjournalengine::construct(ledgerjournaltype::custpayment); ledgerjournalengine.newjournalactive(ledgerjournaltable); ledgerjournalengine.accountmodified(ledgerjournaltrans); ledgerjournaltrans.amountcurcredit = 10; ledgerjournaltrans.offsetaccounttype = ledgerjournaltable.offsetaccounttype; ledgerjournaltrans.offsetaccount = ledgerjournaltable.offsetaccount; ledgerjournaltrans.currencycode = companyinfo::standardcurrency(); ledgerjournalengine.currencymodified(ledgerjournaltrans); ledgerjournaltrans.insert(); if (numberseq && ledgerjournaltrans.voucher == voucher) { numberseq.used(); } else { if (numberseq) numberseq.abort(); } info("done"); }
Comments
Post a Comment