post JournalApproval

Dear All ,

Greetings, Can you tell me How i can post DocumentStatus::JournalApproval ? using X++ like i post PurchaseOrder ,many Thanks.

Regards,

Hisham

If you want to post the Purchase Order of type journal, then you need to first update the Purchase Type before posting through it code.

that is not i need , i need to post JournalApproval , not a purchase order using code , which invoice pool form doing ,because i do the same cycle manually and end it by post journalAprroval ,thanks.

Any of the ledgerJournal can be posted with the help of LedgerJournalCheckPost class.

Initialize LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::Yes) and then call the run().

Dear Kranthi ,

Greetings, First thank you on your help , but my issue i need to post invoice after i register it in “Invoice register” form, when i am using FormPurchletter.Update(); and my DocumentStatus::Invoice , i received Exception that the invoice is already use in date"/ /",so i am try to change the DocumentStatus::JornalApproval ,like the AX does in normal case and try to post with that way ,i asked many people and i did not receive any answer except you, So if you can help me i will never forget that.

Regards,

Hisham.

This may help you,

static void postJournalApprove(Args _args)
{
LedgerJournalTrans ledgerJournaTrans;
PurchFormLetter_ApproveJournal purchFormLetter = PurchFormLetter::construct(DocumentStatus::ApproveJournal);
PurchTable purchTable = PurchTable::find(‘00124_049’);
LedgerJournalTrans ledgerJournalTrans = LedgerJournalTrans::find(‘000072_003’,‘00004_IRG’,false);
;

purchFormLetter.purchTable(purchTable);
purchFormLetter.initLedgerJournalTrans(ledgerJournalTrans);
purchFormLetter.showQueryForm(false);
purchFormLetter.update(purchTable,ledgerJournalTrans.Invoice);
}

Dear Kranthi ,

First , good job and thank you on your nice code , my issue now i am using “PurchFormLetter class” and in “insertJournal Form” , i do not understand what is that code in below ?

[number, internalNumber, voucher] = this.getNumAndVoucher();

and after i run your code i receive that error " you must fill voucher " i do not know from where i can do that , i think to set it hard-coded like that “LedgerJournalTrans.Voucher” but the class is usable in the system to i need to make validation if it called from my new screen set Voucher if not keep it, like caller i mean , how can i do that ? , many thanks

Regards,

Hisham.

Dear Kranthi,

Greetings, a very good day for you , thank you so much again on your help , i tried it and it works good with some modifications on “FormPurchLetter_ApprovalJournal” specially in “CheckPurch method” because of "ledgerJournalTrans.JournalNum " here must be “TransferredTo” Value to Class works well, but it keep it “JournalNum” it will not work correctly,if u have any addition please send to me , many thanks.

Kind Regards,

Hisham

Dear Kranthi,

Kindly , i am using your code by path “hard coded” to it and its works , but my issue how i can path “LedgerJournalTrans” from my new form to “PurchFormLetter_ApprovalJournal class”? i try to make as “Invoice Pool” form but i do not want to show posting Invoice form ,tell me How i can fill leaderJournalTrans object in that class , please send to me ASAP

Regards,

Hisham.

Dear Kranthi,

Greetings ,Now it is working well from the form and i can post and everything is O.K. except i should modify “CheckPurch” method and replace JournalNum , with Transeferedto field , i do not know is it Right or not because it does not work unless with this modification , but my issue now How i can post “Approval Journal” assigned to more than one Purchase Order using PurchFormLetter_AppovalJournal class, many thanks.

Regards,

Hisham.

Dear Kranthi,

Any change you could share the code you developed? I’m trying to do the same exact thing.

Many thanks in advance!

Best regards,

Anders

Dear Anders Lindh,

I also try to do the same thing.

Would you like to send me the complete and working code.

Many thanks in advance.

Kind regards,

Reinier