Calling Posting Routines

I am working on BOM modifications for a client which requires posting of material usage to Job Ledger. After the user has entered the materials used and presses Post button, the program allocates the material based on the quantity of Components made from the raw material item. We write the allocation records for the components made into the Job Journal table and call the Job Journal Post codeunit of Navision to post to the job ledger. Before we call the posting routine, we check if there is a rounding difference after the allocation is done and if so, add the rounding difference to the last Job Journal record and then call post routine. This works fine, except that the user wants to initiate the entire allocation process at night when all users are logged off(Batch Posting at end of day). The problem with this is, when it is time to run the Job Jnl. Post codeunit it asks ‘Do you want to Post the Journal Lines?’ and there will be no user at the terminal to confirm ‘Yes’. Is there a way to automatically tell Navision to proceed? I realize that instead of writing all allocation records into the Job Jnl table and then calling the Post codeunit, we could do it one allocation record at a time by filling the Job Jnl record(not actually 'insert’ing the record) and calling the post routine, one record at a time. But the problem is, what do I do with the rounding difference that I get to know right at the end(after all allocation is done). Somehow, I am not keen on modifying the last Job Ledger record by adding to it. I don’t like the idea of writing directly into the Job Ledger or modifying its quantity and Total Cost fields because thee are no validation codes for the Job Ledger fields. So other Amount fields may not match the Quantity and Total Cost fields that get modified with the rounding difference. When I write into JobJnl table I do JobJnl.VALIDATE(Quantity), but I cannot do JobLedger.VALIDATE(Quantity) because there is no code in OnValidate trigger of Job Ledger’s Quantity field. Please advise. Thanks. Pari somasundaram.

In navision, only Post codeunits work directely in posted Entries. You an Look at Codeunit 80, 90, etc. They write in Journals, and then call Post Function. If you want post Job Entries, you must work with Job Journal Line, and call Job Jnl.-Post Line. Look Quantity trigger Best regards from BCN.

Hello,

quote:


The problem with this is, when it is time to run the Job Jnl. Post codeunit it asks ‘Do you want to Post the Journal Lines?’ and there will be no user at the terminal to confirm ‘Yes’. Is there a way to automatically tell Navision to proceed?


One simple possibility would be to “desactivate” the CONFIRM statement in Job Jnl. Post (C281), Function Code. A more elegant way would be that this message appears depending on the job line you want to post. You can add a new field to the Job Jnl Line table (something like “Needs confirmation”) and during the allocation process you mention you tick that field. You change the CONFIRM statement like this:


IF "Needs confirmation" then
  IF NOT CONFIRM('Do you want to post the journal lines?') THEN
    EXIT;

In this case, when posting a normal job journal the CONFIRM message will appear, in the other case the posting will proceed directly. And like this, you won’t have the need of adjusting any fields after the posting process. Saludos Nils

Hi pari, Why WOuld you want to Write something on the Onvalidate on the Job Ledger Entry. I think You should create teh Job Ledger entry from the Job Journal Posting. Best regards, Prashanth NCFC, NCMC, NCSD prashycool@yahoo.com

Thanks, Nils. I think I like your suggestion. It is easy to code and maintain. Makes a lot of sense. Pari Somasundaram.