Thursday 9 June 2016

An Overview of Journal Template, Journal Batch and Journal Line

Journal Template :
They provide Journal structure and default information for journal batches.

Journal Templates are located in Journal Template page.


Definiton of Journal Template contains a series of attributes such as,


1. Name

2. Description
3. Type
4. Recurring
5. No. Series

Journal Template has relevant attributes that define nature and behavior of journal templates,


Journal Template Table field: Defines the Description of Journal


Test Report ID: Simulate the posting process

ex: General Journal as the associated test report named General Journal - Test

Posting Report ID: This report is printed when the user selects post and print.


Page ID: Some journal may require UI objects.

Ex. General Journals which have a special page for bank and cash.

Source code: Here you can enter trail code for all posting documents which are done through this  journal.


RecurringWhenever you post lines from a recurring journal, new lines are automatically created with a posting date defined in the recurring date formula.


Each journal template defines a default value of those attributes. The values that are defined in a template will be inherited by the journal batches which will be further inherited by journal Line.


Journal Batch: Journal batches usually serve to lines created by 2 different users called group journal lines.


They're created with the help of journal templates.



A journal batch is typically used to make a distinction between collections of logically grouped journal lines. A typical design is to have a journal batch for each user who enters lines. The batches are used during the posting process, in order to post one or multiple lines at once.

As shown in fig. The batch we have used is CASH for posting process to post that particulat line.



Journal Lines: Journal line will temporarily hold the transaction data until it is posted.

Until posting, Journal lines will be in draft state, means you can do correction/deletion o data.
Once the entry is posted line entries in journal are converted to Ledger Entries.





Journal lines contain the actual business data (posting dates, account numbers, amounts) that will be posted as ledger entries.

During posting, only the information from the journal lines is needed. However, the information has been created with the help of the journal templates and grouped together using the journal batches.
Posting creates ledger entries from the temporary content that is stored in the journal lines. Ledger entries are not created directly. Instead, they are posted from journal lines.
reference from community of dynamics.


In this, journal templates and batch is used if we need to create and post one or more entries. So, they're implemented in multiple areas of application like sales, purchases, cash receipts, payments, fixed assets.


Aggregation


There is a 1:n aggregation relationship between journal templates and journal batches, as well as between journal batches and journal lines. Deleting a template will cascade deletion of the related batches and lines. Deleting a batch will cascade into deletion of related lines.

Recurring Journals

A recurring journal is used to post transactions that repeat periodically. In a recurring journal, the user enters only the variable data, such as posting date, amounts, and accounts to be used for posting.
After posting a recurring journal, new journal lines are created containing the posting date for the next recurring period. The posting date recurrence pattern is previously defined in the Recurring Frequency field (for example, monthly recurrences(salary of an employee) are defined with the date formula 1M).
A boolean field named Recurring is placed on both the journal templates and journal batches, giving the possibility of defining the type of the journal to be used.

Standard Guidelines respected to navigation:



To keep a consistent user interface experience, it is recommended that the the following guidelines are taken respected concerning navigation:
  • Journal template to journal batches:
  • On the Journal Templates page, create an action called "Batches" and place it in the Navigate tab of the ribbon. Link the action to the batches list page.


fig shows batch action created and as been linked to batches list page. 

  • Journal batch to journal lines:
  • On the Batch page, create an action called "Edit Journal" in the Home ribbon tab.Link the action to the journal lines list page.




The action as been linked to journal lines through code.

In EditJournal - OnAction() trigger

GenJnlManagement.TemplateSelectionFromBatch(Rec);

Go to definiton of TemplateSelectionFromBatch(Rec) function and there you can see General journal lines as been called through code as shown below.



To keep a consistent user interface experience, it is recommended that the the following guidelines are taken respected concerning posting:
  • Posting multiple batches
  • On the Journal Batches page, posting actions (Post, Post and Print) are available. When invoked, the batch posting will iterate through all related journal lines and trigger the posting routine for all of the lines.



General Journals

The General Journal Templates page (101) uses the Gen. Journal Template table (80).
Various template types are defined: General,Sales,Purchases,Cash Receipts,Payments,Assets,Intercompany,Jobs. Based on the journal type, two other attributes are automatically set on the template lines as follows:
  • Page ID: Defines which journal page relates to the current journal template
  • Source Code: Filled with the default codes that are defined in Source Code Setup table (242).
The General Journals Batches page (251) is linked to the Gen. Journal Batch source table (232), which has a multiple-to-1 relationship with Gen. Journal Template table, based on the Journal Template Name field.
Some of the fields in the Gen. Journal Batch table are not editable. Instead, their value is automatically calculated from the parent Gen. Journal Template table. For example, the Recurring field (22) is a FlowField with the following calculation formula:
Lookup("Gen. Journal Template".Recurring WHERE (Name=FIELD(Journal Template Name)))
Similarly, the Template Type field is a FlowField that gets its value from the parent table:
Lookup("Gen. Journal Template".Type WHERE (Name=FIELD(Journal Template Name)))

Setting up a New Batch

When the user creates a new batch, the following field values are transferred from the Gen. Journal Template table to the Gen. Journal Batch table:
"Bal. Account Type" := GenJnlTemplate."Bal. Account Type";
"Bal. Account No." := GenJnlTemplate."Bal. Account No.";
"No. Series" := GenJnlTemplate."No. Series";
"Posting No. Series" := GenJnlTemplate."Posting No. Series";
"Reason Code" := GenJnlTemplate."Reason Code";
"Copy VAT Setup to Jnl. Lines" := GenJnlTemplate."Copy VAT Setup to Jnl. Lines";
"Allow VAT Difference" := GenJnlTemplate."Allow VAT Difference";

Cascade record deletion

When a record from the Gen. Journal Template table is deleted, the corresponding Gen. Journal Batch and Gen. Journal Line records are also deleted.

Cascade updates

When the reason code or the posting number series change in the current batch, all linked Gen. Journal Line records are updated (see ModifyLines function on the Gen. Journal Batch table).
The Gen. Journal Line table (814) stores a relation with the Journal Batch Name field (51) in the Gen. Journal Batch table. The Gen. Journal Line table also inherits the table relation with the Journal Template Name field (1) in the Gen. Journal Template table.

NAV Usages

Implementations of this pattern in NAV include:
  • General Journal 
  • Item Journal
  • Resource Journal
  • Job Journal

Reference from community.dynamics.com

Sunday 5 June 2016

metadata in Dynamics NAV

A set of data that describes and gives information about other data.

In NAV,
if the object is compiled, a metadata will be specified.

We need metadata because, its used on NAV Server to allow running and debugging the object.


Ex:
If you have a table 18 customer, a record will be created for that when you compile it,



  • If the record(metadata) is missing for an object, then you cannot run object on NAV server.
  • when you compile an object in development environment. Record(metadata) is automatically generated.

Metadata field, Object metadata table.

Specifies XML metadata for the object. This allows the object to be run on Dynamics NAV Server.



  • Metadata is stored in Table 2000000071 object metadata for all navision objects whether it is visible or hidden. 
  • usually system table "Object Metadata" is created when we restore the database after creating the keys for various tables while processing the objects.
  • For visible objects these metadata's are automatically created when we compile the particular object.