Microsoft Dynamics Ax For Mac

  



Microsoft Dynamics AX is a comprehensive enterprise resource planning (ERP) solution for midsize and larger organizations that empowers people to work effectively, manage change, and compete globally. For use with Microsoft Dynamics AX 2012 R2, this application enables you to capture your expense transactions and receipt information. This application also allows you to create and submit timesheets.

You define types and their structure in the AOT, not in the X++ language. Other programming languages that support type declarations do so within code, but Dynamics AX supports an object layering feature that accepts X++ source code customizations to type declaration parts that comprise variable declarations and method declarations. Each part of a type declaration is managed as a separate compilation unit, and model data is used to manage, persist, and reconstitute dynamic types whose parts can comprise compilation units from many object layers.

You use X++ to define logic, including method profiles (return value, method name, and parameter type and name). The X++ editor allows you to add new methods to the AOT, so you can continue to use the X++ editor while constructing types.

You use X++ class declarations to declare protected instance variable fields that are members of application logic and framework reference types. You can’t declare private or public variable fields. You can declare classes abstract if they are incomplete type specifications that can’t be instantiated. You can also declare them final if they are complete specifications that can’t be further specialized. The following code provides an example of an abstract class declaration header.


You can also structure classes into single-inheritance generalization or specialization hierarchies in which derived classes inherit and override members of base classes. The following code shows an example of a derived class declaration header that specifies that MyDerivedClass extends the abstract base class MyClass. It also specifies that MyDerivedClass is final and can’t be further specialized by another class. Because X++ doesn’t support multiple inheritance, derived classes can extend only one base class.

Microsoft


X++ also supports interface type specifications that specify method signatures but don’t define their implementation. Classes can implement more than one interface, but the class and its derived classes should together provide definitions for the methods declared in all the interfaces. If it fails to provide the method definitions, the class itself is marked as abstract. The following code provides an example of an interface declaration header and a class declaration header that implements the interface.

Dynamics


Fields

Microsoft Dynamics Ax For Manufacturing

2009

A field is a class member that represents a variable and its type. Fields are declared in class declaration headers; each class and interface has a definition part with the name classDecla-ration in the AOT. Fields are accessible only to code statements that are part of the class declaration or derived class declarations. Assignment statements are not allowed in class declaration headers. The following example demonstrates how variables are initialized with assignment statements in a new method.


Methods

A method on a class is a member that uses statements to define the behavior of an object. An interface method is a member that declares an expected behavior of an object. The following code provides an example of a method declaration on an interface and an implementation of the method on a class that implements the interface.


Methods are defined with public, private, or protected access modifiers. Methods are publicly accessible by default. Additional method modifiers supported by X++ are provided in Table 1.

Table 1. Method Modifiers Supported by X++
ModifierDescription
staticStatic methods are accessed via class declarations. Fields can’t be accessed from within a static method.
finalFinal methods can’t be overridden by methods with the same name in derived classes.
abstractAbstract methods have no implementation. Derived classes must provide definitions for abstract methods.
serverServer methods can execute only on an Application Object Server. The server modifier is allowed only on static methods.
clientClient methods can execute only on a MorphX client. The client modifiers are allowed only on static methods.
displayDisplay methods are invoked each time a form or report is redrawn. The display modifier is allowed only on table, form, form data, report, and report design methods.
editThe edit method is invoked each time a form is redrawn or a user provides input through a form control. The edit modifier is allowed only on table, form, and form data source methods.

Method parameters can have default values that are used when parameters are omitted from method invocations. The following code sample prints “Hello World” when myMethod is invoked with no parameters.


Dynamics Ax 2012

A constructor is a special instance method that is invoked to initialize an object when the new operator is executed by the Dynamics AX runtime. You can’t call constructors directly from X++ code. The following sample provides an example of a class declaration header and an instance constructor method that takes one parameter as an argument.