To add a global variable to a codeunit, use the following procedure.

To add a global variable

  1. Open the C/AL Editor, choose View, and then choose C/AL Globals.

    Note
    For more information about how to open the C/AL Editor, see How to: Modify an Existing Codeunit.

  2. In the C/AL Globals window, choose the Variables tab.

  3. Enter a name and select a data type.

    If the data type that you select corresponds to an application object, you must also select a subtype, that is, the name of a specific object in the database.

    If you select OCX, Automation, or DotNet, then you must add a subtype. For more information, see the following topics:

    If you select text or code, you must define a length for the variable. The default length is 10 characters for code and 30 characters for text.

See Also

Concepts

Codeunits