You define a variable for a class is similar to how you define a variable for a procedure. The main difference is in the access mode you specify for the variable.

Here is the simplified ABL syntax to define a variable data member:

VAR access-mode type-name variable-name.
Syntax Element

Description

access-mode

Specifies whether the data member will be available to other parts of an application. As a best practice, you should define as PRIVATE or PROTECTED. For more information, see Access modes.

type-name

Can be one of the ABL data types such as integer or character or it can be a user-defined type.

variable-name

Must begin with a letter and it can contain letters, numbers, underscores, or hyphens. It must not contain periods or spaces.

Here is a variable data member defined for the Dept class. Every instance of a Dept class will hold its own values for this data member. Since this data member is PRIVATE, it will be accessible only by the methods of this class.

class Enterprise.HR.Dept: 
//used for keeping track of how many employees 
//are in the set of employees for the department
//used internally within the class. 

  var private integer NumEmployee. 

  // rest of class definition 

end class.
See also: