Hi Expert,
I am trying to do like "auto post" with specific journal Batch name. and I see that the code for posting in item journal like 3 lines below
CODEUNIT.RUN(CODEUNIT::"Item Jnl.-Post",Rec);
CurrentJnlBatchName := GETRANGEMAX("Journal Batch Name");
CurrPage.UPDATE(FALSE);
and when I test and debug it, it show error since that the "Journal Batch Name" = ''
and I need to push some value in that batch name. how to do so ?
thanks,
0
Answers
For auto posting, you usually post journal line by journal line, not a whole batch, by just filling in the data needed, without inserting it into the table. In this case you leave template name and batch name fields blank.
You may however, fill in a batch and post the whole batch using the appropriate codeunit ("Item Jnl.-Post Batch" in this case). Either make sure the batch is empty before you fill it, or else filter the batch such, that only your inserted lines are visible within the filter when you post it.
If you need to post within a certain batch, follow the second path: