0% found this document useful (0 votes)
64 views

ERP (Enterprise Resource Planning) : AX Training Documentation

The document discusses Enterprise Resource Planning (ERP) systems and provides an introduction to Microsoft Dynamics AX. It describes ERP as business process management software that integrates functions like product planning, development, manufacturing, and sales. It identifies common ERP systems like SAP, Oracle, and Microsoft Dynamics. The document then introduces Dynamics AX as an ERP solution for midsize and larger organizations, highlighting its capabilities for managing financials, human resources, and business operations in a global environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

ERP (Enterprise Resource Planning) : AX Training Documentation

The document discusses Enterprise Resource Planning (ERP) systems and provides an introduction to Microsoft Dynamics AX. It describes ERP as business process management software that integrates functions like product planning, development, manufacturing, and sales. It identifies common ERP systems like SAP, Oracle, and Microsoft Dynamics. The document then introduces Dynamics AX as an ERP solution for midsize and larger organizations, highlighting its capabilities for managing financials, human resources, and business operations in a global environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Contents

ERP (Enterprise Resource Planning) ........................................................................................................ 3


Types of ERP’s: ........................................................................................................................................ 3
Introduction to Dynamics AX:.................................................................................................................. 3
Why Dynamics AX:.................................................................................................................................. 3
Architecture of Dynamics AX .................................................................................................................... 4
Client Workspace ........................................................................................................................................ 5
Development Environments:..................................................................................................................... 6
Active Directory (AD): ............................................................................................................................. 6
Create new users in Microsoft Dynamics AX: ....................................................................................... 6
AOT (Application Object Tee)................................................................................................................... 7
Datatypes ..................................................................................................................................................... 8
Primitive Data Types: ............................................................................................................................... 8
Extended Data Types (EDTs): .................................................................................................................. 8
Base Enums in Dynamics AX: ................................................................................................................. 8
Tables ........................................................................................................................................................... 9
Creation of Tables: .................................................................................................................................... 9
Important Table Properties: ...................................................................................................................... 9
Fields:...................................................................................................................................................... 12
Properties of Fields: ................................................................................................................................ 12
Indexes ....................................................................................................................................................... 14
Types of Indexes: .................................................................................................................................... 14
Create an Index: ...................................................................................................................................... 14
Relations .................................................................................................................................................... 15
Normal Relation: ..................................................................................................................................... 15
Field fixed: .............................................................................................................................................. 15
Related field fixed Relation: ................................................................................................................... 15
ForeignKey Relation: .............................................................................................................................. 15
Delete Actions ............................................................................................................................................ 16
None: ....................................................................................................................................................... 16
Cascade: .................................................................................................................................................. 16
Restricted: ............................................................................................................................................... 16
Cascade + Restricted:.............................................................................................................................. 16
Types of tables ........................................................................................................................................... 17
1
AX Training Documentation
Jobs: ........................................................................................................................................................ 17
Conditional Statements ............................................................................................................................ 18
if and if ... else Statements: ..................................................................................................................... 18
Switch Statements: .................................................................................................................................. 18
Ternary Operator:.................................................................................................................................... 19
Loops .......................................................................................................................................................... 20
While Loops:........................................................................................................................................... 20
Do...while Loops:.................................................................................................................................... 20
For Loops: ............................................................................................................................................... 20
Classes in X++ ........................................................................................................................................... 21
Access Specifiers in X++: ....................................................................................................................... 21
Methods in X++ ......................................................................................................................................... 22
Instance Methods .................................................................................................................................... 22
Static Methods ........................................................................................................................................ 22
Main Methods ......................................................................................................................................... 22
Select Statements....................................................................................................................................... 23
Table Methods ........................................................................................................................................... 24

2
AX Training Documentation
ERP (Enterprise Resource Planning)
Enterprise resource planning (ERP) is business process management software that allows a
0rganization to use a system of integrated applications to manage the business and automate many
back office functions related to technology, services and human resources. ERP software integrates
all facets of an operation including product planning, development, manufacturing, and sales and
marketing in a single database, application and user interface.

ERP software is considered to be a type of enterprise application, that is software designed to be


used by larger businesses and often requires dedicated teams to customize and analyze the data
and to handle upgrades and deployment.

Types of ERP’s:

There are different types of ERP systems ranging from industry-specific ERP solutions such as
those offered by large business ERP to small business ERP. The type of ERP system that will work
best for your business depends on the size of your organization and the functions of the ERP
solution that can best support your business requirements. Some of the ERP’s are SAP, Oracle and
Microsoft Dynamics.

Introduction to Dynamics AX:

Microsoft Dynamics AX is an enterprise resource planning (ERP) solution for midsize and larger
organizations that helps people to work effectively, manage change, and compete globally.

Why Dynamics AX:

Microsoft Dynamics AX is a multi-language, multi-currency enterprise resource planning (ERP)


business software with global business management features for financial, human resources, and
operations management as well as additional industry capabilities for retailers, professional service
industries, financial-service businesses, manufacturers, and public-sector organizations. It is one
of the fastest selling application. MS Dynamics AX is low cost compare to other ERP’s. Moreover
it is user friendly.

3
AX Training Documentation
Architecture of Dynamics AX
The Microsoft Dynamics is a three tier Architecture.

The three tier architecture is defined as:

 Client: Allows user to access data from the database and run the business logic on the
server.
 Server: Responsible for running the application business logic.
 Database: For the purpose of storing data.

Client (User Interface): The end user accesses the application through the user Interface which
is the Microsoft Dynamics rich client or Enterprise Portal.

Server (Application Object Server –AOS): The AOS runs the business logic of the application.

Database (SQL Server Database): Microsoft Dynamics AX application uses data and data model
stored in the SQL Server Database.

4
AX Training Documentation
Client Workspace
The client workspace has the following components: The following image shows the highlighted
areas of Client Workspace:

 Title bar: The Title bar is located at the top of the window. This standard Microsoft
Windows feature displays the application name, license name, server name, and the
company code.
 Address bar: The Address bar is located underneath the Title bar. It gives a "breadcrumb"
trail that shows where you have been in the program and how to return.
 File menu: The File menu is located under the Address bar. t gives access to general
functions and tools available in the application.
 Windows: menu lets you open a new application workspace or a new developer
workspace.
 View: menu lets you personalize your workspace.
 Help: menu gives multiple options to get help with using the application.
 Navigation pane: is located on the left and displays the application menu.
 Content pane: is the main area. Role centers, Area pages and List pages are displayed
within the content pane.
 Status bar: is located at the bottom of the application window. The Status bar can display
information such as the user ID, date, time, company and help text. Information displayed
on the status bar.

5
AX Training Documentation
Development Environments:

Morphx IDE:

 X++ language code is written here.


 Code written forms, Classes and logic written here.

Visual Studio

 Any Manage Code will be written here Report Customization and Development
 Remote Debugging Tools. Application Explorer

Active Directory (AD):


Before users can be made Microsoft Dynamics AX users, they must be defined in Active Directory.
AD is a Microsoft Windows–based directory service that catalogs information about all the objects
on a network and distributes that information throughout the network. These objects include
people, computers, and printers.

Create new users in Microsoft Dynamics AX:

Microsoft Dynamics AX users are internal employees of your organization, or external customers
and vendors, who require access to Microsoft Dynamics AX to perform their jobs.

Use this procedure to add a user from AD:-

1. Click System administration > Common > Users > Users.


2. Click User
3. In the User ID field, enter a unique identifier for the user. A user ID is required.
4. In the User name field, enter the user or group's name
5. In the Network domain field, enter the user or group's Active Directory Domain Services
(ADDS) domain, if the user or group is authenticated by AD DS.
6. In the Alias field, enter a network alias if the user or group is in AD DS. If not enter an e-
mail address.
7. In the Account type field, select whether the user or group is authenticated by AD.
8. In the Default company list, select the company that the user logs on to by default. If you
do not select a company.
9. To grant the user access to Microsoft Dynamics AX, select Enabled.
10.Click Assign roles to select the security roles that are assigned to the user.

6
AX Training Documentation
AOT (Application Object Tee)
The application object tree (AOT) is a hierarchically structure where all the Dynamics AX objects
are defined. If you open the AOT by launching the development environment (CTRL-D) you will
see the following folder structure. Each different type of object will be stored in these subfolders
(or nodes) depending on its nature.

7
AX Training Documentation
Datatypes
Data type specifies the size and type of values that can be stored in an identifier
Data types in AX are classified into two types:

1. Primitive Data Types:


2. Extended Data Types (EDTs):

Primitive Data Types:


The primitive data types in X++ are listed in the following table.

 Booleans: Can only contain the values false and true.


 Dates: Contains day, month, and year.
 Enums: An abbreviation for enumerated text—a set of literals.
 GUIDs: globally unique identifier.
 Integers: A number without a decimal point. To declare an integer, use the keyword int.
 Reals: Numbers with a decimal point; also called decimals.
 Strings: A number of characters. To declare a string, use the keyword str.
 TimeOfDay: hours, minutes, and seconds. To declare a time, use the system type
timeOfDay.
 Utcdatetime: year, month, day, hour, minute and second.

Extended Data Types (EDTs):

Extended data types (EDTs) are user-defined types, based on the primitive data types boolean,
integer, real, string, and date, and the composite type container. You can also base EDTs on other
EDTs.

Benefits of EDT’s:

 EDT’s are reusable


 EDT’s are editable on requirements
 By creating the EDT’s time cost will be reduced at the time of modification.

Base Enums in Dynamics AX:

Base Enums are fixed values or simply we can defined as list of literals. The value of Base Enums
starts with 0 and the range of Base Enums that we can add up to is 0 to 255.

Example: where we choose Base Enums is in defining the Gender.

8
AX Training Documentation
Tables
Tables are the foundation objects in Microsoft Dynamics AX and store data used by the system.
A table is made up of records (or rows) that contain information about a single entry in the table.
For example, a specific customer or product. A record consists of one or more fields (or columns)
that contain a discrete piece of data of a specific data type.

In Microsoft Dynamics AX, tables are located in the Application Object Tree (AOT) under
the Data Dictionary\Tables node. Each table contains the following primary elements:
 Fields
 Field Groups
 Indexes
 Relations
 DeleteActions
 Methods
A table name can contain letters and numbers but must begin with a letter. Spaces and special
characters are not allowed.

Creation of Tables:

Tables are created under AOT > Data Dictionary > Tables

In order to create a new record in the table we use shortcut key as Crtl + N

When you create a record 3 fields are created by default.

 RecId – It is unique number created for each record is created.


 DataAreaid – Indicated the current company name.
 RecVersion – Usually specifies the current version of the record in database. Suppose if
any updating in done to that record it will displays with other updated one.

Important Table Properties:

Property Description

Name Specifies Name of the Table

Label Specifies label

9
AX Training Documentation
CacheLookup Determines how to cache the records retrieved during a lookup
operation.
This CacheLookup property exists only on tables that do not
inherit from another table.

ClusterIndex Specifies the cluster index.


This property is used only for SQL optimization purposes.

ConfigurationKey Specifies the configuration key for the table.


Configuration keys allow a system administrator to enable and
disable certain parts of an application.

CreatedBy Indicates whether the system maintains the CreatedBy field for
the records in a table. This field contains information about who
created a particular record.

CreatedDateTime Indicates whether the system maintains


the CreationDate and CreationTime fields for the records in a
table. This field contains the date when a record was created.

CreatedTransactionId Indicates whether the system maintains


the CreatedTransactionId field for the records in a table. This
field contains information about which transaction created the
record.

CreateRecIdIndex Indicates whether an index on the Record ID field is created.

DeveloperDocumentation Describes the purpose of a table and explains how it is used in


the application. A description is typically no more than five
sentences long and is written as a single paragraph.

Extends Derives the table from another table that is chosen as the
property value.
The value is null when the SupportInheritance property is set
to Yes.

IsLookup For report models, it specifies whether the table information is


incorporated into other tables that reference it when a report
model is generated.
For OLAP cubes, it determines whether to generate a
consolidated dimension or a distinct dimension. You can specify
one of the following values.
 Yes - Indicates that attributes from the table are to be
consolidated into the parent dimension (star schema).
10
AX Training Documentation
 No - Indicates that a separate dimension is to be
generated for the table (snowflake schema).

Label Specifies the label for a table.

ListPageRef Specifies a display menu item that points to a form that can show
a list of this record type.

Model Specifies which model the table is in.


A model is a logical grouping of elements in a layer. An element
can exist in exactly one model in a layer. Examples of elements
are a table or class. The same element can exist in a customized
version in a model in a higher layer.

ModifiedBy Indicates whether the system maintains the ModifiedBy field for
the records in a table. This field records the person who
performed the last modification to a record.

ModifiedDateTime Indicates whether the system maintains the ModifiedDate field


for the records in a table. This field records the date of the last
modification of a record.

ModifiedTime Indicates whether the system maintains


the ModifiedDateTime field for the records in a table. This field
records the date and time when a record was last modified.

Name Specifies the table name.

PrimaryIndex Specifies the primary index.


Only a unique index can be selected.
The property is used for database optimization purposes and to
indicate which unique index to use as the caching key. If a
primary index is not specified, the unique index with the lowest
ID is used as the caching key.

ReplacementKey Specifies the fields to display as the identifier for data in some
form controls.

SaveDataPerCompany Indicates whether the data for the current company is saved.
If you set the property to No, data is saved without a company
identifier (DataAreaId).

11
AX Training Documentation
SaveDataPerPartition Shows whether the table has a system field named Partition. This
is meant to be a read-only system field.
If the table has a Partition field, each record is assigned to one
partition. Each record is kept hidden from data access operations
that are run under the context of other partitions.

SupportInheritance Setting this property to Yes enables you to set a value for other
inheritance related properties such as Extends and Abstract.

TableGroup Determines which group the table belongs to.


Table Groups provide a method for categorizing tables according
to the type of data they contain.

TableType Replaces the Temporary property found in Microsoft Dynamics


AX..

TitleField1, TitleField2 Enables you to do the following:


 Add table field data to a form caption.
 Display additional fields in a lookup form. Display field
information in a tooltip.

Visible Specifies the access rights when the table is used as a data source
in a form or a report.

Fields:

The Fields node contains all the fields in the table. By specifying a field's data type, you define the
type of data that can be stored in it. Each field in a table has a number of properties that describe
the behavior of the field. The Type property contains the native data type of the field.

Properties of Fields:

Every field has some important properties based on the types of field you choose you must
follow these properties

12
AX Training Documentation
Property Description

Name Specifies the name of the field.

AllowEdit Determines whether users are allowed to modify data in an existing


record in a form.

AllowEditOnCreate Determines whether users are allowed to enter data in the field
when a new record is created from a form.

ConfigurationKey Sets the configuration key for the field.

ExtendedDataType Determines the extended data type to be used for this field.

HelpText Specifies the help string for the field. The help string is displayed
when the field is used in a form.

IgnoreEDTRelation Used in EDT (Extended Data Type) relation migration.


When migrating relations from an EDT node to a table node, you
may skip an invalid relation for a given table field. To do so, set
the IgnoreEDTRelation property of the field to Yes. The default
value is No.

Label Specifies a label for the field. This will appear in forms and reports.
See also AnalysisLabel (in a previous row).

Mandatory Indicates whether a user must add data to a field in a form.


Set Mandatory to Yes to indicate that the default or initialization
value for each data type is not acceptable for persistence into the
database.

Model Specifies which model the table field is in.

StringSize Sets the field length, in number of characters.


The maximum field length is database-dependent.
The (Memo) value indicates that the field is unlimited in length.

Type Specifies the base type of a field.

Visible Determines whether the field should be visible in the user interface.

13
AX Training Documentation
Indexes
Indexes are created on tables for faster retrieval of data and it also enhances the better performance.
Each table must have one or more indexes.

Types of Indexes:

 Unique Indexes: Unique indexes will not allow duplicates. An index can be set to unique
when the property ‘AllowDuplicates’ is set to ‘No’.
 Non-unique Indexes: Non-Unique indexes will allow duplicates. This can be done when
the property of index ‘AllowDuplicates’ is set to ‘Yes’.

Create an Index:

1. In the AOT, locate the table that you want to add an index to, right-click the Indexes node,
and then click New Index.
2. Right-click the new index, and then click New Field.
3. Right-click the field you added in step 3, click Properties, and then select a field from the
DataField property list.
4. Right-click the new index, and then click Properties.
5. Specify that the index is a non-unique index, confirm that the AllowDuplicates property is
set to Yes.

14
AX Training Documentation
Relations
Relations can be created between two tables only if there is a related data. Generally relations are
defined on child tables.

In AX there 4 types of relations. They are

1. Normal Relation
2. Related Fixedfield Relation
3. Fixed Field Relation
4. Foreignkey Relation

Normal Relation:
In the Field property, select the field in the primary table that relates to a field in the present table.
In the RelatedField property, select the field in the related table.

Field fixed:
In the Field property, select the field in the primary table to use to restrict the records. In the Value
property, enter the value of the selected field as the filter. This relates only records in the primary
table that match that field value.

Related field fixed Relation:

In the Value property, enter the filter value of the selected field. This causes only records in the
related table that match that field value to be related. In the Field property, select the field in the
related table to restrict the records. Each of the related fields are AND'ed in the table relation

ForeignKey Relation:

To specify a correspondence between a foreign key field in the present table to the primary key
field in another parent table.

15
AX Training Documentation
Delete Actions
Delete actions are added in the AOT, by right-clicking on the DeleteActions node of a Table AOT
element. Select New Delete Action and then select the table on which this delete action will be
based.

 None
 Cascade
 Restricted
 Cascade + Restricted

None:

A none deletion action will delete selected row in the table but nothing occurs to the table that
relate to this table.

Cascade:

A cascading deletion action will delete all records in the related table, where the foreign key is
equivalent to the primary key of the current table. That is, deleting the parent record will also delete
the child record(s) in the related table.

Restricted:

In cascade delete action if you try to delete any records in parent table it populates a warning
message that records cannot be deleted as the related data is child table.

Cascade + Restricted:
In The delete action performs a restricted, if the record of the table will be deleted directly and
performs a cascade, if the record of the table will be deleted through a cascade delete action of a
other table.

16
AX Training Documentation
Types of tables
There are three types of table in AX they are;

Value Description

Regular The default value. These are permanent tables.

Temporary InMemory A temporary table that exists as an indexed sequential access method
(ISAM) file. The ISAM file can exist on either the client tier of the
Application Object Server (AOS) tier. The underlying Microsoft SQL
Server has no connection to the ISAM file.
The system does allow you join an InMemory table in the X++ SQL
syntax. However, joins and other set operations with InMemory tables
are usually inefficient.

Temporary TempDB A temporary table that resides in the TempDB database of the
underlying SQL Server. The nonstandard format of a TempDB table
causes the table to be dropped when it is no longer in use by the
current method. Joins and other set operations on TempDB tables can
be efficient.

Jobs:

 Jobs are self-executable programs.


 Mainly we use jobs for testing sample piece of code.

17
AX Training Documentation
Conditional Statements
In programming languages such as X++, you can specify conditions under which a block of code
must be executed or skipped. Each conditional test evaluates to either true or false.

if and if ... else Statements:

The if statement evaluates a question (a condition) and executes a statement or set of statements if
the condition is true. You can provide an alternative statement or set of statements that are executed
if the condition is false (the else statement).

Syntax:
if ( expression ) statement [ else statement ]

Example
Without else With else

if (a>4) if (a>4)
{ {
print a; print a;
} }
else
{
print "a is less than or equal to 4";
}

Switch Statements:

The switch statement is a multi-branch language construct. You can create more than two branches
by using the switch statement. This is in contrast to the if statement. You have to nest statements
to create the same effect.

Syntax
switch ( Expression )
{
case Constant :
Statement ;
break;
...
default:
Statement ;
break;
}
18
AX Training Documentation
Example:

switch (Cust.AccountNo)
{
case "1000" :
do_something;
break;
case "2000" :
do_something_else;
break;
default:
default_statement;
break;
}

Ternary Operator:

The ternary operator is a conditional statement that resolves to one of two expressions. This means
that a ternary operation statement can be assigned to a variable.

Syntax
expression1 ? expression2 : expression3

19
AX Training Documentation
Loops
Loops are repetitive constructs. X++ has three kinds of loops:
 while loops
 do...while loops
 for loops

While Loops:

A while loop enables you to repeatedly execute one or more statements, as long as a condition is
true. The statement is executed from zero (not at all) to many times, depending on how many times
the condition is met.

Syntax
while ( expression ) statement
statement can be replaced by a block of statements.

Do...while Loops:

The do...while loop is similar to the while loop, but differs in that the condition follows the
statement. The statement is always performed at least once. The do...while loop is well suited for
tasks that always must be done at least once

Syntax
do
{ statement }
while
( expression ) ;
statement can be a block of statements.

For Loops:

The for loop is very similar to the while loop, but has the following additions:
 The initial value to a control variable can be assigned.
 There is a statement for incrementing or decrementing the variable.

Syntax

for ( Initialization ; Test ; Increment )


{
Statement
}
20
AX Training Documentation
Classes in X++
A class is an entity that determines how an object will behave and what the object will contain. In
other words, it is a blueprint or a set of instruction to build a specific type of object.

Variables are the data for the class. Variables in an X++ class are specific to objects that are
constructed from that class. Every object constructed from the class declaration has its own copy
of the variables. Such variables are known as instance variables. You cannot declare static
variables in X++.

Syntax of Class:

Class classname( )
{

Variables declared in class are called global variables.

Access Specifiers in X++:

There are mainly three types of Access Specifiers

public Methods that are declared as public are accessible anywhere the class is accessible
and can be overridden by subclasses. Methods that have no access modifier are
implicitly public.

protected Methods that are declared as protected can only be called from methods in the
class and in subclasses that extend the class where the method is declared.

private Methods that are declared as private can be called only from methods in the class
where the private method is declared.

21
AX Training Documentation
Methods in X++
Methods is a collection of statements that are grouped together to perform an operation.

There are three types of methods.

 Instance methods
 Static methods
 Main methods

Instance Methods
Instance methods, or object methods, are embedded in each object that is created from the class.
They are called by using the following syntax:

objectHandleName.methodName();

You must instantiate the object before you can use the method.

Static Methods
Static methods, or class methods, belong to a class and are created by using the keyword static.
They are called by using the following syntax:

ClassName::methodName();

You do not need to instantiate an object before you use static methods. Static methods are widely
used in Microsoft Dynamics AX to work with data that is stored in tables.

Main Methods
A main method is a class method that is executed directly from a menu option.

static void main (Args _args)


{
// Your X++ code here.
}

The method should only create an instance of the object and then call the necessary member
methods. The _args parameter allows you to transfer data to the method.

22
AX Training Documentation
Select Statements
X++ uses select statements to fetch data from the database. And the advantage of X++ is that Select
statements can be written from code like any other statements.

Below is the path to use Select statements in your code:

1. Declare variable: In order to use a select statement you must first declare variables for the
tables being referenced

2. While select: A special form of the while statement, while select, can be used to create a loop
that will fetch all of the records that fulfill specific criteria.

3. Selection criteria: The selection criteria are defined using expressions based on operators and
variables. Just prepare a criteria based on your requirements and while select will take care of
rest.

Example of simple Select Statement:

CustTable custTable;

select * from custTable;


info(custTable.AccountNum);

Example of While Select:

void printTel()
{
CustTable custTable;
;

while select custTable order by Name


where custTable.AccountNum > "1000" && custTable.AccountNum <= "5000"
{
Info(strfmt(“%1 %2”, custTable.Name," ", custTable.Phone));
}
}

23
AX Training Documentation
Table Methods
Whenever records are changed, inserted or deleted from a table various default methods are
executed. We can change the default methods and by doing so we are overriding the default
methods. To override a method go to the Methods node of a table, right click and choose Override
Method. Below are few examples of Overriding commonly used Table methods:

System-defined
Description
method

initValue Executed when a new record is added. If you want initializing some default
values in the time of creating new record initvalue ( ) method is called.

validateField Executed when you leave a field in a record.


For example, after entering changes to a field on a grid control, you could
click another field in that same record or on a different record. Or you could
click another control on that same form.
The super() method invokes field validation checks, as guided by the value
of the Validate property.

modifiedField Each time the value of a field is changed the method modifiedField ( )
is called. It is useful to initialize the values of other fields if the value of
the current field is changed.

validateWrite Executed when a record is written to the database, before the data change is
committed in the database.
The super() call examines all fields for the setting of
the Mandatory property.

24
AX Training Documentation

You might also like