Open the Object Designer by selecting Tools, Object Designer from the MenuBar. Press the Codeunit button to view all codeunits. Now press the New button located at the bottom of the Object Designer. The C/AL Editor window will appear, completely blank. Now close the C/AL Editor window. A questionwindow will appear asking "Do you want to save the changes to the codeunit"?Click Yes. The Save As window will now be displayed. Give The CodeUnit ID No:(Between 50000-99999) and the Name (CodeUnit Name).
Click OK. Now, scroll down to the bottom of the Object Designer window and find your new codeunit. Select it and press the Design button.
Define a Variable
To define global variables in an object, select View, C/AL Globals on the MenuBar once you are designing that object. A window like the following will appear:
Click OK. Now, scroll down to the bottom of the Object Designer window and find your new codeunit. Select it and press the Design button.
Define a Variable
To define global variables in an object, select View, C/AL Globals on the MenuBar once you are designing that object. A window like the following will appear:
Please fill it If you press the F6 key while you are in theDataType column, you will see a list of data types that you can select.Once you have entered all of these, select the Variable name. To Set the Properties, Select the Varible Click on the Properties (Press SHIFT+F4) and like set all the properties for all variable.Now close the Properties window, then close theC/AL Globals window. Finally, close the Object Designer window.When it asksif you want to save, click Yes. T write the code in the CodeUnit Go to the Corresponding Codeunit Select the Design button and write the code in OnRun(). The Save it.
This Codeunit can be called from any of the Trigers in forms or Report sections.
No comments:
Post a Comment