› Dynamics NAV › Procedure to display the Amount in Words in a report of Microsoft Dynamics NAV

Procedure to display the Amount in Words in a report of Microsoft Dynamics NAV

 Tina Menezes   Leave a comment

Introduction:

In this article, I will be explaining the procedure to display amount in words in a report of Microsoft Dynamics NAV.

Pre-Requisite:

Microsoft Dynamics NAV 2016

Procedure:

Step 1:
Declare the following variables in C/AL Globals:

  1. RepCheck’ is a variable of DataType ‘Report’ and Subtype ‘Check’ which is Report 1401.
  2. NoText’ is a variable of DataType ‘Text’ with Dimensions Value as 2 which is set by navigating to the properties of the ‘NoText’ variable.
  3. AmountInWords’ is a variable of DataType ‘Text’ which will store the final result of the amount in words.

Step 2:
Now in my custom purchase order report, I want to display the Amount to Vendor in Words.

So in the Purchase Header – OnAfterGetRecord() trigger, I have put the following code:

I have declared a variable ‘AmountVendor’ of DataType ‘Decimal’ in which I will be storing the ‘Amount to Vendor’. I have rounded off the Amount to 2 decimal places.

AmountVendor:= ROUND("Purchase Header"."Amount to Vendor",0.01);

Now add the following code to display the Amount in Words:

RepCheck.InitTextVariable;

RepCheck.FormatNoText(NoText,AmountVendor,"Purchase Header"."Currency Code");

AmountInWords:=NoText[1];

So the complete code looks like below:

Step 3:
Now get the variable ‘AmountInWords’ under the DataSource ‘Purchase Header’ in the report and display it in the design layout of the report.

After saving and running the report the Amount to Vendor will be displayed in Words as shown below:

Conclusion:

Thus using the above procedure and the Report 1401 i.e. ‘Check’ report, the amount in words can be easily displayed in any report of Microsoft Dynamics NAV 2016.

 


Liked it? Share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.