Escolar Documentos
Profissional Documentos
Cultura Documentos
DEVELOPMENT IV
IN MICROSOFT DYNAMICS AX 2012
Table of Contents
Introduction
0-1
1-1
2-1
3-1
4-1
6-1
ii
Table of Contents
Chapter 7: Use and Design of the Accounts Receivable and Accounts
Payable Modules
7-1
Objectives ........................................................................................................... 7-1
Introduction ......................................................................................................... 7-1
Customers .......................................................................................................... 7-2
Vendors .............................................................................................................. 7-6
Free Text Invoices .............................................................................................. 7-9
Vendor Invoices ................................................................................................ 7-12
Payments ......................................................................................................... 7-15
Lab 7.1 - Export Vendor Payments .................................................................. 7-25
Collections and Interest .................................................................................... 7-31
Bills of Exchange .............................................................................................. 7-33
Promissory Notes ............................................................................................. 7-35
Lab 7.2 - Transfer Balances ............................................................................. 7-37
Summary .......................................................................................................... 7-39
Test Your Knowledge ....................................................................................... 7-40
Quick Interaction: Lessons Learned ................................................................. 7-42
Solutions ........................................................................................................... 7-43
8-1
9-1
iii
10-1
11-1
12-1
iv
Introduction
INTRODUCTION
Welcome
We know training is a vital component of retaining the value of your Microsoft
Dynamics AX 2012. investment. Our quality training from industry experts
keeps you up-to-date on your solution and helps you develop the skills necessary
for fully maximizing the value of your solution. Whether you choose Online
Training, Classroom Training, or Training Materials; there is a type of training to
meet everyone's needs. Choose the training type that best suits you so you can
stay ahead of the competition.
Online Training
Online Training delivers convenient, in-depth training to you in the comfort of
your own home or office. Online training provides immediate access to training
24 hours-a-day. It is perfect for the customer who does not have the time or
budget to travel. Our newest online training option, eCourses, combine the
efficiency of online training with the in-depth product coverage of classroom
training, with at least two weeks to complete each course.
Classroom Training
Classroom Training provides serious, in-depth learning through hands-on
interaction. From demonstrations to presentations to classroom activities, you
receive hands-on experience with instruction from our certified staff of experts.
Regularly scheduled throughout North America, you can be sure you will find a
class convenient for you.
Training Materials
Training Materials enable you to learn at your own pace, on your own time with
information-packed training manuals. Our wide variety of training manuals
feature an abundance of tips, tricks, and insights you can refer to again and again:
0-1
Challenge Yourself!
Level 3 exercises are the most challenging. These exercises are designed for the
experienced student who requires little instruction to complete the required task.
Step by Step
Level 1 exercises are geared towards new users who require detailed instructions
and explanations to complete the exercise. Level 1 exercises guide you through
the task, step by step, including navigation.
0-2
Introduction
Documentation Conventions
The following conventions and icons are used throughout this documentation to
help you quickly and effectively navigate through the information.
CAUTION: Cautions are found throughout the training manual and are preceded by
the word CAUTION in bold. Cautions are used to remind you of a specific result of a
specific action which may be undesirable.
HINT: Hints are found throughout the training manual and are preceded by the word
HINT in bold. Hints are used to suggest time-saving features or alternative methods for
accomplishing a specific task.
NOTE: Notes are found throughout the training manual and are preceded by the word
NOTE in bold. Notes are used to provide information which, while not critical, may be
valuable to an end user.
BEYOND THE BASICS: Advanced information found throughout the training manual
is preceded by the words BEYOND THE BASICS in bold. Beyond the Basics provides
additional detail, outside of standard functionality, that may help you to more optimally
use the application.
EXAMPLE: Examples are found throughout the training manual and are preceded by
the word EXAMPLE in bold. Examples bring to light business scenarios that may better
explain how an application can be used to address a business problem.
0-3
Student Objectives
What do you hope to learn by participating in this course?
List three main objectives below.
1.
2.
3.
0-4
Introduction
Number sequencing is a necessary feature in an Enterprise Resource Planning
(ERP) system. Microsoft Dynamics AX uses a number sequence framework to
generate alphanumeric number sequences. These sequences can be used for
transaction documents such as sales orders, purchase orders, invoices, and
journals; or for master data entities such as customers, vendors, and employees.
The primary purpose of the number sequence framework is to provide unique,
user-friendly identifiers while maintaining a continuous or non-continuous
alphanumeric sequence.
This course is designed to explain how developers can perform customizations
using the number sequence framework. However, administrators may be
interested in the "Setup and Administration of Number Sequences" topic, which
describes how to configure and set up number sequences using the new number
sequence administration forms.
1-1
Overview
Microsoft Dynamics AX 2012 introduces two concepts to the number sequence
framework: segment and scope. A segment, which is synonymous with
parameter, is a data entity such as a legal entity, operating unit, or fiscal calendar
period that can be used to define a number sequence. In the enhanced number
sequence framework, a number sequence can have more than one segment. A
scope is a valid combination of segments used for a specific transaction or master
data entity. By using segment and scope, Microsoft Dynamics AX 2012 extends
the capabilities of the number sequence framework.
All segments in a scope must be related to the underlying transaction or master
data entity. For example, a journal transaction will have a relationship with the
segments of a legal entity and fiscal calendar period (through the transaction or
posting date) that make up its scope. The scope can be used to partition the entity
instances or transactions based on the segment values. In this example, a journal
transaction might be partitioned into categories based on the two segments in its
scope.
A unique number sequence code must be created for every possible combination
of legal entity and fiscal calendar period instances. For example, if there are two
legal entities with IDs 10 and 20, and there are fiscal calendar periods for every
calendar month in 2011, the user must define separate number sequences for each
combination. An example of a scope instance is 20-Jan11. An example of a
number sequence code for a journal might be JN-J-20-Jan11, in which JN
represents a journal. The number sequence format, J-20-Jan11, is a string that is
defined by the end-user to represent the identifier for the transactions for legal
entity 20 and fiscal calendar period January 2011. The actual instance of a
journal might have a generated number sequence such as J-20-Jan11-000340.
(The last number in the sequence, "000340," is a system-generated number.)
The concept of a number sequence reference, which is synonymous with an
extended data type, is carried forward from Microsoft Dynamics AX 2009.
When you create a number sequence, you must first create an extended data type
(EDT) with a label-such as SalesOrderID-for the new number sequence. The
label of this EDT is used as a reference. This reference is used to define a field on
a document or master data entity that requires a number sequence.
Supported Scopes
Microsoft Dynamics AX 2012 will convert a subset of existing transactions and
master data entities so they can use scopes such as a legal entity or global scope.
This enables Microsoft Dynamics AX 2012 to ship with predefined scopes for
this subset of entities. The rest of the data entities still have a default scope of
DataArea (or company).
1-2
Legal entity
Operating unit
TIP: Use the Legal entity scope when the underlying table does not include the
DataAreaID field and has a foreign key to the legal entity table, CompanyInfo.
For example, use this scope for the number sequence for the expense report
number that is in the expense report table, TrvExpTable.
Although the scope is predefined for a data entity, the segments within that scope
are configurable. This means if a scope consists of a legal entity and fiscal
calendar period, a user can decide to configure the scope to be only a legal entity
during implementation. However, there are some mandatory restrictions on scope
composition. If, for example, a fiscal calendar period is selected as part of a
scope, the inclusion of DataArea or legal entity is mandatory in that scope.
One limitation of the new number sequence framework is that the scope must
always be configured for a specific reference. You cannot define a scope based
on variations in the data. For example, suppose that the regulatory requirements
in France and China require you to generate a number sequence by using the
legal entity and fiscal calendar period segments. However, other countries or
regions might not have the same requirements. The administrator in a
multinational corporation might decide that it is not necessary to include both
segments for all countries or regions. However, you cannot define two different
scopesone to be used in France and China that includes legal entity and fiscal
calendar period segments, and another to be used in all other countries or regions
that includes only the legal entity segment. You could use the framework in such
a way that all countries or regions have the scope of legal entity and fiscal
calendar period, but display the number sequence format based on both segments
only in France and China. However, the numbers generated would still be
partitioned based on both segments in all companies.
A second limitation is that no references are provided out-of-the box that has a
fiscal calendar period segment. Extending the framework to include a fiscal
calendar period currently requires customization of existing parameters forms in
specific modules. The new Number sequences setup form does support a fiscal
calendar segment.
1-3
Segment Configuration
An administrator can configure the segments that are allowed for his or her
requirements. For example, out of the box, the application could allow for two
segments such as legal entity and fiscal calendar period. However, only the legal
entity segment might be included by default. The administrator can enable both
segments for their scenario by using the Segment configuration form.
In Microsoft Dynamics AX 2012, most references use either DataArea (or
company) or legal entity segments out of the box. There are several references
for master data entities that are shared across the application and do not use
segments. However, the framework allows an administrator to add segments such
as the fiscal calendar period.
1-4
1-5
You can use the Area, Reference, and Company drop-down lists to filter the
data that is displayed in the form.
TIP: The Company filter field only appears after you have selected an Area and
a Reference.
You can set up all required number sequences at the same time by using the Set
up number sequences wizard by clicking Generate in the New group of the
Action Pane, or you can create or modify individual number sequences by using
the Number sequences form.
1-6
NOTE: In the Hyper-V training environment, all number sequences are set up.
Therefore, you cannot run the wizard unless you first delete some number
sequences.
1-7
TIP: Use the Company scope when the underlying table includes the DataAreaId
field. For example, use this scope for the number sequence for the customer
account number in the customer table, CustTable.
c. Legal entity: A separate number sequence is used for each legal
entity.
TIP: Use the Legal entity scope when the underlying table does not include the
DataAreaId field and has a foreign key to the legal entity table, CompanyInfo.
For example, use this scope for the number sequence for the expense report
number that is in the expense report table, TrvExpTable.
d. Operating unit - A separate number sequence is used for each
operating unit.
e. Company and Fiscal calendar period - A separate number
sequence is used for each company and fiscal calendar period
combination.
f. Legal entity and Fiscal calendar period - A separate number
sequence is used for each legal entity and fiscal calendar period
combination.
1-8
Administration
The administration of number sequences is performed by using actions provided
in the Administration group on the Action Pane on the Number sequences list
page.
1-9
Extensibility Scenarios
This section is primarily intended for developers who want to call an API that
extends the NumSeqApplicationModule class to handle changes that are required
by the enhanced number sequence framework. This API is called to create new
fields on documents or master data entities that will use a number sequence.
In a common extensibility scenario, a developer creates new fields and makes use
of the new number sequence framework to generate values for those fields. There
are two main extensibility scenarios:
1-10
TIP: Make sure that you add the base enumeration and any other objects that
you create or modify to a project. This makes the promotion of changes to a
testing or production environment easier.
NOTE: An element for FleetManagement exists in the training environment by
default.
1-11
Class declaration
public class NumberSeqModuleFleetManagement extends
NumberSeqApplicationModule
{
}
protected void loadModule()
{
NumberSeqDatatype datatype =
NumberSeqDatatype::construct();
/* Vehicle Number */
datatype.parmDatatypeId(extendedtypenum(FMVehicleId));
datatype.parmReferenceHelp("Unique key for Fleet
Management vehicles");
datatype.parmWizardIsContinuous(false);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999999);
//Use the DataArea segment
datatype.addParameterType(NumberSeqParameterType::DataArea,
true, false);
this.create(datatype);
/* Rental Number */
datatype.parmDatatypeId(extendedtypenum(FMRentalId));
datatype.parmReferenceHelp("Unique key for rentals");
datatype.parmWizardIsContinuous(false);
1-12
this.create(datatype);
Right-click the Data Dictionary node in the AOT, and then select
Synchronize.
TIP: Notice that the DataArea segment describes the default segment for the
extended data types that are used for both vehicle number and trip number.
IMPORTANT: You will have to synchronize the database after you create a new
class that extends the NumberSeqApplicationModule class. This may take several
minutes to complete.
1-13
NOTE: This form can only be used for references that have a scope of DataArea.
The administration forms described in the Set Up and Administration topic
can be used for references that have any scope. These forms can be found in
Organization Administration > Common > Number Sequences.
TIP: You must add several variable declarations to the class declaration of the
form that you are modifying for the code sample provided to compile. Use the
following code sample to guide you.
NumberSeqReference
NumberSeqScope
NumberSeqApplicationModule
container
TmpIdRef
numberSeqReference;
scope;
numberSeqApplicationModule;
numberSequenceModules;
tmpIdRef;
1-14
1-15
NOTE: The code sample only includes a section of the loadModule() method.
If you want to additional segments, you must add another call to the
addParameterType() method before the call to the create() method.
1-16
1-17
NOTE: In the code sample provided, the call to the addParameterType() method
is commented out. Also notice that the sample provided is only a part of the
method.
1-18
1-19
Next you must override the create() method on the data source where the number
will be populated. Use the following code sample to guide you.
void create(boolean append = false,
boolean extern = false)
externally
{
// If created
element.numberSeqFormHandler().formMethodDataSourceCreatePr
e();
super(append);
if (!extern)
{
element.numberSeqFormHandler().formMethodDataSourceCreate(t
rue);
}
}
1-20
Next, you must override the delete() method on the data source where the number
sequence is being inserted. This is an important step that will make sure the
number sequence is canceled and deleted when a record is deleted from your
form that has a number sequence.
void delete()
{
ttsbegin;
element.numberSeqFormHandler().formMethodDataSourceDelete()
;
super();
ttscommit;
}
The last step is to override the close() method on the form to make sure that the
number sequence is canceled when the form is closed. Use the following code
sample to guide you.
void close()
{
if (numberSeqFormHandler)
{
numberSeqFormHandler.formMethodClose();
}
super();
}
1-21
Challenge Yourself!
Isaac must implement a new number sequence for the customer contract ID. He
has already created a new extended data type(CustContractID), contract table
(CustContract), and form (CustContract) to store all the contract information.
Now you must create a new number sequence reference and add it into the
Accounts receivable parameters form. Make sure that you set up the number
sequence format and select it in the Accounts receivable parameters form.
When you are finished, implement the Form Handler on the CustContract form
and make sure that the system will populate the customer contract ID
automatically with the new number sequence when you are finished.
IMPORTANT: You must import the AX2012_ENUS_DEVIV_LAB.xpo file which
is located on the local drive of the training image before starting this lab.
1-22
1-23
10. Click Save, and then close the Code Editor window.
11. Right-click the Data Dictionary node in the AOT window, and then
click Synchronize.
NOTE: The Synchronize process can take several minutes to finish.
1-24
7. Save the method, and then close the Code Editor window.
1-25
8. Save the method, and then close the Code editor window.
1-26
numberSeqFormHandler;
5. Save the method and then close the Code Editor window.
To instantiate the number sequence form handler class in the customer contract
form, follow these steps.
6. Right-click the Methods node of the CustContract form in the
AOT window, and then click New Method.
7. Add the following code into the new method.
NumberSeqFormHandler numberSeqFormHandler()
{
if (!numberSeqFormHandler)
{
numberSeqFormHandler =
NumberSeqFormHandler::newForm(CustParameters::numRefContrac
tID().NumberSequenceId,
element,
custContract_DS,
fieldNum(CustContract, CustContractID));
}
return numberSeqFormHandler;
}
8. Save the method and then close the Code Editor window.
To override the create() method, follow these steps.
9. Expand the Data Sources node of the CustContract form in the
AOT.
10. Expand the CustContract data source and then right-click the
Methods node of the data source, and select Override Method.
11. Select Create from the list.
12. Add the following code into the create method.
void create(boolean append = false,
boolean extern = false)
externally
{
// If created
element.numberSeqFormHandler().formMethodDataSourceCreatePr
e();
1-27
13. Save the method and then close the Code Editor window.
To override the write() method, follow these steps.
1. Expand the Data Sources node of the CustContract form in the
AOT.
2. Expand the CustContract data source and then right-click the
Methods node of the data source, and select Override Method.
3. Select Write from the list.
4. Add the following code into the write method.
void write()
{
ttsbegin;
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
ttscommit;
}
5. Save the method and then close the Code Editor window.
To override the validateWrite() method, follow these steps.
1. Expand the Data Sources node of the CustContract form in the
AOT.
2. Expand the CustContracts data source and then right-click the
Methods node of the data source, and select Override Method.
3. Select validateWrite from the list.
4. Add the following code into the validate write method.
1-28
5. Save the method and then close the Code Editor window.
To override the delete() method, follow these steps.
1. Expand the Data Sources node of the CustContract form in the
AOT.
2. Expand the CustContract data source and then right-click the
Methods node of the data source, and select Override Method.
3.
1-29
1-30
Summary
This chapter provided an overview of how number sequences are set up in the
application. The chapter showed how the number sequence API works and how
to implement a number sequence API in a code. Additionally, the chapter
provided the steps that are required to implement a number sequence in a form.
The primary purpose of the number sequence framework is to provide unique,
user-friendly identifiers while maintaining a continuous or non-continuous
alphanumeric sequence.
An administrator can assign number sequences by using a page in the parameter
forms within individual application modules, or by using a wizard in the
Organization administration module.
The number sequence framework provides APIs that developers can implement
to create new number sequences with global scopes, company scopes, or other
organizational scopes. In addition the APIs can be used to implement number
sequence in a form so that when records are created the number record is updated
automatically with the next number available in the sequence.
1-31
1-32
2.
3.
1-33
Solutions
Test Your Knowledge
1. TRUE or FALSE? Scope segments cannot be modified for a number
sequence that is currently being used.
() TRUE
( ) FALSE
2. Describe the difference between a constant segment and an alphanumeric
segment on a number sequence format.
MODEL ANSWER:
Constant segments contain a set of alphanumeric characters that do not
change.
Alphanumeric segments contain a combination of number signs (#) and
ampersands (&). These characters represent letters and numbers that
increment every time that a number from the sequence is used. Use a number
sign (#) to indicate incrementing numbers and an ampersand (&) to indicate
incrementing letters.
3. Which of the following are supported scopes for number sequences in
Microsoft Dynamics AX 2012? (Select all that apply)
() DataArea
( ) Department
() Legal Entity
() Fiscal calendar
1-34
Introduction
There are many frameworks available in Microsoft Dynamics AX 2012. This
chapter provides descriptions of some frameworks, subsystems and features in
Microsoft Dynamics AX 2012. Frameworks are collections of design patterns,
interfaces, and code that provide support to you as a developer.
Eventing
Eventing is a design pattern for customization that is designed to enable nonintrusive, maintainable customizations. This technology enables you to customize
the system without extensively altering source code in the base application.
Eventing enables customization behaviors to be implemented in event handlers.
The event handler code is called in response to an event that is raised in the
course of the business logic execution on the system.
For more information about Eventing, refer to the "Event Handlers for
Customization" topic in this chapter.
Address System
Addresses are handled by the Address subsystem. The global address book, or
address subsystem, can help you understand the relationships among people and
organizations that are associated with your organization. For example, a customer
can also be a vendor in a marketing campaign, or a worker in your organization
can also be a vendor.
2-1
Query
Validate
Progress bar
Run
Client/server-optimized
2-2
Dimension
You can use the Dimension subsystem to work with financial dimensions. Use
the InventDim subsystem to work with inventory dimensions.
For more information about the financial dimensions subsystem, refer to the
"Dimensions" topic in the Application Foundation Features chapter.
Infolog
Information and messages to the user are located in the Infolog. It also contains
contextual information and supporting Help and actions. For more information
see the "Using the Infolog (http://go.microsoft.com/fwlink/?LinkId=238165)"
page on MSDN.
Number Sequence
Microsoft Dynamics AX has a number sequence framework to generate
alphanumeric number sequences that are used to identify transaction documents
such as sales orders.
NOTE: For more information, refer to the Number Sequences chapter in this
course.
2-3
NOTE: For more information, see the "How to: Create Progress Indicators
(http://go.microsoft.com/fwlink/?LinkId=238166)" page on MSDN.
Reporting
SQL Server Reporting Services (SSRS) is the primary reporting platform for
Microsoft Dynamics AX. The default, out of the box reports provided with
Microsoft Dynamics AX run on the Reporting Services platform. The new report
development environment takes advantage of extended SQL Server tools and
components. The report development environment is fully integrated into
Microsoft Visual Studio.
NOTE: For more information, refer to the Reporting chapter in this course.
Application Integration
The capability to integrate Microsoft Dynamics AX with other systems inside
and outside the enterprise is a common requirement. Application Integration
Framework (AIF) provides this capability by enabling the exchange of data
through formatted XML. This formatted XML is referred to as a document, and
each document contains data and business logic. Documents are based on a
document class and defined by using Microsoft Dynamics AX.
Microsoft Dynamics AX is shipped together with many standard document
services that support common business processes. By using the capabilities that
AIF provides, you can also customize existing document services or create your
own document services.
NOTE: For more information about services, AIF, and the BOF, refer to the
Application Integration Framework and Services in Microsoft Dynamics AX
course.
2-4
2-5
TIP: There are some differences in how X++ and C# implement the event design
pattern. For more information, refer to the "X++ and C# Comparison: Event
(http://go.microsoft.com/fwlink/?LinkId=238167)" page on MSDN.
Terminology
X ++ events in Microsoft Dynamics AX 2012 are modeled after .NET eventing
concepts. The following table lists the terms in Microsoft Dynamics AX 2012
related to events.
2-6
Term
Definition
Producer
Consumer
Event
Event payload
Delegate
For example, a delegate for an event that is raised when a person is hired could
be expressed as follows.
delegate void hired(str
startingDate)
{
name, UtcDateTime
TIP: You can right-click a class and select New > Delegate to create a new
delegate or you can click the New icon from the Code Editor and type the code.
The following figure shows a class named HireWorkerEventSample that includes
a delegate called hired that accepts a string and a date.
TIP: The lightning bolt icon indicates that this is a delegate and not an X++
method.
2-7
NOTE: The code sample provided is only an example. This code will not compile
in Microsoft Dynamics AX because there is no Employee table.
The parameters that are defined in the parameter profile can be any type allowed
in X++. It is useful to pass an object instance, and to have the handlers modify
the state of that object, so that the publisher can ask for values from the
subscribers. Event handlers are run within the caller's transaction context.
Subscribers can be added to the event in one of two waysthrough modeling for
example, in the Application Object Tree (AOT) or through X++ code execution.
Automatic Events
Automatic events are triggered by the environment as the result of something
occurring. Currently, a developer can indicate an event is triggered when a
method is called. This is described in the following sections.
Pre and Post are predefined events that occur when methods are called. The preevent handlers are called before the execution of the designated method, and the
post-event handlers are called after the method call has ended. It might be useful
to understand this to augment the existing method with methods called before
and after the normal body, as shown in the following figure.
Calls to the pre- and post-event handlers are inserted into the code generated for
the delegate when that delegate is compiled. Therefore, there is no overhead
penalty incurred by accessing metadata at runtime. In other words, the additional
code in the pre and post handlers has the same overhead as adding the same code
into the original method.
2-8
Each of the pre-event handlers can access the original values of the parameters
and modify them as required. The post-event handlers can modify the return
value of the called method.
Event Handlers
Event handlers are the methods that are called when the delegate is called, either
directly through code (for the coded events) or from the environment (in the
modeled events). The relationship between the delegate and the handlers can be
maintained in the code or in the AOT.
2-9
The same parameters that are on the host method that the event
handler subscribes to.
2-10
2-11
A pre-method event handler receives the same parameter values that the host
method receives. However, this event handler cannot modify the value of any
value type parameters that refer to the host method.
A post-method event handler receives the same parameter values that the host
method received. However, this event handler does not receive the return value
from the host method.
2-12
3. Create a new static method for the event handler and use the
following code sample.
// CalledWhen = Pre.
static public void formatWholeNameEhBefore(XppPrePostArgs
ppArgs)
{
str firstName;
firstName = ppArgs.getArg("_firstName");
if ("Dave" == firstName)
{
ppArgs.setArg("_firstName", "David");
}
else if ("Bill" == firstName)
{
ppArgs.setArg("_firstName", "William");
}
}
2-13
2-14
2-15
Maintain the semantics implied by the event from one version to the
next. Part of the usefulness of events comes from the preservation of
the semantics of the events. As soon as an interface is defined, third
parties will be able to leave their existing code unmodified if the
semantics are left unchanged (even though the implementation
behind might be modified).
Document the events that you create well because this will help
anyone who is performing the customization later.
Favor defining events over creating pre and post events on methods.
Events are strong interfaces, whereas methods are an implementation
artifacta method's responsibilities and parameters can change over
time, and they can disappear completely if the developer so decides.
Try to raise an event from outside the class in which the event is
defined. The X++ compiler disallows raising events from outside the
class by design.
2-16
X++ development
Services
The integration components in all these methods interact with the Application
Object Server (AOS), shown in the following figure.
2-17
X++ Development
X++ development is the programming model in which the developer directly
adds or alters Microsoft Dynamics AX metadata and/or X++ source code. This
model provides complete access to all the base functionality implemented in the
lower layers in the system. This is the most commonly used programming model
in Microsoft Dynamics AX development.
Advantages:
Disadvantages:
Disadvantages:
2-18
Disadvantages:
Services
Exposes Microsoft Dynamics AX functionality through WS-* standardscompliant service interfaces. In addition to exposing functionality through
services that ship with Microsoft Dynamics AX 2012, Microsoft Dynamics AX
2012 also provides declarative language constructs (X++ attributes) and
development tools so that you can quickly expose existing X++ business logic as
services without additional coding.
Advantages:
Firewall friendly.
Disadvantages:
2-19
Services: With AIF you can expose any business logic as a service to
be consumed by other applications. Within Microsoft Dynamics AX
you can create, customize, and publish services.
NOTE: For more information about standard document services and how to
create your own document services, refer to the Services and AIF development
(http://go.microsoft.com/fwlink/?LinkId=238168) page on MSDN.
Document services exchange data in the form of XML documents. Document
services provide the tools to build business-to-business (B2B) and application-toapplication (A2A) integration between your system and trading partners or other
external software systems. AIF includes many services that encapsulate common
business functionality that you can use out of the box. Additionally, there is a
wizard that you can use to create your own custom document services.
AIF document services have the following types of exchanges.
TIP: Internet Information Services (IIS) only needs to be installed if you are
configuring an Enhanced Inbound Port. IIS is not required for basic ports,
because they are hosted by the AOS itself.
2-20
Custom Services are services that you create to expose X++ logic
through a service interface. You can use the business logic with
inbound or outbound transfers. The types of services are developed
by using the Business Operation Framework (BOF). This is done by
creating X++ classes that expose their logic through the use of
attributes available within the BOF.
With Microsoft Dynamics AX, you can consume external web services from
X++ code, and consume web services hosted by Microsoft Dynamics AX from
.NET Framework languages such as Microsoft Visual C#.
Microsoft Dynamics AX supports application integration and data exchange in
both intranet and Internet-facing scenarios. Services that are based on WCF
classes are hosted on the AOS for applications to integrate within the intranet of a
company. To consume or expose services over the Internet, you must install and
use IIS. For more information about Microsoft Dynamics AX web services on
IIS refer to the Install web services on IIS
(http://go.microsoft.com/fwlink/?LinkId=238169) page.
2-21
To create a Business Operation Framework service, you must follow these steps.
NOTE: For more information about services, AIF, and the BOF, refer to the
Application Integration Framework and Services in Microsoft Dynamics AX
course.
NOTE: Additional examples of how to use the BOF can be found in the
Workflow and Reporting chapters later in this course.
2-22
Interop to X++
A proxy class is a .NET Framework class that provides access to one X++ item
type of Microsoft Dynamics AX. You can build proxies for the following X++
item types:
CAUTION: You cannot build a proxy for an X++ interface. If you try, a proxy is
generated for a .NET Framework class which at best approximates the interface.
This incorrect translation into a class causes some common scenarios to fail, and
it might create problems in future releases.
You can generate the proxy C# or Visual Basic source code by using the
Application Explorer in Microsoft Visual Studio. Proxies are usually a better
alternative to .NET Business Connector. .NET Business Connector requires your
C# code to use a late-bound programming model. Proxies provide an early-bound
programming model. With the early-bound model the Code Editor can provide
IntelliSense, and it can also catch misspellings and other errors at compile time,
that is, before the code is run.
There are different scenarios for constructing a proxy object from a proxy class
that is written in C# or in another .NET Framework language. The following
topics describe three possible scenarios.
2-23
The C# Method
using System; // C#
namespace CSharpDll
{
public class CSharpClass
{
static public string CalledFromXppDc
(DictClass pxyDictClass)
{
return pxyDictClass.name();
}
}
}
2-24
}
}
NOTE: This code sample is theoretical and will compile if pasted directly into a
C# Class Library. Additional code would be required for this example to work.
2-25
dataAreaId)
{
string paymentMode = String.Empty;
CustTable custTable = new CustTable();
// Search for the customer.
custTable =
CustTable.findByCompany(dataAreaId, accountNum);
if (custTable.Found)
{
// Get the value for the
customer's payment mode.
paymentMode = custTable.PaymMode;
}
return paymentMode;
}
public bool GetCustomerCreditLimit(string
accountNum,
string
2-26
dataAreaId)
{
bool hasCreditLimit = false;
CustTable custTable = new CustTable();
// Search for the customer.
custTable =
2-27
null);
String.Empty;
// Create a session
using (Session session = new Session())
{
session.Logon(null, null, null,
Class1
string
string
string
string
bool hasCreditLimit;
// Find the customer payment mode
paymentMode =
class1.GetCustomerPaymentMode(accountNum, dataAreaId);
hasCreditLimit =
class1.GetCustomerCreditLimit(accountNum, dataAreaId);
hasCreditLimitText =
(hasCreditLimit == false ? " and does not have" : " and
has");
// Write the data to the console
Console.WriteLine("Customer " +
accountNum + " in company " + dataAreaId + " has a payment
mode of " + paymentMode + hasCreditLimitText + " a
mandatory credit limit." );
Console.ReadLine();
}
}
}
}
2-28
Name Pattern
There is a pattern of name correspondence between values of the X++ Exception
enum and the .NET Framework exception classes that represent the enum values.
There are 15 elements in the Exception enum. The following table shows three
examples of the pattern. For example, the last row in the table shows that the
enum element and the exception class are both named with the word Deadlock.
X++ Exception enum
element
Word in
common
Exception::Error
Error
Microsoft.Dynamics.AX.ManagedInt
erop.ErrorException
Exception::Warning
Warning
Microsoft.Dynamics.AX.ManagedInt
erop.WarningException
2-29
Word in
common
Exception::Deadlock
Deadlock
Microsoft.Dynamics.AX.ManagedInt
erop.DeadlockException
2-30
Static: System.Convert::ToString
Instance: netString.Substring
2-31
2-32
X++ Type
CLR Type
boolean
System.Boolean
date
System.DateTime
int
System.Int32
in64
System.Int64
str
System.String
guid
System.Guid
real
System.Single or System.Double
xppBool = true;
xppBool = netBool;
if (false == xppBool)
{
info("B1. Good, X++ was marshaled to .NET.");
}
else
{
info("B2. Bad, X++ was not marshaled to .NET.");
}
TIP: For additional code samples for marshaling between the .NET Framework
types and the X++ counterparts, refer to the "How To: Marshal Between X++
and CLR Primitive Types (http://go.microsoft.com/fwlink/?LinkId=238171)"
page on MSDN.
2-33
2-34
2-35
2-36
This X++ code represents the client job that calls the
server method.
static void RunOnClientJob(Args _args)
{
System.String sNet;
str strXpp;
// This call fails.
sNet = RunOnTheServerClass ::GetASystemStringMethod();
strXpp = sNet;
info(strXpp);
}
An attempt to run this code example causes an error because the CLRObject is
not initialized.
2-37
2-38
Additional Information
Use X++ Syntax for CLR Arrays
X++ has syntax that you can use to directly create and handle .NET Framework
arrays. The syntax is an alternative to constructing instances of System.Array
directly, and the underlying effect is the same. The syntax is easier to write than
the verbose alternative of using a variable declared as .NET Framework type
System.Array. For more information, refer to the How to: Use X++ Syntax for
CLR Arrays (http://go.microsoft.com/fwlink/?LinkId=238172) page on MSDN.
2-39
The AOS handles the items in these two AOT locations differently from one
another.
2-40
2-41
Scenario: Hot-Swapping
The primary use for the hot-swap feature is in the following standard
development cycle with Microsoft Visual Studio. This involves the AOT >
Visual Studio Projects area, which is comparable to the Visual Studio Projects
area of the Application Explorer window for Microsoft Dynamics AX in Visual
Studio. The scenario begins with the following steps.
1. In Visual Studio, write the C# code for an assembly .dll that you will
call from X++ code.
2. Compile the .dll. Add more code, and compile again.
2-42
2-43
FIGURE 2.6 HOT-SWAPPING ON: EACH CLIENT HAS ITS OWN APPDOMAIN
IN THE AOS
You can turn on the hot swapping feature of the AOS by following these steps:
1. Open the Microsoft Dynamics AX server configuration utility by
clicking Start > Administrative Tools > Microsoft Dynamics AX
2012 Server Configuration.
To change the server configuration, you must run the utility with
administrative privileges.
2. On the Application Object Server tab, select Allow hot swapping
of assemblies when the server is running.
3. Click OK. A prompt will display that asks whether you want to
restart the AOS service. The change takes effect only after you
restart the AOS.
2-44
Summary
The Framework Features chapter introduced several different frameworks
available in Microsoft Dynamics AX.
Developers creating code that is customized by other users should create events
where customizations typically occur. Then, developers customizing the original
functionality in another layer can subscribe to an event. When the customized
functionality is tied to an event, the underlying application code can then be
rewritten and it will have little effect on the customization, if the same events are
raised in the same sequence from one version to the next.
There are many technologies that you can use to programmatically integrate
Microsoft Dynamics AX with other applications so that you can integrate
functionality or exchange data. These technologies include the following.
.NET Framework
You can use a proxy class for classes, tables, and enums. A proxy class is a .NET
Framework class that provides access to one X++ item type of Microsoft
Dynamics AX.
Additionally, you can use the .NET interop from X++ to access classes in
assemblies that are managed by the CLR in X++ code, and you can use AOT >
References or AOT > Visual Studio Projects to deploy your .NET assemblies
for interop.
2-45
a.
b.
c.
d.
e.
Event
Delegate
Event payload
Producer
Consumer
4. TRUE or FALSE? You should only use the hot-swap feature in your
production environment.
( ) TRUE
( ) FALSE
2-46
2-47
2.
3.
2-48
Solutions
Test Your Knowledge
1. What is the primary difference between using a reference versus a Visual
Studio project to deploy a .NET assembly for interop?
MODEL ANSWER:
AOT > References require ongoing deployments, whereas AOT > Visual
Studio Projects do not require you to redeploy the .dll files.
2. TRUE or FALSE? An X++ int does not marshal to a System.Int64, or the
reverse. A System.Int32 does not marshal to an X++ int64, or the reverse.
() TRUE
( ) FALSE
3. Match the eventing terms with their definitions.
d 1. The logic that contains the code that causes a
change.
b 2. The definition of the information passed from
the producer to the consumer when an event occurs
e 3. The application code that represents an
interest in being notified when a specific event
occurs.
a 4. A representation of a change that happened in
the producer.
c 5. The information that the event carries with it.
a.
b.
c.
d.
e.
Event
Delegate
Event payload
Producer
Consumer
4. TRUE or FALSE? You should only use the hot-swap feature in your
production environment.
( ) TRUE
() FALSE
5. Which of the following methods can be used to subscribe to an event? (Select
all that apply)
() Create an event handler underneath a method.
() Create an event handler underneath a delegate.
() In X++ by using the following command: [DelegateName] +=
EventHandler::[EventHandlerName]
( ) In X++ by using the following command" [EventHandlerName] +=
Delegate::[DelegateName]
2-49
2-50
Review the data model and classes for the Global Address Book
framework.
Modify the Extensible Data Security policy for the new Global
Address Book entity.
Introduction
There are many application foundation features in Microsoft Dynamics AX 2012.
This chapter introduces several of these features.
Extensible data security policies (XDS): You can use the XDS
policies to control the security of data within the system.
3-1
3-2
Address Defaulting
An address defaulting methodology is implemented that lets users select which
address should be used as the default for a transaction. The customer, vendor,
legal entity, and prospect forms let the user specify a default address for a
specific purpose. Depending on the transaction, there are different defaulting
flows for addresses.
Terminology
The terms used with the GAB include the following.
3-3
In the earlier versions, the party tables, including DirPartyTable, are striped by
dataArea, and are shared across companies by virtual tables.
In Microsoft Dynamics AX 2012, the use of dataArea is removed for party
related tables. This means that the party data is not saved for each company
(SaveDataPerCompany = No). Party tables are now shared, which means that the
need for setting up virtual tables is eliminated.
In Microsoft Dynamics AX 2012, names for organization and person are now
date-effective. Date-effective names are supported by the use of the
ValidTimeStateFieldType property of the table. The affected tables include
DirOrganizationName and DirPersonName.
3-4
In the earlier versions, primary address and contact information for party entities
is stored in the table for each entity (vendor, customer, worker, contact person,
prospect (business relation), applicant, competitor, and external and internal
organizations.
In Microsoft Dynamics AX 2012, the Address table is now deprecated and is
replaced by the shared table LogisticsPostalAddress. All address fields are now
removed from party and non-party related tables. Information from these tables
moved to the LogisticsPostalAddress table. Contact information fields are now
also removed from party related tables and moved to the
LogisticsElectronicAddress shared table. Non-party related contact information
fields remain unchanged.
3-5
DirPartyLookup Class
Both the DirPartyRecId and DirPersonRecId extended data types automatically
inherit the lookup for party or person without any filter.
If you need the lookup to be filtered, you can use the DirUtility::nameLookup()
or DirUtility::personNameLookup() to do this. This uses the
DirPartyLookupEntitiesFilter class to filter by the party role. For more
information, refer to the following code sample taken from the
AuditPolicyAdditionalOption form.
public Common lookupReference(FormReferenceControl
_formReferenceControl)
{
Common ret;
dirPartyLookupEntitiesFilter
dirPartyLookupEntitiesFilter;
dirPartyLookupEntitiesFilter =
dirPartyLookupEntitiesFilter::generateDirPartyLookupEntitie
sFilter(
(auditPolicyListParty.AddressBookRole ==
DirPartyRoleView::All ? NoYes::Yes :
NoYes::No),
(auditPolicyListParty.AddressBookRole ==
DirPartyRoleView::CustomersOnly ?
FilterStatus::Set
: FilterStatus::Undefined),
(auditPolicyListParty.AddressBookRole ==
DirPartyRoleView::VendorsOnly ?
FilterStatus::Set
: FilterStatus::Undefined),
(auditPolicyListParty.AddressBookRole ==
DirPartyRoleView::BusinessRelationsOnly ? FilterStatus::Set
: FilterStatus::Undefined),
3-6
element,
false,
dirPartyLookupEntitiesFilter);
return ret;
}
BankAccountTable
BankGroup
IntrastatParameters
CustBankAccounts
VendBankAccounts
HcmWorkerBankAccounts
3-7
CustTable
tutorial_Form_GABPrimitive
HcmApplicantBasket
InventLocation
VendTable
HcmWorker
3-8
TIP: We recommend that you use the right-click > Duplicate feature in the
Application Object Tree (AOT) and the drag-and-drop functionality. This also
works for methods.
2. Create menu items for the Add, Edit, Deactivate, Remove, Advanced
and Map buttons with the following properties.
a. Label = @SYS2318 (Add), @SYS2475 (Edit), @SYS23466
(Advanced), @SYS134283 (Deactivate), @SYS311855 (Remove),
@SYS136333 (Map)
3-9
4.
3-10
You can create address books at any time and if you select, you can set security
parameters for the address books at any time. Setting security for address books
is not required in Microsoft Dynamics AX. However, if you do not restrict access
by legal entity, or if security privileges are not set for an address book, all
workers in your organization can view all party records. You can use the
Security policy options link in the Global address book parameters form to
select whether the enforcement of security privileges for address books is based
on teams, legal entities, or both.
Each method for setting security privileges on the global address book uses an
extensible data security (XDS) policy in the AOT. When you add a new global
address entity, we recommend that you add your address entity tables as
constrained tables to the appropriate security policies in the AOT.
3-11
Concept Review
The following list defines the concepts of the XDS model.
Primary table
You can use a primary table to help secure the content of the related constrained
table. For example, in a policy restricts access to all sales orders based on the
CustGroup foreign key value, the Customer table would be the primary table.
Policy query
You can define a policy query by specifying a value for the Query property in the
AOT at Security > Policies > YourPolicy. You can use a policy query to help
secure the constrained tables specified in a given security policy. The query
selects data from a primary table. The values in that data are then used to restrict
the data returned from the constrained table.
3-12
Role context: Can enable policies that are based on the roles to
which the user is assigned.
Security Policies
A policy specifies the table row or record that can be accessed. This resembles
the WHERE clause in a SQL view or statement that specifies the table records to
be returned.
All security policies start with a query that is defined under AOT > Queries. The
VendProfileAccountPolicy query, shown in the following image, is the basis for
the policy that is described in this topic.
3-13
3-14
No: Means the policy does not restrict the data values in records that
are returned from the primary table.
Yes: Means the policy does restrict the data values in records that are
returned from the primary table.
Trimming
The security configuration of each field is assessed for the current user. This
security behavior is called field trimming because the restricted fields are
trimmed out of the results before the results are sent from the AOS to the client.
The code sample scans all fields that are under AOT > Data Dictionary >
Tables, for a specified range of tables.
When a user runs a query, the system can refuse to send data from the AOS for
particular columns that the current user has no authorization to access. The
access is controlled by the AOSAuthorization property that is available on each
field during run time. This property value cannot be known at compile time. The
run time value of the AOSAuthorization property is controlled by the roles that
the user belongs to.
The following code sample scans the system tables to find fields that the current
user cannot access, on tables that he can otherwise access. The code prints
progress reports to the Print window while it runs. The final output of field
names appears in the Infolog window.
The macros near the top of the code sample are explained in a section that
follows the code sample.
static void GmTrimAccessFieldScan3Job(Args _args)
{
// Edit the following three macro values to your
needs. For example:
// ** Start: with a table whose name starts with an
'A'.
// ** Stop: with a table whose name starts with a 'Z'.
#define.SearchTableNameRangeStart("")
#define.SearchTableNameRangeStop("")
#define.TargetTableNameLikeFilter("*")
TreeNode tnTable,
tnField;
str sTableAosAuth,
sFieldAosAuth;
int nCountOfTpfTablesFound = 0,
nCountOfAotTables = 0,
nCountOfTrimmedFields = 0;
// Establish start node among the table nodes.
if (#SearchTableNameRangeStart =="")
{
3-15
3-16
'\\Fields').AOTfirstChild();
tnField;
tnField =
tnField.AOTnextSibling()
{
sFieldAosAuth =
tnField.AOTgetProperty('AOSAuthorization');
// Test whether there is
authority to access the field.
if (sFieldAosAuth !=
'No')
{
nCountOfTrimmedFields++;
info(strFmt('%1 %2
is a trimmed field that you cannot access.',
tnTable.AOTname(),
tnField.AOTname()));
}
} // for each field in AOT
} // if table is guarded by the Table
Protection Framework (TPF).
} // name is Like
// Prepare for next iteration of this loop.
tnTable = tnTable.AOTnextSibling();
if (tnTable == null) break;
} // for each table in AOT
print "-------- Final Report (see also the Infolog)
--------";
print int2Str(nCountOfAotTables)
+ " tables examined to this point,
at end.";
print int2Str(nCountOfTpfTablesFound) + " TPF tables
found to this point, at end.";
print int2Str(nCountOfTrimmedFields) + " trimmed
fields found to this point, at end.";
print "-------- Done. --------";
pause;
}
3-17
3-19
3-20
3-21
Challenge Yourself!
Use the information that is provided to create a new extensible data security
policy for the HR Manager role that restricts access to view only vendors in the
Other group.
Step by Step
Inspect the Data You Want to Help Secure
1. Open the Microsoft Dynamics AX client.
2. Open Accounts payable > Setup > Customers > Customer
groups.
3. Verify that the Other vendors vendor group has an ID value of 80.
You will create a policy so that an application user can only work
with data for this vendor group.
3-22
Constrain Tables
You can add the VendTable table as a constrained table by following these steps:
1. Right-click the Constrained Tables node on the
OtherVendorsPolicy policy, and then click New > Add table by
relation.
2. Set the Table property to VendTable.
3-23
3-24
3-25
NOTE: For more information about the financial dimension framework and
examples of adding controls to forms and creating a new system-defined
dimension, refer to the Use and Design of the Ledger Module chapter in this
course.
Legal Entities
A legal entity is an organization with a registered or legislated legal structure that
is granted the authority to enter into legal contracts that is required to prepare
statements that report on its performance.
A legal entity and company in Microsoft Dynamics AX 2012 are semantically
the same. However, some functional areas in the application are still based on a
data model that uses company (or DataArea). These areas can have the same
limitations as in Microsoft Dynamics AX 2009, and can have an implicit data
security boundary.
Operating Units
An operating unit is an organization that divides the control of economic
resources and operational processes among people who have a duty to maximize
the use of scarce resources, to improve processes, and to account for their
performance.
Several types of operating units are available out of the box.
3-26
A department is a type of operating unit that can have profit and loss
responsibility and could be a grouping of cost centers. Departments
are also frequently created based on functional responsibility or skill,
such as sales and marketing.
Organization Hierarchies
You can set up organizational hierarchies to visually model your business from
different perspectives. For example, you can set up a hierarchy of legal entities
for tax, legal, or statutory reporting. Then you can set up another hierarchy that is
based on operating units that represents the way that you report financial
information that is not legally required. However, that is used for internal
reporting. For example, you can create a purchasing hierarchy to control
purchasing policies, rules, and business processes.
IMPORTANT: The only way to report based on the hierarchy is through
dimensions. Microsoft Dynamics AX 2012 does not use the hierarchy for
financial reporting.
TIP: Microsoft Dynamics AX 2012 does not support the hierarchies in the
account structures. If you have at least two segments backed by an organization
unit in the hierarchy, you can select the hierarchy in the Configure account
structure form by clicking the Relationships button. When you do this, the system
will adhere to the hierarchy and not force users to also set up the constraints in
the account structure.
Organizations in a hierarchy can share parameters, policies, and transactions. An
organization can inherit or override the parameters of its parent organization.
However, shared master data, such as products and address books, applies to the
whole organization and cannot be overridden for individual organizations.
3-27
Application Scenarios
The organization model is integrated with the application modules in Microsoft
Dynamics AX. There are two types of scenarios:
Address Book
All internal organizationslegal entity, operating unit, and teamare types of
the Party entity. This means that these organizations take advantage of the
capabilities of the address book to store address and contact information.
Financial Dimensions
Legal entities and operating units can be used to define financial dimensions, and
those financial dimensions can be used in account structures.
By using organizations as financial dimensions, you can perform an analysis of
an organizations financial performance. The relationships between organizations
described through hierarchies can also be used as constraints if two types of
organizations are used as separate financial dimensions in the account structure.
Policy Framework
In Microsoft Dynamics AX 2012, a business policy can be defined for an
organization by using the policy framework. The policy framework can be used
to define policies for expense reports, purchase requisitions, audit control of
documents, and vendor invoice payments.
The policy framework provides support for override and default behavior for
organizations based on their hierarchies, and enables internal management
control of organizations to facilitate cost control, fraud detection, better operating
efficiency, and better performance generally.
3-28
Transaction Scenarios
There are several application areas that use the new organization model
framework. The primary effect is in the following modules. Here is a brief
description of the usage. For a complete description and steps for the scenarios in
these areas, refer to the Help documentation.
Human resources
In human resources, workers hold employment contracts in a legal entity and
have a position in a department. All transaction scenarios in human resources
take advantage of these concepts to view and modify data.
Development
You can extend the organization model to support customization or special
configuration scenarios.
One of the core extensibility scenarios is extending the organization model for
specific industry vertical requirements such as retail, professional services, or
public sector. Branches, stores, schools, and school districts are basically
organization concepts. You can model them as new types of operating units. The
framework of the new organization model supports this extensibility by allowing
you to define a new type of custom operating unit.
3-29
3-30
3-31
3-32
3-33
3-34
Let you log dependent cases for complex issues that require more
than one resolution path.
Case Process
Organizations need all cases to be handled consistently according to company
policies and procedures. To make sure that this occurs, case processes can be
defined to guide your workers through a simple checklist or a more elaborate
step-by-step set of stages and actions. This provides consistency in resolving
cases, and helps new case workers to become efficient and perform at a high
level in a short period of time. After a case process is defined, it can be
associated with a specific case category so that your case workers will know
what has to be completed for each situation.
In addition to case processes, workflow can be defined so that cases can be
assigned to queues, which can be picked up by any case worker in a specific area,
such as auditing.
Knowledge Articles
To resolve cases efficiently, case workers need easy access to processes and
procedures, answers to frequently asked questions, how-to documentation, and
other organizational knowledge collateral. The ability to create and store
knowledge articles provides case workers with the information that they must
have to resolve cases quickly. To help ensure even faster resolution, you can
associate specific knowledge articles with a case category, which will default the
knowledge articles to any case by using that category. This functionality reduces
the time that you have to have for a case worker to search for documentation.
3-35
3-36
The CaseDetailsBase is the primary table for storing all cases regardless of where
the case is created from or which records the case is related to. Each case is
assigned a case category. Case categories are stored in the
CaseCategoryHierarchyDetail table. Each case can have logs or notes related to
the case. Each log entry related to a case is stored in the CaseLog table. When a
case is related to another case, this reference is stored in the CaseDependancy
table.
The CaseAssociation table is used to store a reference to each record that a case
is related to. The CaseAssociation table is then related to the primary table for
each type of association based on the CaseEntityType and RefRecId. For
example, when a case is related to a sales order, the CaseEntityType field would
store the enum value for the sales order table, and the RefRecId field would store
the RecID from the sales order that the case is related to.
3-37
Case Associations
Out of the box, cases can be related to the following data entities and tables.
Data Entity
Table
Lead
smmLeadTable
Opportunity
smmOpportunityTable
Customer
CustTable
Vendor
VendTable
Prospect
smmBusRelTable
Project
ProjTable
Sales order
SalesTable
Purchase order
PurchTable
Worker
HcmWorker
Service order
SMAServiceOrderTable
Item
InventTable
Customer transaction
CustTrans
TrvExpLine
Expense report
TrvExpTable
Vendor invoice
VendInvoiceJour
VendInvoiceTrans
PurchLine
Each case can have multiple associations and multiple associations of the same
type. For example, a case related to a specific customer, could also be related to
customer transactions.
3-38
3-39
3-40
if (caseMoreInformation_FMVehicles.visible() != showFMVehicle)
{
caseMoreInformation_FMVehicles.visible(showFMVehicle);
FMVehicle_DS.refresh();
}
Open Home > Area Page > Common > Cases > All cases.
Click Case in the New group of the Action Pane.
Select General > GEN1 in the Case category field.
Click Create.
Click No on the Create activity dialog box.
On the Associations FastTab of the Case form, click Add.
In the Entity type field, select Vehicle.
In the ID field, select a vehicle.
Save the record.
Click the Details button.
The Vehicles form should open to the vehicle you selected in step 7.
Close all the forms.
3-41
3-42
To test that the new buttons work correctly, follow these steps.
1.
2.
3.
4.
5.
6.
7.
8.
Open Fleet management > Common > Vehicles > All vehicles.
Select a vehicle.
Click the General tab on the Action Pane.
Click Create case.
Select a Case category.
Click Create.
Click No on the Create activity dialog box.
On the Associations FastTab, verify that an association is created for
the vehicle that you created the case for.
9. Close the forms.
3-43
Challenge Yourself!
Use the information that is provided to add rentals as a case association entity
type. Make sure that you add buttons on the Rental form to create the case and
automatically add an association.
3-44
3-45
3-46
if (caseMoreInformation_FMRental.visible() != showFMRental)
{
caseMoreInformation_FMRental.visible(showFMRental);
FMRental_DS.refresh();
}
To test the new case association type, follow these steps.
1.
2.
3.
4.
5.
6.
7.
8.
Open Home > Area Page > Common > Cases > All cases.
Click Case in the New group of the Action Pane.
Select General > GEN1 in the Case category field.
Click Create.
Click No on the Create activity dialog box.
On the Associations FastTab of the Case form, click Add.
In the Entity type field, select Rental.
In the ID field, select a rental. If there are no rentals, create one in
the Rentals form.
9. Save the record.
10. Click the Details button.
11. The Rental form should open to the rental you selected in step 7.
Close all the forms.
To add buttons to the Rental form, follow these steps.
1. Create a new Display menu item that calls the CaseDetailFormCreate
class. View the CaseDetailNewSales for an example of this.
2. On the FMRental form do the following.
o
o
o
If a General tab does not exist on the Action Pane, add one.
Add the menu item that you created in step 1 to the form.
Add the CaseDetails menu item to the form.
3-47
3-48
Policy Framework
Microsoft Dynamics AX 2012 introduces a policy framework that can be used to
define policy rules in modules to help guide the flow of business. The framework
provides a common pattern and rich feature set that users can take advantage of
to enforce simple rules or to evaluate and act on several different rules in a
complex organizational hierarchy. The actual rules used by businesses, and the
actions that these rules allow, prevent, or alter are outside the scope of the
framework. However, this white paper does provide examples of the policy types
and rule types that that are included with Microsoft Dynamics AX 2012.
NOTE: The policy framework is only used for defining and enforcing business
rules. It is not related to the framework that creates extensible data security
policies also being introduced in Microsoft Dynamics AX 2012.
There are three perspectives from which the policy framework can be viewed and
used, depending on the role of the user.
NOTE: One person often performs the role of developer and software developer.
Developers and administrators can use the policy framework to improve their
business processes by enforcing rules for Microsoft Dynamics AX 2012 users.
Examples of rules include the following.
3-49
Framework Components
The policy framework consists of three main components that provide the
functionality that corresponds to the developer and administrator roles described
earlier.
A common entry point for both the policy administrator and the
developer, who can use it to manage policies. Little customization is
required beyond entry of their business data.
These components provide the flexibility that developers and administrators must
have to achieve their objectives without problems. They also give the user the
same appearance and behavior as the rest of the policy user interface (UI) in
Microsoft Dynamics AX 2012.
Policy Types
A policy type is a collection of all the rule types that apply to a given module or
feature area.
A user in a manager role can be granted permission to define policies of a given
type through a menu item that opens a list page. The list page displays all the
policies of a particular policy type.
Microsoft Dynamics AX 2012 includes six policy types. These types are
specified with the following SysPolicyTypeEnum enumeration values.
3-50
ApprovalPolicy
AuditPolicy
PurchasingPolicy
TrvExpensePolicy
TrvRequisitionPolicy
VendInvoicesPolicy
Rule Types
Rules are at the core of any policy. The necessary data that defines how policies
will be enacted is located in rules. After a developer defines policy types and rule
types and he or she creates a policy, the policy administrator can add rules to that
policy. For example, suppose that an administrator adds a catalog rule to a
purchasing policy. The catalog rule is configured to specify the Adventure
Catalog for internal procurement. After the purchasing policy is associated with
a particular organization, all employees of that organization will see the
Adventure Catalog when they browse the internal procurement site.
Rules are date-effective, which gives you a set of powerful options for
manipulating policy events over time. You can define rules that take effect in the
present and expire sometime in the future, or that never expire. You can also set
up rules that will take effect at some specified point in the future. By defining
date-effective rules, you prevent multiple rules from being active at any given
time, when they might provide conflicting data.
After a rule has gone into effect, it can only expire or be discontinued. It can
never be removed from the policy. This constraint provides enhanced auditing
capability and historical policy retention. The policy framework can be queried
for the rules that were in effect at a specific time, if it is necessary.
As mentioned earlier, each rule is associated with a corresponding form. The
developer implements the form, which displays and stores data in the data model.
The administrator can then interact with this form to define and update the rule as
needed.
Organization Assignment
Before a policy can affect anyone, it must be associated with an organization.
The administrator configures the association with the organization on the
SysPolicy form after a policy is created. In the business logic, the developer
queries the API for rules that are in effect for a specific organization.
All hierarchies with a specific hierarchy purpose can be sources from which to
select organizations. An additional source from which to select organizations is
the flat list of legal entities in the CompanyInfo table, which are designated in
the policy framework as Companies. (An example would be a legal entity with
a DataAreaId of DAT.) Although not a true hierarchy, this can be thought of as
a default hierarchy type that is always available.
3-51
SysPolicyRule table
The SysPolicyRule table is the main table with which you will interact. To
demonstrate the design options that this table allows, you start with the output
and work backward. When you query the policy API (by using the
SysPolicies::getPolicyRuleIds method) for a list of rules for a given policy type,
rule type, and organization, the API returns an array of RecIds to the
SysPolicyRule table, which holds a list of specific rule instances. With this
strategy you can follow one of two general patterns shown for storing and
accessing your rule data. Select the pattern that best suits your requirements.
This is the more common pattern. There is just one set of data for each
rule, which is stored in one row in a table. To implement this pattern,
create a table that is a subtype of the SysPolicyRule table and add all the
fields required for your feature. A RecId that you receive from the policy
API will now directly correspond to a date-effective row in your table
(which is managed by the policy framework). You can directly query
your table without having to know that it extends the SysPolicyRule
table. You can view examples of this pattern in the
CatCatalogPolicyRule and TrvPolicyRule tables. For more information,
view the ER diagram.
3-52
Use this pattern when you have to store several rows of information for
each rule (meaning, the rules are displayed as a grid on the rule form). In
this case, create a table with the fields that you must have that is not a
subtype of the SysPolicyRule table. Instead, add a foreign key to the
SysPolicyRule table to establish a many-to-one relationship. By doing
this, you can reference many rows of data in your table with one
SysPolicyRule RecId. You can view examples of this pattern in the
ProcCategoryPolicyParameter and ProcCategoryAccessPolicyParameter
tables.
3-53
3-54
3-55
3-56
3-57
3-58
Summary
The Application Foundation Features chapter reviewed several features that are
used throughout the system.
The global address book is a central repository for addresses and contact
information. You can extend the global address book framework to create new
party types. You can also use the extensible data security policy framework with
the global address book framework to help secure address information across
legal entities, or teams, or both.
Developers and administrators can use security policies to block access to subsets
of data rows in tables. A policy resembles a where clause in an SQL select
statement. A security permission increases the access a user has to data, but a
security policy decreases access to data.
You can use financial dimensions to create "attributes" that you can use as
account segments for a shared chart of accounts. There are two basic types of
financial dimensions.
The organization model represents internal control, data security access, and
performance reporting structures designed to divide responsibility for human and
operations resources and work processes. The organization model in Microsoft
Dynamics AX 2012 introduces two new conceptslegal entity and operating
unit. You can extend the organization model framework to create new types of
operating units or new purposes for a hierarchy.
Case management provides the tools to handle issues more quickly and improve
customer, employee, and vendor relationships. You can extend the case
management framework to work with any data entity.
Microsoft Dynamics AX 2012 introduces a policy framework that is used to
define policy rules in modules to help guide the flow of business. The framework
provides a common pattern and rich feature set that users can take advantage of
to enforce simple rules or to evaluate and act on several different rules in a
complex organizational hierarchy. You can extend the policy framework to
create new policy types or new policy rule types.
3-59
3-60
a. Address book
b. Non-party
entities
c. Location
d. Party
e. Party roles
7. List the four basic steps for creating a new operating unit type.
3-61
2.
3.
3-62
Solutions
Test Your Knowledge
1. Which class is used to implement a single address on a form?
( ) DirUtiltity
( ) DirPartyLookup
() LogisticsEntityPostalAddressFormHandler
( ) LogisticsMultiEntityPostalAddressFormHandler
2. Which of the following are valid types of operating units that are available
out of the box? (Select all that apply)
() Department
() Cost Center
( ) Legal Entity
() Business Unit
3. Fill in the blanks with the name of the table that best describes the content of
the table to test your knowledge of this section.
Stores a reference to each record that a case is related to.
Stores the log entries related to each case.
The primary table for storing all cases.
CaseAssociation
CaseLog
CaseDetailsBase
Stores the parent child relationship between cases when a case is related to
another case. CaseDependancy
4. Put the following steps in order:
Step:
1
3-63
a. Address book
b. Non-party
entities
c. Location
d. Party
e. Party roles
7. List the four basic steps for creating a new operating unit type.
MODEL ANSWER:
Define a new Base Enum value for the OMOperatingUnitType that
corresponds to the new type of operating unit.
Define a query OMStoreQuery for the new type of operating unit.
Define a view OMStoreView based on the OMStoreQuery query.
Optionally, define a new menu item that corresponds to this operating unit to
create new instances of this type of operating unit.
8. Describe what "trimming" is.
MODEL ANSWER:
The security configuration of each field is assessed for the current user. This
security behavior is called field trimming because the restricted fields are
trimmed out of the results before the results are sent from the AOS to the
client.
3-64
Review the data model and key classes used for budgeting and
budget checking.
Introduction
The following section describes a series of tasks that show the functionality used
in the General ledger, Budgeting, and Fixed assets modules. Participants will
be given the opportunity to understand the purpose of these modules from a
users viewpoint. Additionally, several of the key data and object models related
to these modules will be reviewed.
4-1
4-2
4-3
From currency
To currency
Date
CurrencyExchangeHelper Class
The CurrencyExchangeHelper class is introduced in Microsoft Dynamics AX
2012. It is the recommended Application Programming Interface (API) to
perform calculations between currencies. The following examples illustrate its
usage for the most common scenarios.
This example calculates the amount in the context of the current ledger. This is
indicated by passing Ledger::current() to the constructor method of the
CurrencyExchangeHelper class.
CurrencyExchangeHelper currencyExchangeHelper;
TransDate transactionDate;
CurrencyCode transactionCurrency = 'CAD';
AmountCur amountToConvert = 100.50;
boolean shouldRoundResult = true;
AmountMst result;
currencyExchangeHelper =
CurrencyExchangeHelper::newExchangeDate(
Ledger::current(),
transactionDate);
result =
currencyExchangeHelper.calculateTransactionToAccounting(
4-4
NOTE: Additional code samples for calculating the transaction currency from
the accounting currency, and calculating the amounts by using an exchange rate
that is entered are available in the Shared Currencies and Exchange Rates
(http://go.microsoft.com/fwlink/?LinkId=238176)white paper.
ExchangeRateHelper Class
The same information used to perform currency calculations is used to work with
exchange rates.
From currency
To currency
Date
4-5
4-6
4-7
Will support multiple fiscal calendars for each legal entity. For
example, fixed assets could require two calendarsone for auditing
purposes and one for tax purposes. If you have multiple calendars
you can run parallel depreciations.
Reduces the amount of setup required for each legal entity because it
is possible to use the same fiscal calendar for multiple legal entities.
Before posting transactions, a new fiscal year must be divided into
periods since transactions cannot post unless a period is created for
the posting date.
Chart of Accounts
A chart of accounts is a set of main accounts tracked by Microsoft Dynamics
AX. It captures financial information that is used to make sound financial
decisions. Each account is assigned an account number as a unique identifier.
Each chart of accounts contains the account structures used by the chart of
accounts to define the segments and the valid combinations of main accounts and
financial dimension values. The chart of accounts is shared and it is also a list of
main accounts and structures, used to define a chart of accounts in use by one or
more ledgers.
Main account
Dimension values
4-8
Chart of accounts
Main accounts
Account structures
Advanced rules
Financial dimensions
Can be used throughout the system, and add dimensions to base data
such as:
o
o
o
Ledger accounts
Customers
Vendors
You can use the Financial dimensions form to create financial dimensions that
you can use as account segments for shared charts of accounts. Open General
ledger > Setup > Financial dimensions > Financial dimensions. There are two
basic types of financial dimensions.
4-9
Account Structures
You can use the Configure account structures form to create one or more
account structures. Open General ledger > Setup > Chart of accounts >
Configure account structures.
Accounts structures provide the segments and order of entry for the account
number. Main account is a required segment for an account structure, but it does
not have to be the first segment. The account structures are used to define the
valid combinations which, together with the main accounts, form a chart of
accounts. Multiple account structures allow a legal entity to track information for
specific accounts without affecting information in other accounts.
To change an existing account structure, and to enable some of the controls in
this form, you must click Edit, so that the account structure has a Draft status.
4-10
Main Account
The main account pattern represents just one of the possible segments in a ledger
account. A main account is required in a ledger account, but it does not have to
be the first segment. When referencing a main account as a foreign key, the
developer should set up a reference to the RecId field in the MainAccount table.
Ledger Account
A ledger account contains the main account, account structure, and the financial
dimension values that are needed to populate the related account structure and
account rule structures. A foreign key representing a ledger account is a 64-bit
integer field that contains the data from the corresponding RecId field in the
DimensionAttributeValueCombination (or LedgerDimension) table. Foreign key
fields for ledger accounts are named LedgerDimension because that is the alias
used for the DimensionAttributeValueCombination table.
Multi-type Account
The multi-type account pattern consists of an account type field and its related
ledger account or default account. In this pattern, a ledger account or default
account can store accounts other than ledger accounts. When the account type
field for the related account is set to ledger, this pattern becomes the default
account or ledger account pattern (depending on the extended data type used for
the field). If the account type field is not set to ledger, the pattern stores a
system-generated account structure (used to specify which account number
should be stored in the field) and an account number for the related account type.
For example, if the account type field is set to customer, the related account
number field will contain a customer number with a related account structure that
indicates that the account number field should contain a single customer value.
4-11
4-12
Default Dimensions
The default dimension pattern represents a set of financial dimensions and their
related values. A customer will set the values for given financial dimensions on
master data records for defaulting purposes or directly on some transactions. In
Microsoft Dynamics AX 2012, this pattern is represented by a single field. The
single field is a foreign key reference to the RecId field in the
DimensionAttributeValueSet table. This value references the correct record in the
4-13
Dimension Set
The dimension attribute set pattern represents a set of financial dimensions and
their related enumeration values. This pattern is used in advanced general ledger
processing where different financial dimensions can be handled differently, based
on these stored enumeration values.
The dimension attribute set pattern is used to store a set of financial dimensions
and related data, such as enumeration values. This pattern is used in places where
it is necessary to store additional information about dimensions, such as whether
they are optional or required. For an example of this implementation, refer to the
VendPaymMode form under Forms in the Application Object Tree (AOT). A
foreign key representing a dimension attribute set is a 64-bit integer field that
contains the data from the corresponding RecId field of the
DimensionAttributeSet table. The new model allows you to store an unlimited
number of financial dimensions.
4-14
4-15
4-16
5. Overload the following methods on the data source field that backs the
Segmented Entry control.
public Common resolveReference(FormReferenceControl
_formReferenceControl)
{
return
ledgerDimensionDefaultAccountController.resolveReference();
}
Control Options
There are four parameter methods available for specifying items that the control
can link to and validate. These parameter methods should be called in the
loadSegments method. These methods are called every time that the control
receives focus. Always declaring the parameters in one method ensures that
developers can easily verify whether all parameters have been correctly set.
4-17
NOTE: The parameter name (LedgerPostingType) differs from the one for the
Ledger Account control because, in this case, it only restricts what is shown in
the lookup when the filter is selected. For account entry, it prevents entry of
values entirely.
NOTE: There is no special control for the main account pattern. This pattern
uses a foreign key that has a standard pattern in Microsoft Dynamics AX 2012.
Control Options
The LedgerDimensionAccountController has several additional parameters
available for validating, looking up, and saving ledger accounts from the
Segmented Entry control. The following methods are used to set these
parameters.
4-18
System-Defined Dimensions
With system-defined dimensions, it is not necessary to maintain two separate lists
of values for an entity you want to track details for in the general ledger. When
you set up a system-defined dimension, the values for the entity are automatically
copied from the entity table into the dimension values. Any time the data is
modified or a new record is inserted into the backing entity table, the information
is automatically updated in the dimension values.
Scenario
Ken, the Controller, wants to track the vehicle details in the general ledger.
Simon, the Business System Developer, needs to create a new system-defined
dimension for vehicles so that Ken will not need to maintain a custom list of the
vehicles in the Financial dimensions form.
After the new system-defined dimension is created, Ken must set up the new
financial dimension to be linked to the vehicles backing entity. Then, he must
add the new financial dimension to the account structure or advanced rules for
the chart of accounts. Simon also needs to add defaulting logic to the Vehicles
form so that when a new vehicle is created, the financial dimension for vehicles
will default to the current vehicle ID and cannot be changed. Then he must add
logic to the Rentals form to copy the financial dimensions from the vehicle to the
rental record.
4-19
4-20
4-21
Challenge Yourself!
Use the information provided to create a new system-defined dimension for
rentals. The table that stores rentals is called FMRentals.
Step by Step
To add a new system-defined dimension, follow these steps.
1.
2.
3.
4.
4-22
4-23
Journals Overview
A journal is a worksheet you can use before you manually enter postings into the
system. Before you use financials in Microsoft Dynamics AX, you must
complete the setup procedures for journals. The procedures include the basic
setup of journals such as journal names, controls, and texts. You can use journals
quickly and efficiently when you set them up correctly.
Both manual and system generated journals exist in Microsoft Dynamics AX.
Examples of system generated journals are allocation journals and elimination
journals. These journals are created automatically and are never created
manually. Manual journal entries are generated by postings entered into the
system such as a general journal entry. When you use a manual journal entry the
transactions are not posted immediately. Before you post a manual entry, the
journal can be changed, reviewed, approved, or deleted.
In Microsoft Dynamics AX, you can use journals to do the following.
Review data imported from external ledger systems. You can ensure
that all valid fields contain a value and that all restrictions for the
transaction are fulfilled.
Make sure that the necessary voucher series is set up before you
create journals. You can set up number sequences and attach them to
the appropriate references.
Users can post transactions to the following accounts by using a general journal.
4-24
General ledger
Bank
Customer
Vendor
Projects
Fixed assets
Posting date
Amount
Accounts to post to
The information users enter in a general journal is temporary and can be changed
if it remains unposted within the journal.
4-25
4-26
4-27
The check() method is used when validating the journal. The checkWhenPost()
method is used when validating the journal during posting and the updateNow()
method handles the update of the posting.
The posting is handled over to the LedgerVoucher class.
Transactions Overview
The General ledger module records the value of all company assets. This
includes cash, accounts receivable, bank accounts, stocks, bonds, inventory,
buildings, and machinery. Any event that changes the value of these assets
should be reflected in ledger transactions.
4-28
4-29
4-30
GeneralJournalAccountEntry
LedgerEntry
GeneralJournalEntry
LedgerEntryJournal
LedgerVoucher Class
The task of the LedgerVoucher class is to control ledger transaction postings.
You can use this class when you post ledger journals and other updates that
contribute to ledger transactions. It verifies the posting is correct and that the
voucher balances. The LedgerVoucher class holds all the vouchers in temporary
storage (a list array) until the End method is called. The End method creates
ledger transaction records from the temporary postings.
An instance of LedgerVoucher can handle several individual vouchers in one
transaction. All vouchers handled will be updated in the sum tables in one
consolidated step.
Each voucher is represented by an instance of LedgerVoucherObject.
LedgerVoucherTransObject contains individual transactions that will be created.
A LedgerTrans variable is defined in the class declaration to contain the future
transaction. The class structure resembles the following.
Posting (LedgerVoucher)
Voucher (LedgerVoucherObject)
o
o
Trans (LedgerVoucherTransObject)
Trans
Voucher
o
o
Trans
Trans
If new fields are added to the ledger transactions, this object can also hold the
new information. The remaining task is to initialize the new fields which
involves the following two steps.
1. Creating parm-method(s) to assign values to the field(s).
2. Changing the static method new() to include the new parm-methods.
LedgerVoucher can handle posting with aggregated transactions. LedgerVoucher
uses a RecordSortedList to sum up aggregated transactions. The sort order is
defined in initLedgerTransList(), whereas the aggregation is calculated in the
postGroup() method which handles all numeric fields that will be aggregated.
4-31
AXLedgerJournalTrans Class
The Ax-classes provided with Microsoft Dynamics AX are an encapsulation of
records and are typically used when importing data to Microsoft Dynamics AX.
It is a best practice to import transactions by importing the data to a journal and
letting the standard application handle the posting and generation of transactions.
An import to LedgerJournalTrans can be handled by the classes
AxLedgerJournalTable and AxLedgerJournalTrans.
4-32
Understand the concept of how to import data into a journal and let
the standard application generate the transaction.
Requirement
Create a solution that contains a function to import ledger transactions into the
general journal.
The file consists of records with the following information:
Ledger account
Transaction date
Voucher number
Transaction text
Currency code
Amount in currency
4-33
postImport(): This method is called once after all the records in the
file are read.
To create a class which can import from a file, you extend this class and override
these three methods.
Vouchers
When transactions are manually entered in the ledger journal, the vouchers are
typically allocated automatically by using a number sequence. To assign the
voucher during the import, the journal used should be set up with a manual
number sequence for vouchers.
4-34
Step by Step
To import ledger transactions into general journal, follow these steps.
TIP: The code samples for this lab can be found in the
AX2012_ENUS_DEVIV_04_02_LAB_CODE.txt file. You can copy and paste
these code samples into the correct methods.
1. Import the file AX2012_ENUS_DEVIV_04_02_LAB.xpo that
contains the AXABaseImport and the
AXALedgerImportTransactions classes. Do not be concerned about
the dialog or reading of the file. This is already implemented so that
you can stay focused on the General ledger module.
2. Change the AXALedgerImportTransactions class.
a. Override the preImport() method to create a journal header in the
LedgerJournalTable table by using the AxBC interface
AxLedgerJournalTable. Use the following code sample to guide
you.
4-35
4-36
NOTE: The sample mentioned in the requirement section is available in the file
that is named AX2012_ENUS_DEVIV_04_02_SAMPLEFILE.txt.
TIP: You can import the AX2012_ENUS_DEVIV_04_02_LAB_SOL.xpo file to
verify and compare your solution.
Test
As described earlier, you need a journal related to a manual number sequence to
assign voucher numbers read from the file. This includes the following steps:
1. Create a number sequence by using the path Organization
administration > Common > Number sequences > Number
sequences. Mark the sequence as manual on the General FastTab.
2. Change the parameters in the ledger module by using the path
General ledger > Setup > General ledger parameters. Clear the
Check for continuous numbers check box.
3. Create a new journal name by using the path General ledger >
Setup > Journals > Journal names. Use the journal type Daily and
relate the journal name to the voucher series created in the first step.
4-37
4-38
Budgeting Overview
You can use the Budgeting module to set up, create, and view budgets.
Budgeting can include budget control, used to monitor the budget funds that are
available for planned and actual purchases and expenditures. You can create
budget register entries for the original budget, budget transfers, and budget
revisions. You can also create budget register entries to manually reserve budget
funds for purchases and planned expenditures by using the encumbrance or preencumbrance budget types. Budget register entries can be created automatically
when budgets are transferred to the general ledger from other modules such as
Project management and accounting or Fixed assets.
You can determine which financial dimensions from the chart of accounts will be
available for basic budgeting and budget control. When you configure budget
control, you define budget intervals, budget cycle time spans, budget thresholds,
budget managers, budget groups, and the calculation that is used to check for
available budget funds. The available budget funds can be verified when source
documents and accounting journals are entered. You can view the status and
history of budget register entries, budget control statistics, actual versus budget
amounts, budget details, and budget funds available.
One of most important management tools a company can use to make plans is to
compare planned performance to actual performance. Planning for the general
ledger is performed by creating budgets in the Budgeting module. A budget is a
set of expected ledger transactions. Although a budget can be as finely detailed as
actual transactions, budgets are more typically prepared at an aggregate level.
4-39
4-40
Budget intervals
Budget groups
General journals
Allocation journals
Vendor invoices
Purchase orders
4-41
Purchase requisitions
Travel requisitions
Expense reports
NOTE: The Project management and accounting module also uses its own
budget control. It is only integrated with the Budgeting modules budget control
through the Project expense journal. For more information about Project
management and accounting budgeting functionality, refer to the Advanced
Projects in Microsoft Dynamics AX 2012 course.
Budget Amounts
After you have set up and configured basic budgeting you can begin to enter
budget amounts. If you plan to use budgeting workflows, create the workflows,
and then assign them to budget codes before you begin to make budget register
entries. Also, if you plan to use budget control, configure budget control before
you enter budget amounts.
The budget data is entered through the Budget register entry form that consists
of a header and lines. The header information is applied to the whole budget
register entry and the lines (account entries) are where budget amounts for
specific dimension combinations are entered.
4-42
When you have completed entering the budget register entries, you must update
the budget balances. This step is similar to posting a general journal and updates
the budget amounts based on the budget account entries.
The BudgetTransactionPost class is used to update the budget amounts from a
single budget register entry. The checkHeader(), checkLine(), and checkLines()
methods are used to validate the data that is entered. The run() method invokes
these checks and has additional logic to check for workflow status when
workflow is enabled for budgeting.
The call to the postToGeneralLedger() method is called after the validation is
completed. This method checks whether budget appropriations are enabled and if
they are then a new journal is created to post the amount directly into the general
ledger.
When the postToGeneralLedger() method completes, the status of the budget
register entries are updated to completed.
The BudgetTransactionMultiPost class is used to invoke several instances of the
BudgetTransactionPost class based on the selection criteria that is entered by the
user.
4-43
Budget Checking
When budget control is enabled for a specific source document, budget checks
are completed automatically when the record is saved. The check is based on
options specified in the budget control configuration except for the budget
register which always perform a check on line save.
You can also manually perform a budget check on a transaction. Budget checks
are processed by using the BudgetControlProcessor class. There are core
integrations to the Budget control framework through the following classes as
well:
BudgetControlSourceDocumentProcessor
BudgetControlBudgetTransactionProcessor
BudgetControlAccountingJournalProcessor
These classes handle common patterns for formulating the budget control check
request for the BudgetControlProcessor based on the type of integrator.
The BudgetControlCheckRequest class is used to capture the information that is
required to check for available budget that relates an integrator to budgetary
control. When this class is constructed, the BudgetCheckDetail,
BedgetReturnDetails, and BudgetReleivingDetails classes (which all extend the
BudgetSourceDetail class) are used to capture the ledger dimension and the
currency amount details for the budget funds available check.
NOTE: A portion of the budget control checking logic occurs through stored
procedures on the SQL Server. The code for the SQL logic is contained in the
BudgetControlSQLObjects class and the T-SQL code is deployed to the SQL
Server at activation of the budget control configuration or first budget check.
When a budget check is completed and returns an error or warning, you can use
the Budget check errors or warnings form to view the details.
4-44
4-45
Because most fixed assets represent a significant investment for companies, the
ability to track and keep sound financial records on fixed assets is important.
4-46
Budgeting
Depreciation profiles
Depreciation books
Value models
Posting profiles
Parameters
4-47
The AssetTable is the primary table for storing fixed assets. Each asset has one
record in this table. Each fixed asset is assigned to a fixed asset group. The fixed
asset groups are used to help simplify the setup of assets, for reporting and
inquiries, and to serve as a template with default information for setting up an
asset. The fixed asset groups and default data are stored in the AssetGroup table.
Each asset can have several value models that are stored in the AssetBook. The
default information for value models is stored in the AssetBookTable.
Additionally, each asset can have several depreciation books. Each depreciation
book for an asset is stored in the AssetDepBook table. The default information
for a depreciation book is stored in the AssetDepBookTable. Depreciation books
do not post to the general ledger like value models, so there is no accounting
related to them. The depreciation books are used to calculate various values of
the assets based on the depreciation profile selected for reporting purposes.
4-48
Summary
This chapter introduced currencies and exchange rates. Microsoft Dynamics AX
2012 supports multiple currencies and making conversions between currencies.
The CurrencyExchangeHelper and ExchangeRateHelper classes can be used to
make currency conversions.
Additionally, the chapter introduced the chart of accounts. The chart of accounts
consists of main accounts and financial dimensions. The main accounts and
dimensions are then constrained by the account structures and advanced rules in
use by the chart of accounts. You can define two types of financial dimensions
system-defined and custom lists. Financial dimensions and main accounts can
also be combined to create dimension sets that are used to group and report on
specific combinations of dimensions.
Journals and transactions comprise the details of the general ledger. Journals are
used to make manual adjustments and are posted by using the journal framework
and the LedgerJournalCheckPost class. Other transactions such as sales order
invoices or expense reports are posted by using automatic journals with the
LedgerVoucher class hierarchy.
You can use the Budgeting module to create budget amounts for a specified
combination of the main account and financial dimensions. However, the main
account is not required for budgeting. You can use budget control checking to
enable a budget check on certain source documents. With this check you can
warn a user or prevent a user from posting a transaction that exceeds specified
budget thresholds.
The Fixed asset module is also used to create and track information related to
your companies fixed assets. You can keep multiple sets of books for each asset,
and use the fixed asset journal to acquire, depreciate, or adjust assets.
4-49
4-50
4-51
2.
3.
4-52
Solutions
Test Your Knowledge
1. Which of the following tables are used for a new budget register entry?
(Select all that apply)
() BudgetTransactionHeader
() BudgetTransactionLine
( ) LedgerBudgetHeader
( ) LedgerBudgetLine
2. Which class holds a list of transactions that are going to be posted for a
particular voucher?
( ) LedgerVoucher
() LedgerVoucherObject
( ) LedgerVoucherObjectTrans
( ) LedgerVoucherTransObject
3. Name the two types of financial dimensions in Microsoft Dynamics AX 2012
and describe what each type is used for.
MODEL ANSWER:
System-defined: Select a system-defined entity to base the financial
dimension on. Financial dimension values will be created from this selection.
For example, to create dimension values for projects, select Projects. A
dimension value will be created for each project name.
User-defined: To create a user-defined financial dimension, select < Custom
dimension >
4. Which class is used to post a general journal?
( ) LedgerJournalPost
() LedgerJournalCheckPost
( ) LedgerVoucher
( ) LedgerVoucherPost
5. Which table is the primary table used for storing fixed asset information?
( ) AssetBook
() AssetTable
( ) AssetTrans
( ) AssetGroup
4-53
4-54
Introduction
A product is an item, service, or right that results from an economic activity. In
Microsoft Dynamics AX 2012, all product data is shared across all companies,
and the virtual table collection concept is no longer available for product data .
The item representation (InventTable) used in earlier versions still exists, and this
table can still be included in a table collection. However, it now has a foreign key
to the shared product instance (EcoResProduct hierarchy), and it represents the
released product concept or a given enterprise product that is now authorized for
use inside a legal entity.
This chapter highlights the new patterns used to represent item-product master
data. This document does not describe all new functionality within the itemproduct data management feature. Instead, this document focuses on the
development patterns and how they are implemented. A complete list of new
tables and their replacements can be found in the Implementing the Item-Product
Data Management Framework for Microsoft Dynamics AX 2012 white paper at
https://go.microsoft.com/fwlink/?LinkId=246121.
5-1
Products
Product information management in Microsoft Dynamics AX 2012 targets the
creation and maintenance of an Enterprise Products Repository. It supports larger
organizations in a centralized structured approach in creating and maintaining
core master data such as product definitions. Smaller organizations that require a
more decentralized approach can, with some restrictions, create and maintain
their products while they are automatically added to the shared products
repository.
Product Maintenance
Product definitions are created independently of a legal entity, and core values
such as product number, type, and name are shared values.
Some core values can be overridden by a legal entity, an example is the search
name. Other values are kept as key definition attributes and they cannot be
changed other than on the actual product definition.
From a decentralized process, you can create and maintain products directly from
the Released products list page in the Product information management
module. A product definition is created by the system when a product is created
directly from the Released products list page.
Products
o
Product masters
o
5-2
5-3
When you create a new product definition the type and subtype are the key
attributes to enterthey determine the additional functions and required setup.
The product type classifies if a product is tangible or intangible (item or service),
whereas the sub-type introduced in Microsoft Dynamics AX 2012 is a subclassification of the product.
The following figure lists all shared product definition attributes.
5-4
EcoResProduct
EcoResProductMaster
EcoResDistinctProductVariant
EcoResDistinctProduct
All products are stored as system master data, and are used by organizations to
create and maintain shared product definition data.
The "product master" concept includes the product definition, and can have
variants in product dimensions (color, size, and configuration).
The "product variant" concept includes a product that has several of the
associated product dimension values (color, size, and configuration). It replaces
the previous "item combination" concept. Be aware that a product variant has all
the attributes and functionality of any other type of product.
The "distinct product" concept includes a product that does not vary in product
dimensions and therefore cannot have a product dimension group associated to it.
The products in a system can be released to a legal entity to become available for
various processes (sales, purchase, and production). The same shared product
variants can be available for production in one company, but not available for the
production in another legal entity.
5-5
Releasing Products
The product release process is designed to enable users in an enterprise to move
or copy product definitions to various organizational units. By releasing a
product or a product master you associate it with a legal entity and authorize the
product definition for use in the legal entity.
5-6
5-7
Item group
To make sure these four mentioned fields are set up, you can run a validation
check on the product in the respective legal entity. When you click Validate in
the Maintain group of the Action Pane, the system will check for the attributes
and produce a warning if no value exists.
5-8
Default order and Site specific order settings: The default and site
specific order settings are used by master planning to generate sales
orders, purchase orders, and inventory orders. The settings are stored
in the InvetItemPurchSetup, InvnetItemSalesSetup, and
InvetItemInventSetup tables. The InventItemSetupSupplyType table
is used to store the default order type. The main settings involve the
following areas:
o
o
o
Product images: Each item can have multiple images linked to it.
The images are stored in the document handling system by using the
DocuRef table.
GTIN: You can define Global Trade Item Numbers (GTIN) for each
item. GTIN is a 14-digit data structure used to uniquely identify
trade products. The InventItemGTIN table contains information
about items and their related GTINs.
Additional Functionality
The following sections describe additional functionality that is available to help
further classify and define the product information.
5-9
Product Translation
When you use the Text translation form, you can create product translations by
entering descriptions and product names for multiple languages. However, the
product name and description are optional, only the product number is required.
The product translations are mainly used for output on external documents, and
the data values will always be shown in the system language, for example, when
you open and view the product related list pages and forms.
On external documents the product name will be displayed according to the
company language or the preferred language by the customer or vendor.
To open the Text translation form click the Translations button in the Action
Pane of All products and product masters forms or list pages.
5-10
ProductNumber
ItemId
EcoResProductIdentification
EcoResProduct.DisplayProductName
InventTable.ItemId
5-11
5-12
Inventory Dimensions
There is a clear difference between product attributes and product dimensions.
You can use product dimensions to track their values in all major processes such
as for cost, inventory, and analysis purposes.
Product attributes are only associated with products and product masters, and
product dimensions can only be used together with product masters (except for
masters that are configured by using the option constraint-based configuration).
This is because they consist of the uniqueness of a product masters variations.
5-13
The product dimension group can be assigned only when the product is being
created. The storage and tracking dimensions groups can be assigned to the
product on two levelssystem level, where they are used in all legal entities
where the product is released, and the legal-entity level, where they are used only
for the product that is in that specific legal entity.
5-14
5-15
Definition
Predefined variant
Dimension-based
configuration
Constraint-based
configuration
NOTE: Rule-based configuration is used for items that implement the Product
builder functionality. This option is only available for customers who are
upgrading from an earlier version. This option will be removed in future
releases. Therefore it is recommended that you move to the Constraint-based
configuration option.
5-16
EcoResProductMasterDimValue and
EcoResProductVariantDimValue hierarchies
InventDim
5-17
InventTable
InventDimCombination
Products and product variants must be released to a specific legal entity before
they can be used with that legal entity. The InventTable and its associated tables
use the concept of the released product and can also be treated as the instance of
the particular product in the current company. The mandatory product foreign
key is added to the InventTable. The InventTable represents the instance of either
a product master or a distinct product.
5-18
The cost flow assumption and cost measurement method for valuing
inventory of stocked products.
5-19
If an item model group is set up for a not stocked product, many of the
parameters are irrelevant. The following table displays the parameters that are
relevant to a product that are maintained in stock versus products that are not
maintained in stock.
5-20
Check box
Stocked
Not Stocked
Relevant
Irrelevant
Relevant
Relevant
Quarantine management
Relevant
Irrelevant
Consolidated picking
method
Relevant
Irrelevant
Relevant
Irrelevant
Relevant
Irrelevant
Relevant
Relevant
Stocked
Not Stocked
Relevant
NOTE: Check box is
selected. when Post
physical inventory is
Selected.
Relevant.
Registration requirements
Relevant
Irrelevant
Receiving requirements
Relevant
Relevant
Picking requirements
Relevant
Irrelevant
Deduction requirements
Relevant
Relevant
Date-controlled
Relevant
Irrelevant
Relevant
Irrelevant
When a product is defined as not stocked, there are several differences in how
transactions are handled, and certain types of transactions are restricted. For
example, when a not stocked product is added to a purchase order, the system
will not track the on hand quantity or create an inventory transaction
(inventTrans table record). You can process this purchase order in the same
manner as the purchase order with stocked product.
The following figure shows the data model for item groups and item model
groups.
FIGURE 5.10 ITEM GROUP AND ITEM MODEL GROUP DATA MODEL
5-21
Challenge Yourself!
By using the provided information, add a new field to the product that is copied
to the released product. Make sure that the field can be edited and that it is
required by adding logic into the Validate button on the Released products
form.
5-22
5-23
18. Close the Product details form, and go back to the Development
workspace.
Follow these steps to add the MSRP field to the InventTable and the
EcoResProductDetailsExtended form.
1. In the AOT, locate the InventTable under the Tables node of the
Data Dictionary.
2. Drag the InventTable into the project that you created earlier.
5-24
5-25
17. Close the Released product details form and go back to the
Development workspace.
5-26
5-27
5-28
Summary
The Product information management module provides functionality to set up
and maintain the details of products across legal entities and to set up legal entity
specific data for released products.
The module also includes functionality that will categorize products, create and
store custom product attribute details for each product, and support the entry of
translations for many fields on the product details.
Dimension groups can be used to determine which inventory dimensions should
be used for a product. They include the following:
NOTE: More information about the item-product data model, upgrade for
earlier releases, and coding patterns can be found in the Implementing ItemProduct Data Management Framework for Microsoft Dynamics AX 2012 white
paper at https://go.microsoft.com/fwlink/?LinkId=246121.
5-29
5-30
a. Product
Translations
b. Product Master
c. Product Variant
d. Distinct
Product
2.
3.
5-31
Solutions
Test Your Knowledge
1. TRUE or FALSE? All products are stored as system master data, which
allows organizations to create and maintain shared product definition data.
() True
( ) False
2. Which of the following fields must be populated to validate a product that
will be used on a transaction such as a sales order? (Select all that apply)
() Item group
() Item model group
( ) Product description
() Storage dimension group
3. Match the descriptions with the correct item.
b 1. Includes the product definition, which can
have variants in product dimensions (color, size, and
configuration).
c 2. Includes a product that has several associated
product dimension values (color, size, and
configuration).
d 3. Includes a product that does not vary in
product dimensions and therefore cannot have a
product dimension group associated to it.
a 4. Used for entering descriptions and product
names for multiple languages.
5-32
a. Product
Translations
b. Product Master
c. Product Variant
d. Distinct
Product
Discuss the inventory journals data model and the structure of the
InventJournalCheckPost classes.
Introduction
The following sections explain the functionality offered by the Inventory and
warehouse management module by describing a series of tasks that are
performed by using the module.
The following main tasks are supported by the Inventory and warehouse
management module.
Other
6-1
Reservations Overview
There are two basic types of reservations in Microsoft Dynamics AX 2012
reserved physical and reserve ordered. A physical reservation is a hard allocation
or reservation. When a transaction is physically reserved, the item is available in
the warehouse and it is specifically set aside for the transaction(s) that it is
reserved against.
The reserve ordered type reservation is a soft allocation. This means the items are
currently on order and those specific ordered items are reserved for a specific
transaction. When the items are available in inventory, the reservation is changed
from reserve ordered to reserved physical. For example, you have created a sales
order for 100 widgets. The widgets are not available in inventory. However there
are several open purchase orders for the item so that you can make an ordered
reservation for the widgets against the sales order. After the widgets are received,
the reservation can be updated to a physical reservation.
There are three methods for making reservations in Microsoft Dynamics AX
2012.
6-2
On hand
The quantity on hand (available quantity) is a key figure when you make
decisions related to a specific item. This information can be supplemented by
expected stock movements because of future purchases, production, or sales. One
of the main purposes of the Inventory and warehouse management module is
to supply this important information; many of the other functions described are
intended to maintain this information.
Transactions
Historic transactions are an important source of information because they show
all item movements. By knowing the current quantity of an item, and its historic
transactions, you can calculate the quantity in stock for any historic date. You
can also print an inventory list for a given date, even if the quantities have
changed because of transactions after this date.
6-3
6-4
InventTrans Relationships
The split of the InventTrans table affects code that uses the relationships between
the inventory transaction originating tables and the inventory transaction table.
The InventTransId field is removed from the InventTrans table and is replaced
by the InventTransOrigin field to reference the InventTransOrigin table. Some
inventory transaction originating tables keep the InventTransId field; however,
the field cannot be used to reference the InventTrans table. All inventory
transaction originating records must first be referenced by a record in the
InventTransOrigin table that references the InventTrans table. The following
code example shows how to do this.
while select inventTransOriginSalesLine
where inventTransOriginSalesLine.SalesLineDataAreaId
== salesLine.dataAreaId
&& inventTransOriginSalesLine.SalesLineInventTransId
== salesLine.InventTransId
join inventTrans
where inventTrans.InventTransOrigin ==
inventTransOriginSalesLine.InventTransOrigin
{
info(inventTrans.toString());
}
6-5
InventMovement Class
The InventMovement class is used to wrap a record that is responsible for
generating inventory transactions. Sales line, production table, and inventory
journal line are examples of tables that hold this type of records. The concept is
to make a common presentation of the data attributes and ignore the source.
The InventMovement class is extended to cover additional functionality for each
source. The following figure shows the class hierarchy for the InventMovement
class.
6-6
6-7
Designs that use InventSum are preferred for performance reasons, because it
prevents the summing of transactions during both the calculation of available
quantities and the control of negative inventory.
InventSum contains the sum of all inventory transactions. To calculate the
inventory status on a date in the past, you first have to adjust the figures found in
InventSum with the transactions updated after the date in question.
The information in InventSum is updated every time that a transaction is
committed. When you are in a transaction, the table will not reflect the changes
that you made in the current transaction. If the InventOnHand class is used to
fetch the data from InventSum, the changes from the current transaction will be
included.
Each record in InventTrans contains several dates.
6-8
InventOnHand Class
The InventSum table contains consolidated figures for each item and dimension
combination. The content of this table is redundant to the data in InventTrans.
The reason for this design is to increase performance when calculating quantity
on hand.
InventOnHand class is used to wrap the InventSum table and should be used to
retrieve the information.
The class has several different static methods that are used to initialize the object.
You can use the static method InventOnHand::newItemDim to retrieve the
consolidated quantities for the specified dimension values. The following code
sample shows how to call this method.
ItemId itemId;
InventBatchId inventBatchId;
InventDim inventDimCriteria;
InventDimParm inventDimParm;
InventOnHand inventOnHand;
inventDimCriteria.clear();
inventDimCriteria.inventBatchId = inventBatchId;
inventDimParm.clear();
inventDimParm.InventBatchIdFlag = NoYes::Yes;
InventOnHand = InventOnHand::newItemDim(itemId,
inventDimCriteria,
inventDimParm);
info(strFmt(The quantity available is %1,
inventOnHand.availPhysical()));
InventDimOnHand Class
You can use the InventOnHand class to calculate consolidated figures for one
specification of an item ID and a dimension combination.
You can use the InventDimOnHand class to have individual figures for a more
detailed specification, than the one being used to limit the query.
The following sample shows how to obtain the physical quantity available for
each item included on a specific inventLocationId and wmsLocationId.
6-9
6-10
Standard cost
InventSettlement
When a withdrawal from inventory is updated financially, it will be assigned a
cost value that is based on the current status of the inventory. Later, financial
receipt updates could affect the originally calculated cost value. There is no
automatic recalculation of the cost of goods sold for the update of the receipt.
6-11
The InventTrans.costValue() method returns the current cost value that is the sum
of the CostAmountPosted and CostAmountAdjustment fields.
The InventSum.PostedValue field contains the consolidated cost value and
includes all adjustments.
6-12
Items are bought through the Procurement and sourcing module or produced in
the Production control module. Items are consumed by sales orders, projects or
production orders. The Ledger module keeps track of inventory value and
consumption costing.
Inventory Journals
The primary way that inventory is updated in Microsoft Dynamics AX is through
sales orders, purchase orders, and production orders. Inventory journals are an
alternative that you can use to make manual updates to the inventory. Several
types of journals can be used to make updates.
Each inventory journal consists of a header and lines. The header defines the
journal information that is configured on the journal name. These inventory
journal names resemble the journal names and types that are defined in the
General ledger module.
The journal lines are used to define the items, dimensions, and quantities. Each
type of journal has small differences. However, the main principle is that the
journal has inventory transactions in the inventTrans table that are used to add or
remove inventory.
6-13
Movement
A movement is an update of a receipt or withdrawal of a specified quantity
without a related purchase, production, or sales order. This type of journal offers
additional control so that users can specify a main account that the inventory cost
is offset to.
Inventory Adjustment
An adjustment is made when a deviation is found between the physical inventory
and the quantity registered in Microsoft Dynamics AX 2012. A loss could also be
relevant if some items in stock are damaged or destroyed.
Counting
Counting is a special version of an adjustment, because the quantity entered is the
physical quantity counted. In a typical inventory adjustment journal, the change
in quantity is entered.
Transfer
A transfer is used when a lot is moved from one warehouse to another. The same
function is also used to change other inventory dimensions, such as batch ID,
serial ID, pallet, or warehouse location.
Additional journal types are available for item arrivals, production input, and tag
counting. For more information about other journal types, refer to the Help.
6-14
6-15
6-16
Challenge Yourself!
Use the provided information to create a new class that has a dialog box that has
two parameters for selecting a file and a journal name. Add logic to the OK
button in the dialog box to open the selected file and create a new movement
journal header by using the journal name that is specified in the dialog box. Each
line of the spreadsheet must be imported into the journal lines. When the file is
finished processing, the users should receive an Infolog informing them of the
journal number.
6-17
Step by Step
TIP: The code samples for this lab can be found in the
AX2012_ENUS_DEVIV_06_01_LAB_CODE.txt file. You can copy and paste
these code samples into the correct methods.
Follow these steps to create a new project.
1.
2.
3.
4.
5.
6.
To create a new class that is copied from the Run Base Batch Tutorial, follow
these steps.
1. In the AOT window, browse to Classes > Tutorial_RunbaseBatch.
2. Right-click the class and click Duplicate.
3. Right-click the CopyOfTutorial_RunbaseBatch class that is
created and click Rename.
4. Enter a name for the class such as ImportBeginningBalances.
5. Save the class.
6. Drag the new class into the project created earlier.
7. Save the project.
6-18
oSysExcelApplication;
oSysExcelWorkbooks;
oSysExcelWorksheets;
oSysExcelWorksheet;
oSysExcelCells;
dlgFileNameOpen;
dlgInventJournalNameId;
#define.CurrentVersion(1)
#define.Version1(1)
#localmacro.CurrentList
fileNameOpen,
inventJournalNameId
#endmacro
}
3. Modify the construct method to create a new instance of the
ImportBeginningBalances class. Use the following code sample to
guide you.
server static ImportBeginningBalances construct()
{
return new ImportBeginningBalances();
}
4. Update the description of the class. Use the following code sample to
guide you.
6-19
6-20
6-21
6-23
6-24
6-25
Test
To create a new menu item and put it on the main menu in the Inventory and
warehouse management module under the Periodic folder, follow these steps.
1. In the AOT window, expand Menu Items.
2. Right-click Action, and then click New Menu Item.
3. In the Properties window, set the following values.
a. Name = ImportBeginningBalances
b. Label = Import beginning balances
c. HelpText = Tutorial to import beginning balances into a
movement journal.
d. ObjectType = Class
e. Object = ImportBeginningBalances
4. Save the menu item.
5. Drag the new menu item into the project that you created earlier.
6. In the AOT window, browse to Menus >
InventoryAndWarehouseManagement.
7. Drag the menu into the project that you created earlier.
8. In the Project window, browse to the Periodic folder of the
InventoryAndWarehouseManagement menu.
9. Drag the ImportBeginningBalances menu item into the Periodic
folder and place it below the Inventory blocking menu item.
10. Save the menu and the project.
To create a new journal name to be used for the import, follow these steps.
1. In the AOT window, browse to Forms > tutorial_JournalName.
2. Right-click the form and then click Open.
3. Create a new record and enter the following information.
a. Name = IMov
b. Description = Inventory Movement
c. Journal type = Movement
d. Voucher series = Inve_72
4. Close the Journal names form.
6-26
6-27
TIP: You can repeat the test as many times as you would like. The journal
number and voucher numbers will automatically increment during each import.
TIP: You can import the AX2012_ENUS_DEVIV_06_01_LAB_SOL.xpo file to
verify and compare your solution.
NOTE: This lab uses the Microsoft Dynamics AX 2012 Tutorial tables, classes,
and forms. In a more realistic implementation, you should create your own
tables, forms, and classes.
6-28
Quarantine Orders
The quarantine function is used to block a specific lot. When the quarantine is
started, the quantity is removed from available inventory. Later, when the
quarantine is ended, the quantity is returned to available inventory. One use of
this function is to block a received lot until it has passed quality assurance.
The InventMov_Quarantine class is used when you work with inventory
quarantine orders to control items that are in the InventQuarantineOrder table
quarantine. Quarantine orders differ from other types of orders such as purchase
orders or sales orders because they do not have a header and line data structure.
Quality Orders
You can use quality orders to identify the tests and to record test results and test
quantity for a specific item.
The tests are copied from the test group that is assigned to the quality order. Tests
can be added, deleted, or changed. A quality order can be manually created or
automatically generated based on rules that are defined in the Quality
associations form found in Inventory and warehouse management > Setup >
Quality control. A quality order is associated with an item in a sales order, a
purchase order, a quarantine order, a production order, a production order routing
operation, or an on-hand inventory balance. Items that are specified for
inspection in a quality order are automatically blocked from issue or
consumption.
Each quality order is stored in the InventQualityOrder table. The lines of the
quality order represent each test to be performed and stored in the
InventQualityOrderLine table. Each test or quality order line can have test results
recorded for it that are stored in the InventQualityOrdersLineResults table. The
InventQualityManagementCreate class provides the facilities for quality
management order generation.
Inventory Blocking
Inventory blocking is part of the quality inspection process. During the quality
inspection, items are automatically blocked from consumption or issue. Also, you
can manually block items that you want to prevent from being issued or
consumed.
6-29
6-30
Other Functionality
The Inventory and warehouse management module has many additional
features. The following topics review the forecasting and transfer order
functionality.
Forecasts
Forecasts are used to enter sales and purchases expected in the future. By
forecasting you can plan for the future beyond the period covered by received
sales orders and created purchase orders. For example, forecasts are necessary
when a manufacturing companys production lead time is longer than the orderto-delivery time that it offers customers.
A forecast model is used to name and identify a specific forecast.
You can define a forecast model in two levels. A forecast model can include one
or more submodels. This allows you to aggregate the individual forecasts. When
you run forecast scheduling for a top-level forecast model, the program calculates
gross requirements for all models that are designated as submodels.
All forecast models must be defined before you can designate one or
more models as submodels of a forecast model.
A forecast submodel uses its own parameters, not those of the toplevel forecast model.
Transfer Orders
A transfer between two warehouses can be updated by using a transfer journal as
mentioned earlier. However, when a journal is updated, the issue and receipt are
updated at the same time. If there is a time lag between the issue and the receipt
because of transport time, this can be reflected by creating a transfer order.
Transfer orders differ from transfer journals because shipping and receiving
actions must be completed. They also allow for multiple shipments and receipts
against the same order.
6-31
6-32
Pick items for transfer. In the Transfer orders form, click Inventory
> Pick and then select the items that you want to pick for transfer. In
the Pick list, select items for transfer by their serial number. You can
also print a picking list and register picking list.
Specify the quantity that you want to ship for each transfer order line
by entering a quantity in the Ship now field. To ship this quantity,
open the Shipment form and select Ship now in the Update list.
Challenge Yourself!
Use the provided information to create a new table to track the history of cleared
inventory blocking records. Add new fields to this table to store the user ID and
the cleared date and time. Modify the functionality of the Delete button on the
Inventory blocking form to copy the blocking record to the new inventory
blocking history table.
6-33
To create new extended data types for the new inventory blocking history table,
follow these steps.
1. In the AOT window, browse to Data Dictionary > Extended Data
Types.
2. Right-click Extended Data Types, and then click New > Enum.
3. In the Properties window for the new enum, set the following
values.
a. Name = InventBlockingClearedFlag
b. Label = Cleared
c. HelpText = Inventory blocking is cleared when selected.
d. Extends = NoYesId
e. EnumType = NoYes
4. Save the extended data type, and then drag it into the project that you
created earlier.
5. Right-click Extended Data Types, and then click New >
UtcDateTime.
6. In the Properties window for the new extended data type, set the
following values.
a. Name = ClearedDateTime
b. Label = Cleared date time
c. HelpText = Date and time the inventory blocking was cleared.
7. Save the extended data type, and then drag it into the project that you
created earlier.
8. Save the project.
6-34
6-35
6-36
6-37
6-38
6-39
6-40
TIP: You can repeat the test as many times as you would like by using different
item numbers and dimensions. The only requirement is that the item and
dimension combination that you select must be on hand.
TIP: You can import the AX2012_ENUS_DEVIV_06_02_LAB_SOL.xpo file to
verify and compare your solution.
6-41
Summary
The Inventory and warehouse management module in Microsoft Dynamics
AX 2012 integrates with many other modules and is the central module for
processing inventory transactions.
The module includes functionality for recording and updating the inventory
transactions and keeping track of the on hand quantities for every item and itemdimension combination.
The inventory closing process provides functionality to revalue the inventory
from the weighted average to the selected inventory costing method that is
specified on each item.
Inventory journals can be used to make manual adjustments to the inventory
values by adding, removing, or counting the current on hand inventory values.
You can also make transfers by using an inventory journal or by creating a
transfer order.
Finally, quarantine and quality management features can be used to record test
results and prevent items from being processed because of quality issues.
6-42
2. Match the inventory statuses with the correct inventory status field.
Categories (Inventory Statuses):
1. Status Issue
2. Status Receipt
_____ Item 1: Ordered
_____ Item 2: OnOrder
_____ Item 3: ReservOrdered
_____ Item 4: Received
_____ Item 5: Purchased
_____ Item 6: Deducted
_____ Item 7: Picked
_____ Item 8: Sold
3. TRUE or FALSE? The InventJournalCheckPost class handles the validation
and posting of a purchase order.
( ) TRUE
( ) FALSE
6-43
6-44
2.
3.
6-45
Solutions
Test Your Knowledge
1. Describe the difference between the inventTrans table and the inventSum
table.
MODEL ANSWER:
The inventTrans table stores the details of every inventory issue and receipt,
whereas the inventSum table stores the summation of all inventTrans records
grouped by the inventory dimension combinations which are identified by
the inventDimID.
2. Match the inventory statuses with the correct inventory status field.
Categories (Inventory Statuses):
1. Status Issue
2. Status Receipt
2
Item 1: Ordered
Item 2: OnOrder
Item 3: ReservOrdered
Item 4: Received
Item 5: Purchased
Item 6: Deducted
Item 7: Picked
Item 8: Sold
6-46
6-47
6-48
Review the data model and framework that is used for processing
free text invoices.
Describe the set up that is required for payments and review the data
model for payment set up.
Review the customer payment data model and discuss the framework
that is used for making and generating payments.
Introduction
The Accounts receivable and Accounts payable modules offer similar
functionality for customers and vendors. The modules are used to maintain the
customer and vendor information and the transactions that occur for each. This
chapter reviews the functionality that is available for customers and vendors and
the primary transactions that occur for each module.
7-1
Customers
Accounts receivable is used to track customer invoices and incoming payments.
You can create customer invoices for a sale that is based on sales orders or
packing slips. You can also enter free text invoices that are not related to sales
orders. Additionally you can generate customer invoices from a project. You can
receive payments by using several different payment types. These include bills of
exchange, cash, checks, credit cards, and electronic payments. If your
organization includes multiple legal entities, you can use centralized payments to
record payments in a single legal entity on behalf of the other legal entities.
You can use the Settle open transactions form to settle invoices with payments
or credit notes. You can also enter payments and settle them in the Enter
customer payments form. To view customer information, use the All customers
list page and related forms. You can manage overdue balances, calculate interest,
and generate collection letters by using the Collections list page and related
forms.
7-2
Maintain customers
Request payment
Register payment
Bill of exchange
Account statement
Collection letter
Interest calculation
Exchange adjustment
Reconciliation
Maintain Customers
Creating new customers and maintaining existing customer information is an
ongoing task. Make sure that customer setup is correct to guarantee smooth
communication and to avoid calculation errors.
Some customers are transferred from the Prospects form in the Sales and
marketing module. However, other customers must be created manually in the
Accounts receivable module. The customer forms and list pages are available
from the Accounts receivable and the Sales and marketing modules.
Customer sales prices and discounts for items sold should be maintained. Prices
can be set up specifically for individual items and customers, for a group of
customers or for all customers as one group. The price structure also includes
line, multiline, and total discounts.
The actual value of invoices due in a foreign currency can change over time as
the result of exchange rate fluctuations. Because an invoices value is calculated
in the accounting currency when the transaction is posted, you could have to
make periodic exchange rate adjustments to revalue foreign currency receivables.
7-3
7-4
7-5
Vendors
Accounts payable is used to track vendor invoices and outgoing expenditures.
You can enter vendor invoices manually or receive them electronically through a
service, or your vendor can enter the invoices by using a vendor portal. After the
invoices are entered or received, you can review and approve the invoices by
using an invoice approval journal or the Vendor invoice form. You can use
invoice matching, vendor invoice policies, and workflow to automate the review
process so that invoices that meet certain criteria are automatically approved, and
the remaining invoices are flagged for review by an authorized user.
After vendor invoices are approved, you can pay vendors. If your organization
includes multiple legal entities, you can use centralized payments to pay all
invoices from a single legal entity. Multiple payment formats are supported.
These include checks, promissory notes, and Single Euro Payments Area (SEPA)
electronic payments. You can settle invoices with payments or credit notes by
using the Settle open transactions form. To view vendor information, use the
All vendors list page and related forms.
7-6
Maintain vendors
Register invoice
Invoice approval
Payment proposal
Register payment
Promissory notes
Exchange adjustment
Reconciliation
Maintain Vendors
Creating new vendors and maintaining existing vendor information is an ongoing
task. Make sure that vendor setup is correct to guarantee smooth communication
and to avoid calculation errors.
Purchase prices and discounts for items purchased should be maintained. Prices
can be set up specifically for individual items and vendors, for a group of
vendors, or for all vendors as one group. The price structure also includes line,
multiline, and total discounts.
7-7
7-8
7-9
7-10
Each free text invoice template record is stored in the CustInvoiceTemplate table.
The lines of the templates are stored in the CustInvoiceLineTemplate table. Each
free text invoice template must be linked to one or more customers. The
CustRecurrenceInvoice table contains the information about the templates that
are assigned to a customer. One template can be assigned to multiple customers,
and each customer can have multiple templates assigned.
Periodically, you must run the Generate recurring invoices job to create the
recurring free text invoices for each customer. When the job runs the
CustInvoiceTemplate table records are copied into the CustInvoiceTable as a
standard free text invoice. The lines are copied from the
CustInvoiceLineTemplate table to the CustInvoiceLine table.
Every time that the Generate recurring invoices job is run, a new record is
inserted into the RecurrenceInvoice table. This record serves as a batch or
"journal" header type record for the free text invoices that are created. The
CustRecurrenceInvoiceGroup table contains information about each of the free
text invoices that are created from the batch.
When the recurring free text invoices are posted, the transactions are copied to
the CustInvoiceJour and CustInvoiceTrans tables in the same manner that a
regular free text invoice is processed.
7-11
CustPostInvoiceJob
The CustPostInvoiceJob class handles the selection of which records in the
CustInvoiceTable to post. It also handles the printing of the invoices if it is
specified. The class extends from the RunBase-framework.
Vendor Invoices
Invoices can originate from purchase orders. However, if an invoice is created in
another system, or for products and services that are not recorded in a purchase
order, then it can be recorded manually in Microsoft Dynamics AX, by using the
General journal or an Invoice journal in the Accounts payable module. When
you manually enter a vendor transaction and specify a vendor account and an
invoice number, the transaction will be recorded as an invoice.
The company receives invoices from its vendors. To make sure that received
invoices are correct and valid, incoming invoices are typically sent through an
approval workflow.
It is important to register invoices as quickly as possible. You do this with a
status that displays that the invoice is awaiting approval. This status is changed
when the invoice is approved.
Invoicing Methods
Purchase Order Invoicing
A vendor invoice for a purchase order is an invoice that is attached to a purchase
order. It contains a header and one or more lines for items or services. A vendor
invoice finishes the purchase order, product receipt, and vendor invoice cycle.
You can also enter vendor invoices that are not associated with purchase orders.
7-12
Registered
Approved
Paid
Invoice Register
Invoice Journal
Vendor account
Invoice number
Amount
The same employee validates and posts the journal to the accounts specified in
the posting profile. Usually the accounts are pending accounts where the amounts
require the manual approval and reclassification by the person specified in the
journal line.
7-13
The invoice pool displays the relevant information about the invoices
awaiting approval.
To post the lines, create a new invoice journal, and then click
Functions. Select Invoice pool and accept the individual invoices in
the pool after you approve them.
Use the invoice journal to transfer the invoices for approval and
posting.
Invoice Journal
A third option for processing incoming invoices is to enter them directly into the
invoice journal.
7-14
By default, the user who is logged on and enters the journal lines
approves the invoices.
The invoice journal is designed for users to enter the invoices they
receive from vendors without entering them into the approval
journal. As soon as the user enters the incoming invoices, the user
can post.
Payments
The collection of customer payments and generation of vendor payments is one
of the most important tasks in the finance process. They control the flow of cash
into and out of your business.
If you do not receive payments from your customers, you might not have cash to
make payments to vendors and keep your business running. Similarly, if you do
not make payments to your vendors for the items that you purchase, your vendors
could stop sending you items that keep your business running.
Before any payments can be made or received, several system setups must be
completed. Most of the payment setup is shared between the Accounts
receivable and Accounts payable modules, and there are many similarities in
the processing of payments for each module.
Payment Set Up
Microsoft Dynamics AX offers extensive functionality for setting up different
vendor payment options. These global payment options are used in the Accounts
payable and Accounts receivable modules, and include the following.
Number of installments
Amount of each installment
Due date of each installment
Payment days: Use payment days to define the payment day used
for calculating the due date. The due date always is rounded up to the
nearest specified date. Payment days can be specified for one of the
following.
o
o
7-15
7-16
Credit
Cash in advance
Bill of exchange
Check and electronic payments
VendPaymFormat contains payment formats that are selected by using the Setup
button on the File formats tab page (in the form used for setting up payment
methods).
VendPaymModeTable contains defined payment methods. These include related
file formats that are represented by an ID of the class implementing the format.
Each payment method can be related to other information.
7-17
Customer Payments
Request Payments
Some companies request customer payment by submitting electronic information
to a bank. This requires agreement with the customer, because payments are
drawn automatically without the customers individual approval.
Banks typically respond with corresponding electronic information, specifying
whether the individual payments are processed or canceled.
This automatic approach to customer payment is typically used by companies
with high sales volumes to regular customers, such as subscriptions.
Payment Journals
Payment registration is one of the Customer modules main tasks. The payment
journal, a variant of the general journal used in the General ledger module, is
used to register customer payments. You can do this manually by entering
information into the payment journal.
7-18
Vendor Payments
Payment Proposal
Open vendor invoices are reviewed periodically to select specific invoices to pay.
You do this by entering the payments in a journal with the specifications for
those invoices that will be settled. The Accounts payable module includes a
function for automatic proposals of those invoices that have to be paid.
When the payment proposal is reviewed and approved, payments are then
typically generated. The payment generation process is different, depending on
the method of payment. For check payments, a physical check must be printed
and mailed, whereas other types of payments require the generation of a file that
is transferred electronically to a bank.
Payment Journals
Payment registration is usually performed by posting the payment proposals
entered in the journal.
Some banks deliver a response to electronic payments as a receipt. Delaying
journal posting until arrival of the bank receipt is optional.
7-19
LedgerJournalName contains different journal names, based on how they are set
up in the General Ledger module. Each journal name is related to one specific
type of journal. One of the journal types is customer payments.
LedgerJournalTable contains records that are headers for individual journals. A
new record is created in this table every time that the user creates a new journal
in the form that displays the list of journals.
LedgerJournalTrans contains individual journal lines. Each payment can have
related fees.
The fees are stored in the CustVendPaymJournalFee table. Each payment fee can
generate a new record in LedgerJournalTrans that will contain the fee. To post
payment fees, this design uses the usual ledger journal posting. Fee transactions
cannot be viewed or edited in LedgerJournalTrans, because this is replicated
from the information in CustVendPaymJournalFee.
7-20
CustInPaym Class
The CustInPaym class forms a framework for the import of payments from
customers. The file is typically received from the company bank. The function
involves reading the file and creating a new journal that contains the payments.
The information in the received file will usually contain a reference to the
invoice covered by the payment, and the import should make a settlement against
the open invoices while generating the payment journal.
When a payment method is set up, it can be related to an import file format. This
function will display all classes extending from CustInPaym.
7-21
VendOutPaym_Format1
VendOutPaymRecordFormat1
VendOutPaymRecordFormat1Spec1
VendOutPaymRecordFormat1Spec2
You can make a duplication of these classes, when you implement a new specific
format.
CustVendCreatePaymJournal Class
The CustVendCreatePaymJournal class is used to generate journals with
payments or journals handling bills of exchange and promissory notes.
The class searches for open invoices that will be paid by using a cash discount
and due date criteria. The data fetched is controlled by a query on the
CustTransOpen/VendTransOpen table and the payments generated are saved in a
ledger journal (LedgerJournalTrans).
The generated journal can be exported to a file by using the Cust-/VendOutPaym
classes described earlier.
CustVendSettle Class
The CustVendSettle class handles the update of a settlement between an invoice
and a payment. The processing is complex because the settlement can include
some of the following tasks.
7-22
Handling of over/underpayment
7-23
custTransOpen.recId,
custTransOpen.AmountCUR,
custTransOpen.custTrans().currencyCode);
CustTrans::settleTransact(custTable);
This resembles the manual transaction editing that can be controlled by the enduser.
7-24
Description
Start
End
Length
Type
001
Bank Reg.
Bank Acc.
17
10
Payment
ID
Payment identification
18
37
20
Date
YYYYMMDD
38
45
Currency
ISO
46
48
Amount
49
63
15
Filler
Spaces
64
198
135
7-25
Description
Start
End
Length
Type
002
Name
Name of receiver
33
30
Address 1
Address line 1
34
63
30
Address 2
Address line 2
64
93
30
Address 3
Address line 3
94
123
30
Reference
Payment reference
124
143
20
Date
YYYYMMDD
144
151
Currency
ISO
152
154
Amount
155
169
15
Filler
Space
170
198
29
Technical Issues
VendOutPaym
The VendOutPaym class defines the framework used to implement individual
formats for exporting vendor payments.
All classes extending from VendOutPaym will be available when you set up
export formats related to payment methods.
The extension should implement the following methods.
interfaceName
open
close
custVendOutPaymRecordRootClassId
dialog
pack
unpack
validate
7-26
Codepage
Codepage is a list of selected character codes in a certain order. Codepages are
usually defined to support specific languages or groups of languages that share
common writing systems. For example, codepage 1252 provides character codes
required in the Latin writing system.
The LocalCodePage macro lists code pages defined.
private int codepage()
{
#Localcodepage
;
return #cp_1252;
}
The close method is called when all payments are exported to the file. If the last
record should be followed by a record delimiter, then an additional empty call to
file.write() can be included in this method. The method can also send information
to the created files infolog.
The custVendOutPaymRecordRootClassId method returns the ID of the root
class implementing the different record types. This class is described in the
following text. Use the following code sample to guide you.
classId custVendOutPaymRecordRootClassId()
{
return classNum(VendOutPaymRecord_AXA);
}
7-27
Notice that the method also adds functionality to print a control report.
The pack and unpack methods should be implemented by using the usual
contents. The CurrentVersion and CurrentList macros are defined in the super
class.
The validate method should, as a minimum, contain validation of the specified
file name.
The method, ::description is a static method that returns the same information as
the object method interfaceName. The following is a sample of this method.
client server public static ClassDescription description()
{
return new VendOutPaym_AXA().interfaceName();
}
VendOutPaymRecord
The VendOutPaymRecord class defines the framework for implementing
individual record types in an export file.
Each payment format extending from VendOutPaym should be associated with a
class extending from VendOutPaymRecord. Each record type is implemented as
an extension of the class that is specified as the root in the
custVendOutPaymRecordRootClassId method described earlier.
You can use abstract classes in the hierarchy with the purpose of sharing code
between some record formats. The rule is that you should only implement the
interfaceName method on classes that implement an actual record type.
7-28
interfaceName
checkValues
output
Implementation
Perform the following steps to export the vendor payments to a file of a fixed
length as it is specified in the Scenario section of this lab.
TIP: The code samples for this lab can be found in the
AX2012_ENUS_DEVIV_07_01_LAB_CODE.txt file. You can copy and paste
these code samples into the correct methods.
1. Create a new class called VendOutPaym_AXA that extends the
VendOutPaym class. Implement the following methods as described
in the "Technical Issue" section of this lab. Use the code samples
provided in the sample file to guide you.
a. classDeclaration (declare variables as required for the class)
b. interfaceName
c. open
d. close
e. custVendOutPaymRecordRootClassId
f. dialog
7-29
pack
unpack
validate
description
Test
To test the implementation, complete the following steps.
1. Create a new payment method by using the path Accounts payable
> Setup > Payment > Methods of payment.
a. Specify the account type (Bank)
b. Set the payment account (USA OPER).
2. Click the Setup button on the File formats FastTab. Locate the new
AXA export format in the list of available formats and move it to the
left (Selected). Close the form. Select the file format in the Export
format field on the File formats tab page and save the record.
3. Click the Payment specification button and create two records
related to the two record formats (Bank transfer and Check)
implemented. Remember to specify the Export format for each
record type. Close the forms.
7-30
7-31
The CustInterest table defines the different interest codes that have the related
specification of the interest calculation that includes the percentages and accounts
that are used for posting.
The interest code used for each customer is determined by the posting profile that
can be accessed by the path Accounts receivable > Setup > Posting profiles >
Setup.
The CustInterestFee table is used to specify a fee that will be included in the
interest calculation. The reason for this separate table is the need to specify a
specific fee for each currency. The table is also used to specify a minimum
interest that should be calculated. The CustInterestRange table contains
information about the interest that is applicable by the ranges of an overdue
balance or the time on the customer transactions and is specific to a customer
currency.
Each calculated interest note has a header in the CustInterestJour table. The
calculation is specified in CustInterestTrans that contains a record for each
original transaction that has contributed to the interest calculation.
7-32
checkOpenTrans
checkSettlement
Bills of Exchange
A bill of exchange, also known as a draft, is an instrument used to administer
agreements to make payments. The document is created by the selling company.
However, it resembles a check written from the buyer to the seller.
Administration of bills of exchange can be divided into the following steps.
Draw
Protest
Redraw
Remittance
Settlement
Separate journals for each step handle registration. These different kinds of
journals are collected in the submenu Journals > Bills of exchange.
7-33
Protest
A bill of exchange is created by the selling company. A buyer can protest the bill
of exchange if he or she does not accept it.
For a protest, the transaction representing the drawn bill of exchange is selected
when you enter the information into the journal. When the journal is posted, the
bill of exchanges status is changed from Drawn to Protested.
The customer transaction that originated the drawn bill of exchange is settled and
replaced by a new, open transaction represented by the protested bill of
exchange.
Redraw
A protested bill of exchange can be re-drawn.
To do this, the transaction representing the protested bill of exchange is selected
when you enter the information into the journal. When the journal is posted, the
bill of exchanges status is changed from Protested to Redrawn.
The customer transaction that originated the protested bill of exchange is settled
and replaced by a new, open transaction representing the redrawn bill of
exchange.
Remittance
One of the purposes of bills of exchange is for sellers to use them to obtain bank
credit.
The transaction representing the drawn or redrawn bill of exchange is selected
when you enter the information into the journal. When the journal is posted, the
bill of exchanges status is changed from Drawn/Redrawn to Remitted.
The customer transaction that originated the drawn or redrawn bill of exchange is
settled and replaced by a new, open transaction representing the remitted bill of
exchange.
7-34
Promissory Notes
A promissory note is an instrument used to administer agreements to make
payments. The document is created by the buying company and states that the
buyer has agreed to make a payment in the future.
Administration of promissory notes can be divided into the following steps.
1.
2.
3.
4.
Draw
Redraw
Remittance
Settlement
Each of the steps are handled and registered by using a journal dedicated to each
step. The different kinds of journals are collected in the submenu Journals >
Promissory notes.
Draw
This step creates the document. Invoice transactions are selected when you enter
information into the journal.
When the journal is posted, the customer transaction that originated the invoice is
settled and replaced by a new, open transaction represented by the promissory
note.
Redraw
A settled promissory note can be re-drawn.
The transaction representing the honored promissory note is selected when you
enter the information into the journal. When the journal is posted, the promissory
note status is changed from Honored to Redrawn.
7-35
Remittance
A drawn or redrawn promissory note can be remitted.
The transaction representing the drawn or redrawn promissory note is selected
when you enter the information into the journal. When the journal is posted, the
promissory note status is changed from Drawn/Redrawn to Remitted.
The vendor transaction that originated the drawn or redrawn promissory note is
settled and replaced by a new, open transaction representing the remitted
promissory note.
Settlement
Final settlement of the promissory note ends the payment workflow. This step
represents the vendors final payment of the invoice that is the basis for the
promissory note.
The transaction representing the remitted promissory note is selected when you
enter the information into the journal. When the journal is posted, the promissory
note status is changed from Remitted to Honored.
The vendor transaction that originated the remitted promissory note is settled and
replaced by a new, open transaction representing the honored promissory note.
7-36
Implementation
To find and settle customer and vendor open invoices of the same currency,
follow these steps.
TIP: The code samples for this lab can be found in the
AX2012_ENUS_DEVIV_07_02_LAB_CODE.txt file. You can copy and paste
these code samples into the correct methods.
1. Import the project AX2012_ENUS_DEVIV_07_02_LAB.xpo. The
project contains a framework for the class
AXACustVendTransferBalance.
2. Do not be concerned about the dialog and so on. This is already
implemented so that you can focus on the Accounts receivable and
Accounts payable modules.
3. Implement the method run, to find and create the settlements. For
each customer who has a related vendor, follow these steps.
a. Find an open customer transaction and calculate the remaining
amount.
b. Find an open vendor transaction with the same currency and
calculate the remaining amount.
c. Calculate the settlement between the two transactions as the
minimum amount of the two.
d. Create two lines in a ledger journal and update the related
settlement specifications.
7-37
Test
To test the implementation, follow these steps.
1. Create a reference between customer 3001 and vendor 3004, by
using the path Accounts receivable > Customers > All customers
in the Vendor account field on the Miscellaneous details FastTab
in the Customer details form.
2. Create a number sequence by using the path Organization
administration > Common > Number sequences > Number
sequences. This number sequence should not be marked as manual,
but is should be marked as continuous.
3. Create a journal name by using the path General ledger > Setup >
Journals > Journal name. The journal type should be daily, and
select the number sequence that you created in step 2 for the voucher
series.
4. Run the class by right-clicking selecting Open. On the dialog box, in
the Name field, select journal name that you created in step 3, and
select the number sequence that you created in step 2, in the
Voucher series field. Click OK.
5. To view the journal, open General ledger > Journals > General
journal. Select the journal number that was created in the infolog
message, and then click Lines. To view the settlements that were
created, click Functions > Settlement on each line, and then click
No to not remove the settlements.
NOTE: You may receive warnings that the number sequence you created does
not allow reservations. This message can be ignored.
TIP: If you want to repeat the test, you should delete the journal generated.
7-38
Summary
The Accounts receivable module is used to track customer invoices and
incoming payments. The Accounts payable module is used to track vendor
invoices and outgoing expenditures.
The Accounts receivable module has functionality for free text invoices. Free
text invoices are useful because they are not related to inventory items and
provide a simple invoice mechanism.
The Accounts payable module uses invoice journals to process invoices that are
not related to inventory. The following types of invoice journals are available.
Invoice Register
Invoice Journal
7-39
a.
b.
c.
d.
e.
f.
Payment Schedules
Cash Discount
Terms of Payment
Payment Fees
Method of
Payment
Payment Days
2. What is the primary difference between free text invoices and sales order
invoices?
7-40
7-41
2.
3.
7-42
Solutions
Test Your Knowledge
1. Categorize the following items.
f 1. Used to make a payment on a specific day.
a 2. Used to pay invoices in installments.
c 3. Used to calculate due dates of transactions.
d 4. Used to add more charges to a transaction.
e 5. Used to define how payments are
summarized and posted.
b 6. Used to accrue and reward discounts when
payment terms are met.
a.
b.
c.
d.
e.
f.
Payment Schedules
Cash Discount
Terms of Payment
Payment Fees
Method of
Payment
Payment Days
2. What is the primary difference between free text invoices and sales order
invoices?
MODEL ANSWER:
Free text invoices cannot be related to inventory items, and sales order
invoices can be related to inventory items.
3. Which tables are used for vendor invoice journals?
( ) CustInvoiceTable and CustInvoiceTrans
( ) VendInvoiceTable and VendInvoiceTrans
() LedgerJournalTable and LedgerJournalTrans
( ) VendJournaTable and VendJournalTrans
4. Which of the following transactions are supported in the Accounts receivable
module for customers? (Select all that apply)
() Free text invoice
() Payment journals
( ) Promissory notes
() Bill of exchanges
5. Which of the following frameworks and classes are used by the free text
invoice generation process? (Select all that apply)
() CustVoucher
() LedgerVoucher
() CustInvoiceCalcTax
() FormLetter framework
7-43
7-44
Review the general features that are supported with sales and
purchase orders.
Discuss how the trade agreement classes are used and can be
extended.
Describe how sales and purchase agreements are used and set up.
Discuss how the sales and purchase agreement classes are used and
can be extended.
Describe the differences between the sales order and the sales
quotation features, data model, and classes.
Describe the differences between the purchase order and the request
for quotation features, data model, and classes.
8-1
Introduction
The sales and purchasing processes are important components of every business.
Microsoft Dynamics AX 2012 provides functionality businesses can use to
manage purchase and sales information with the integration to inventory and the
general ledger.
The order to cash process is also referred to as the sales process, and involves
many steps. These steps include gathering leads and opportunities that drive the
creation of prospective customers, followed by the quotation process, and after
the quotation is accepted, generating confirmed sales orders. Next is the picking
and shipping of the products and then invoicing or billing the customer. After the
customer receives the goods payment must be collected.
Because every business has different processes the source to sell process steps
can be conducted differently, Microsoft Dynamics AX 2012 helps businesses
manage these processes that are usually controlled by the type of customer that
includes, business-to-business (B2B), business-to-customer (B2C) or by specific
business requirements.
The procure to pay process is also referred to as the purchase process, and it also
includes many steps, and is similar to the source to sell process. These steps
include requesting and qualifying a new vendor, submitting purchase requisitions
by employees requiring various products, followed by the request for quotation
process with the vendor. When the purchase requisitions and, or the request for
quotations are approved, purchase orders are generated and then confirmed with
the vendor. After the products are delivered, a product receipt is generated and
the invoice is recorded for the purchase order, and then payments must be
generated to the vendor.
This course introduces the features in Microsoft Dynamics AX 2012 that support
the sales and purchase processes, and it also reviews the data models and coding
patterns for many of the features. Since the customer and vendor data models and
coding patterns are similar, the details of both will not be discussed.
8-2
Sales order: The standard sales order that does have inventory
transactions and can be processed.
After a sales order is created and the customer, item or category, quantity, and
pricing information are entered, the order must be processed. The four steps to
process a sales order include the following.
1. Confirmation: The order entry process is completed and the details
are printed or emailed to the customers to "confirm" the order.
2. Picking list: A document called a picking list is generated for the
warehouse workers. The warehouse workers use this document to
find the required items in the warehouse and bring them to a
packaging or staging location for delivery. This is also referred to as
"picking" the items. When this process is completed, the inventory is
updated to show a status of picked so that the items cannot be used
on other sales orders.
3. Packing slip: A document called a packing slip is generated for the
delivery of the items. The warehouse workers will use this document
to verify the items that need to be packaged or delivered, and this
document is usually sent with the shipment to the customer. When
this process is completed, the inventory is updated to remove the
quantities from the on hand inventory.
4. Invoice: A document called an invoice is generated. When the
invoice is generated for a sales order, it is the final step of the sales
order process where the customer is effectively billed or "invoiced"
for the items that are delivered. This process creates an open
transaction on the customers account that must be paid for by the
customer.
8-3
8-4
8-5
8-6
The PurchTable table holds a record for each purchase order, whereas the related
lines are stored in the PurchLine table. A purchase order is always related to a
vendor to whom the goods in the purchase order will be received from. A
different vendor account might be specified to receive the invoice.
8-7
8-8
8-9
The classes have many object methods returning several amounts such as order
balance, volume, weight, taxes, charges, and so on.
8-10
Agreements
The Agreement framework offers users of Microsoft Dynamics AX a broad set of
tools for applying and following up on commercial agreements between the
company and its customers and vendors regarding of buying/selling a certain
quantity or/and volume of an particular item as well as a range of items within a
certain category with a special policies applied to achieve an agreed price for
trading goods and/or services.
The prices and discounts of the sales or purchase agreement overrule any prices
and discounts stated in any trade agreements that could exist.
You can specify the agreement commitment type on the purchase and sales
agreements. This controls what information is required on the agreements. The
commitment type also determines how the agreement is being managed to
determine when the commitment is fulfilled.
Trade Agreements
Prices of sold and purchase items should be maintained. Prices can be set up
specifically for individual items, customers, and vendors, or prices can be set up
for a group of customers or vendors, or for all customers as one group.
The price structure also includes line, multiline, and final discounts.
Administration of sales prices and purchase prices that includes publishing to the
organization and customers, is an ongoing task.
8-11
Price
PriceUnit
Markup
8-12
When more complex pricing is required, you can use Trade agreements to define
detailed pricing information for specific vendors, currencies, quantities, or date
ranges. Trade agreements allow you to set up purchase prices, line discounts,
multiline discounts, and total discounts. This is controlled by the Relation field
on the PriceDiscTable. Each specification in the price agreement table contains
item and vendor dimensions.
This creates up to nine different levels of specification. The search for a price or
discount must use a priority between the several combinations.
Item
Group
All
Vendor
Group
All
Price groups are used to create the groups of customer, vendors, or items that you
want to handle in the same way for prices. A separate price group can be created
for each type of pricing (prices, line discounts, multiline discounts, and total
discounts) and for each group of transactions (customers, vendors, and items).
Many different relations exist between the PriceGroup table and the
PriceDiscTable.
8-13
The PriceDiscAdmName table contains the journal names that are defined in the
setup. PriceDiscAdmTable contains the header for each journal, whereas
PriceDiscAdmTrans contains the individual price agreements. If the journal line
is loaded from the existing agreements, then it will be related to the existing
record in PriceDiscTable (RecId).
8-14
8-15
8-16
8-17
Explicit relations between history- and base- entities are established for only a
few entities (exactly only for AgreementHeader and AgreementHeaderHistory as
well as for AgreementLine and AgreementLineHistory). Besides them, all other
similar relations would be redundant for the data model and therefore were not
implemented.
8-18
Charges
A charge is an additional fee or cost that can be added to a purchase or sale order.
Charges can be linked to the header or the lines of the orders. They can be added
manually to an order, or a rule can be configured to have charges automatically
added to an order.
8-19
Each charge that is added to an order is defined by the charge code. The charge
code defines how the charge will be assessed. For example, a sales charge can be
assessed as a fee that will post to the customer's account this type of charge
increases the invoice amount of the order. Another option on the set up of the
charge code is used for the charge to be assessed to the item. This type is most
often used as a landed cost that increases the inventory cost but does not increase
the invoice amount to be paid by the customer. Similar options exist for purchase
orders.
Additionally, options exist on the charge code set up to determine which main
account the cost or fees should post to when invoice updating the order. For
purchase orders there are additional options to select a method for allocating a
charge that is applied to the header to the lines of that order.
8-20
8-21
The AccountCode and ItemCode fields are enumerations with the following
entries.
8-22
FormLetter Framework
The FormLetter framework in Microsoft Dynamics AX is used when posting
documents for sales or purchase orders. This framework is refactored in
Microsoft Dynamics AX 2012 to provide better support for customizations,
extensibility, and performance. This lesson describes the Microsoft Dynamics
AX 2012 version of the framework.
8-23
8-24
8-25
The module specific classes, such as SalesFormLetter, are updated so that they
extend the FormLetterServiceController class. All functionality that does not
relate to the interaction with the Posting form is moved to other class hierarchies.
The class variables that are assigned a value to use during the posting process in
earlier releases are moved to the data contract classes.
The pattern used to assign values to the data contract classes are the parm
methods from Microsoft Dynamics AX 2009 that changed and use the data
contract class instead of a global class variable. The following code sample is an
example of a parm method.
public boolean parmDirectDeliveryUpdate(boolean
_directDeliveryUpdate =
salesFormLetterContract.parmDirectDeliveryUpdate())
{
return
salesFormLetterContract.parmDirectDeliveryUpdate(_directDel
iveryUpdate);
}
8-26
Parm methods are used to set and get the data from a contract class. The
following code sample is an example of a parm method:
[DataMemberAttribute]
public NoYes parmDirectDeliveryUpdate(NoYes
_directDeliveryUpdate = directDeliveryUpdate)
{
directDeliveryUpdate = _directDeliveryUpdate;
return directDeliveryUpdate;
}
8-27
The run method initializes the objects required for posting, creates the journal,
posts the documents, and then calls the logic to print the document if required.
The class also has a service operation method for each of the document types that
can be posted by this service, such as PostSalesPackingSlip.
[SysEntryPointAttribute]
FormLetterOutputContract
postSalesOrderPackingSlip(SalesFormLetterPackingSlipContrac
t _contract)
{
formletterContract = _contract;
this.run();
return outputContract;
}
8-28
The SalesTable and SalesLine tables contain information manually entered in the
sales table form.
The update is activated by using a button in the Action Pane of the Sales order
form. This creates an update specification in the SalesParm-tables.
General update parameters are stored in SalesParmUpdate. Specifications related
to one sales order are stored in SalesParmTable, whereas individual lines are
specified in SalesParmLine.
Lines from different sales orders can be collected in one invoice. The
SalesParmSubTable holds one record for each sales order that contributes to such
invoices. Information in SalesParmLine refers to the sales order that contains the
invoice with the SalesId field, whereas the OrigSalesId field contains the ID of
the sales order that relates to the line(s) in question. SalesParmSubLine contains
sales order line update relations.
8-29
8-30
8-31
There are also document specific classes for each of the documents created by
the framework, such as SalesPackingSlipJournalCreate. These classes hold the
logic specific for a document. Those document classes that support having
multiple versions of the same document extend the
FormLetterVersionableJournalCreate class.
The FormLetterService class instantiates this class hierarchy for each of the
journals it needs to create and calls run.
8-32
8-33
8-34
Document
Sales
Quotation
CustQuotation...
Confirmation
CustQuotationConfirmation...
CustConfirm...
Picking list
WMSPickingRoute...
Packing slip
CustPackingSlip...
Invoice
CustInvoice...
Confirmation
VendPurchOrder...
Receipts list
VendReceiptsList...
Packing slip
VendPackingSlip...
Invoice
VendInvoice...
Purchase
8-35
8-36
Technical Issues
This section outlines additional information that is required to implement the new
field.
InitFrom
Transfer of information from one table to another is frequently used when you
create records and save transactions from updates. This task is typically
implemented by creating an object method in the destination table named
initFrom<sourcetable>. Creating a record in a sales table in this manner involves
the activation of the following logic
salesTable.initFromCustTable();
8-37
Implementation
Extend CustTable, SalesTable, SalesParmTable and CustInvoiceJour tables with
the new field that contains the instructions for the payment of invoices sent to the
customer.
1. Create a new project to store all of the objects that you modify or
create as a part of this lab.
2. Make an extended data type defining properties of the payment
instruction.
3. Create a new field in the tables that is required to implement the
requested possibilities to change and store the information.
4. Add fields to the relevant forms to view the current value and
possibly edit this value.
5. Add a field to the SalesInvoiceTmp table for the payment
instructions and modify the SalesInvoiceDP class to populate the
field. Then include the field in the header of the SalesInvoice report.
8-38
To add the payment instruction extended data type, follow these steps.
1. In the AOT window expand the Data Dictionary node.
2. Right-click the Extended Data Type node and select New > String.
3. In the Properties window, set the following values on the new real.
a. Name = PaymentInstruction
b. Label = Payment instruction
c. HelpText = Instruction on how the customer should pay the
invoice.
d. DisplayHeight = 3
e. StringSize = 100
4. Save the extended data type.
5. Drag the newly created PaymentInstruction extended data type into
the project that you created earlier.
To add the payment instruction field to the CustTable, SalesTable,
SalesParmTable, and CustInvoiceJour tables, follow these steps.
1. Under the Data Dictionary node in the AOT window, expand tables
and locate the CustTable.
2. Drag the table into the project that you created earlier.
3. Expand the CustTable table.
4. Select the PaymentInstruction extended data type and drag it to the
Fields node of the CustTable table.
5. Save the table.
6. Right-click the Field groups node and then click New Group.
8-39
8-40
8-41
8-42
8-43
Test
Use the following steps to create a new sales order, and to post and print the
invoice.
1. Open the Customers form by using the path Accounts receivable >
Common > Customers > All customers and specify a value in the
new field that has the payment instruction.
2. Create a new sales order by using the path Accounts receivable >
Common > Sales order and select the customer modified in step 1.
Make a modification to the payment instruction inherited from the
customer.
3. Add a line to the sales order for item number 10007.
4. Post the invoice by clicking the Invoice tab of the Action Pane and
then click Invoice in the Generate group. Change the payment
instruction inherited from the sales order. Select to print the invoice
and specify the screen as the destination of the report by clicking the
Printer Setup->Invoice button and change the print destination to
screen on the Print destination settings form.
5. You can repeat the test by creating a new sales order.
TIP: You can compare your solution to the
AX2012_ENUS_DEVIV_08_01_LAB_SOL.xpo file provided with the training
image by importing the XPO file and then comparing the objects.
8-44
Other Features
There are many additional features in the Sales and Purchase Order modules.
The following lesson introduces sales quotations, request for quotations,
purchase requisitions, and categories.
Purchase order
The purchase order is the most complex use of the versioning pattern in
Microsoft Dynamics AX 2012. Besides the traceability and change management
with workflow integration it also enabled other procurement functionality
extensions like encumbrance accounting for confirmed purchase orders.
The change management functionality for purchase orders is optional in
Microsoft Dynamics AX 2012 and turned off by default. It can be configured at
the legal entity, vendor or specific order level. When activated any change to
order data requires workflow approval. When not activated the purchase order is
always considered pre-approved. Intercompany, Direct Delivery and
production/master planning derived orders never have change management
enabled. Any change that is identified as part of the contract requires new order
confirmation before an invoice or product receipt can be processed against it.
This applies also when change management is not activated for an order and thus
the change tracking functionality is always available (every confirmation creates
a new version of the document).
8-45
The following purchase order logical data model shows how the versioning
pattern is applied to the purchase order document. White entities were present in
earlier AX versions: PurchaseOrder (PurchTable),
PurchaseOrderLine(PurchLine) and the *MiscCharge* entities (MarkupTrans).
They define the basic PO tree structure with the PurchaseOrder being the root
node, PurchaseOrderLine its child node type and MiscCharge nodes that could be
children of both PurchaseOrder and PurchaseOrderLine. The highlighted entities
were added to support versioning.
8-46
8-47
8-48
8-49
Summary
Sales orders and purchase orders are two of the main transactions in Microsoft
Dynamics AX. The functionality and data structures that are used with each are
very similar.
Sales orders and purchase order have many integrations with other areas and
modules of the system. Several different frameworks are provided with Microsoft
Dynamics AX to help you manage basic order information, pricing, charges and
document history.
Both areas integrate with the agreements feature which allows you to define basic
contracts for sales or purchases. The FormLetter framework allows you to
manage the data for posting documents such as confirmations, packing slips, and
invoices.
8-50
8-51
2.
3.
8-52
Solutions
Test Your Knowledge
1. Which class is used to control functionality about each type of order?
( ) PurchOrderType
() PurchTableType
( ) InventOrderType
( ) InventTableType
2. Describe what happens to MarkupTrans when an invoice transaction is
posted.
MODEL ANSWER:
When the invoice is generated, a copy of the charge transaction is created
that is related to the invoice journal. The copy is related to the original record
by the OrigTableId and OrigRecId fields.
3. If no price is found in the PriceDiscTable which table is used to select the
price.
( ) PurchPriceTable
( ) EcoResPriceTable
() InventTableModule
( ) InventTablePrice
4. Which set of tables is used to store document generation information before a
document is posted for sales orders?
( ) SalesUpdate... tables
() SalesParm... tables
( ) SalesPost... tables
( ) SalesDocument... tables
8-53
8-54
Describe how projects are created, and the various types of projects
that are available.
Discuss the transaction types that are used for journals in the Project
management and accounting module and how categories, pricing,
and line properties control the posting of these transactions.
Review the data model and the ProjTrans class hierarchy that is used
for posting transactions against a project.
Review the data model and classes used for generating invoice
proposals and invoices.
Review how estimate projects and cost templates are used in the
system.
Introduction
This chapter introduces you to the Project management and accounting
module of Microsoft Dynamics AX. The design and data models for several key
areas are reviewed.
Use the project management and accounting module to plan, create, manage,
control, and complete projects for your organization. Customer-focused projects
can be set up on a time and materials or fixed-price basis. You can also use the
module to manage costs for internal and investment projects.
9-1
9-2
Projects
The project list contains the list of all projects in the current company and will be
used frequently by project managers. Open Project management and
accounting > Common > Projects > All projects.
Subprojects
Some projects can easily be processed as one large project for planning and
accounting if the subprojects and complexity are low. Other projects gain more
overview when distinct phases of the project's activities are split into separate
subprojects. For example, if a large project has several phases such as a design
phase and an implementation phase a separate subproject can be created for each
phase.
9-3
Project Types
The Project management and accounting module, supports the following six
project types.
9-4
Time and material: Time and material projects are invoiced as work
progresses based on the consumption of hours, expenses, items, or
fees on the project. This project type is mainly applied to projects
where costs can be matched with the revenue on each transaction and
the project is invoiced as work progresses.
Cost: Cost projects are internal projects that register hours, expenses,
and item transactions. Transactions on cost projects are posted to
profit and loss accounts and cannot be capitalized to balance
accounts.
Time: Time projects are internal projects that only register hour
transactions. Time projects are applied to the total number of hours
consumed on a task or a project. Unlike the transactions on an
internal project type, transactions on a time project are never posted
to ledger accounts. Examples of time projects include the registration
of illness or holidays.
Project Groups
Project groups define how the system processes the ledger postings of the project
types. Each project belongs to a single project group.
Project groups control the posting profiles to the general ledger and the project
WIP.
Rules for posting transactions are set up according to project or category type,
and the costs are posted into profit and loss or balance accounts. Because the
project group is mandatory when you create a new project, a minimum of one
project management and accounting group must be set up.
When you create a project group, you must immediately determine the project
type tied to this group. Then you will assign the specific conditions connected to
that specific type, such as invoice posting, journalizing, cost price, and sales
price.
When you create new projects, you can only select groups that are defined for
that specific project type.
9-5
9-6
The ProjTable is the primary table for projects; each project has one record in the
ProjTable. For external (billable) projects, each project contract
(ProjInvoiceTable) is attached to one or more customers for invoicing and
payment. Each project is also attached to a project group (ProjGroup). The
project group defines how the system processes the ledger postings of the various
project types.
9-7
9-8
Activities are set up by using an activity hierarchy, in which sub activities are
created as smaller tasks within one large task or phase of a project.
Information related to working with activities includes the following.
Both project budgets and project forecast can refer to activities in the
WBS.
To create a new activity, from the Work breakdown structure window, click a
specific activity and then click New.
9-9
Each project activity has one record in the ProjActivity table. Each project
activity record is associated with one category. Each project can have many
different activities and many projects can have the same activities.
9-10
Transaction Types
After a project is created, transactions are entered through journals or projectrelated business documents. The following transaction types are supported in the
Project management and accounting module.
Fee: Surcharges
The system searches for sales and cost prices and applies them as a
default to the transaction. The user can override prices in the journal.
The sales tax group is copied from the project or project contract. For
non-item transactions, the item sales tax is derived from the specified
project category.
9-11
Project Pricing
Project transactions include a cost price, a sales price or both. The cost price is
the price for each unit that is charged to the project. If a customer is invoiced for
transactions, a sales price is specified for each unit. Sales prices are not used for
fixed-price projects or internal projects.
9-12
Line Properties
In addition to project categories and pricing, line properties are also significant to
project transactions. A line property controls whether any of the following
occurs.
The line properties are set up from the Line properties form. Open Project
management and accounting > Setup > Line properties > Line properties.
Journals
Journals are used to post the various types of transactions. Each journal uses
different tables with similar data models. The following topics review the hours
journal.
The basic information entered for the hour registration on a project includes the
following.
To open the hour journal form, open Project management and accounting >
Journals > Hour.
9-13
9-14
Journal
header table
Posted journal
transaction table
Hour
ProjJournalT
able
ProjJournalTrans
ProjEmplTrans
ProjEmplTransCost
ProjEmplTransSale
Expense
LedgerJourn
alTable
LedgerJournalTrans
_Project
ProjCostTrans
ProjCostTransCost
ProjCostTransSales
Item
InventJourna
lTable
InventJournalTrans
ProjItemTrans
ProjItemTransCost
ProjItemTransSale
Fee
ProjJournalT
able
ProjJournalTrans
ProjRevenueTrans
ProjRevenueTransCost
ProjRevenueTransSale
9-15
9-16
Challenge Yourself!
Use the information provided, to add a new warranty item field to the hours
journal that is copied to posted hours transaction record.
Step by Step
To create a new project, follow these steps.
1.
2.
3.
4.
5.
6.
9-17
9-18
9-19
9-20
After the project budget is defined, make sure that the project is configured to use
the budget. You can do this in the Budget and forecast tab on the Project
details form. After you enter a budget or budget revision you can allocate the
budget amounts across periods.
When you are entering a project item task (such as a project purchase requisition,
purchase order, or vendor invoice) you can view the impact the document will
have on the transaction on the project budget.
Demonstration: View Project Budget Status for a Project Purchase Order
1. Open Project management and accounting > Common > Item
tasks > Project purchase orders.
2. Click Purchase order in the New group of the Action Pane.
3. On the Create purchase order form select a vendor such as 1102,
and then click the General FastTab.
4. In the Project ID field, select a project such as 10002: Colorado
Airport, and then click OK.
9-21
At the end of the year, you can transfer any remaining budget amounts for
multiyear projects to future years. You can also create budget register details for
those amounts in the associated general ledger accounts. The
ProjYearEndProcess class contains the logic to run the process.
9-22
When budgets are activated for a project, the project budget details are stored in
the ProjBudget table. Each budget amount is stored in the ProjBudgetLine table.
The ProjBudgetLine.ProjTransType field is used to determine whether the
budget is a cost or revenue.
9-23
Forecasting
You can use project forecasting to forecast expected labor, machines, expenses,
and cash flow that is needed to run projects. You can also use project forecasting
to effectively use resources and to control expenses so that a reasonable profit
margin can be earned.
In the Project management and accounting module project forecasts can be
entered against the following transaction typesexpenses, fees, items, and hours.
When you set up forecasts you can create a new record for each forecast model to
use, and create submodels if a model hierarchy must be built. The model
hierarchy can only contain two levels.
After you have defined forecast models, you can enter forecasts for hours,
expenses, fees, items and on-account payments.
Open Project management and accounting > Common > Projects > All
projects. Select a project. On the Action Pane, on the Plan tab, in the Forecast
group, you can click a specific type of forecast.
9-24
9-25
Each hour forecast record is stored in the ProjForecastEmpl table. Each forecast
is related to a specific activity from the work breakdown structure and the
resource requirements are stored in the WrkCtrActivity... tables. These
requirements are used to schedule projects.
9-26
Forecast table
Hour
ProjForecastEmpl
Expense
ProjForecastCost
Item
ForecastSales
Fee
ProjForecastRevenue
On account
ProjForecastOnAcc
Project Contracts
The project contract contains necessary customer information for correctly
issuing invoices to one or more project customers. All external projects must
refer to a project contract. This makes the setup of the project easier. The project
contract includes information on the following.
Invoicing currency
9-27
Terms of payment
You can also choose to set up project funding information for a project including
funding sources, limits, and rules for funding.
After a project contract is defined, it can be used when you create a new external
(time and material or fixed-price) project.
Each project contract is stored in the ProjInvoiceTable. Each project can then be
related to one project contract. Multiple projects can be related to the same
project contract. The funding information on project contracts is stored in three
additional tables.
9-28
Invoicing
You can create project invoices by using an invoice proposal that is later
confirmed and posted to the general ledger. This proposal is populated according
to selections made by the user, which can be modified if necessary and then
posted.
Invoice Proposals
The invoice proposal is generated based on the transactions registered on the
projects. The transaction types include expense, employee hours, fee, items, and
an offset on-account payment.
The Invoice proposals form includes proposed invoice lines on separate tabs,
according to the transaction type.
Invoice proposals are created by using the ProjInvoiceChoose super class and
subclasses. On account transactions use a specific subclass. The following figure
shows the ProjInvoiceChoose class hierarchy.
9-29
Proposal Table
Hour
ProjProposalEmpl
ProjProposalEmplDetail
Expense
ProjProposalCost
ProjProposalCostDetail
Item
ProjProposalItem
ProjProposalItemDetail
Fee
ProjProposalRevenue
ProjProposalRevenueDetail
On account
ProjProposalOnAcc
ProjProposalOnAccDetail
Post Invoices
After the invoice proposal is reviewed and edited, and the lines are satisfactory
you can post the invoice by clicking Post.
As with standard sales order invoicing, you can specify whether a credit limit
check of the customer must be performed when you post the invoice. The overall
control of how the system warns the user if the credit limit is exceeded is set up
in the Project management and accounting parameters form under in the
Invoice tab under Credit rating.
In addition to the Invoice proposal form, invoice proposals can also be posted by
running the periodic job, Post invoice proposals. To find this job, open Project
management and accounting > Periodic > Project invoices > Post invoice
proposals.
9-30
When the invoice is posted new transactions are created in several tables to store
the posted information. Each invoice has a record in the ProjInvoiceJour table for
the header of the invoice. For the lines of the invoice, several tables are used for
each transaction type.
Transaction Type
Hour
ProjInvoiceEmpl
ProjInvoiceEmplDetail
Expense
ProjInvoiceCost
ProjInvoiceCostDetail
Item
ProjInvoiceItem
ProjInvoiceItemDetail
Fee
ProjInvoiceRevenue
ProjInvoiceRevenueDetail
On account
ProjInvoiceOnAcc
ProjInvoiceOnAccDetail
9-31
Challenge Yourself!
Put an invoice proposal on hold.
This requires a new field, OnHold, type = NoYes. If this field is set, then the
invoice cannot be posted, and a new invoice proposal can be created that could
include transactions included on the OnHold proposal.
Step by Step
To create a new project, follow these steps.
1.
2.
3.
4.
5.
6.
9-32
9-33
9-34
9-35
Estimate Projects
Estimates are maintained on individual estimate projects or on batches of
estimate projects. When estimate projects are processed in batches by using
periodic jobs, the estimate projects that are selected for processing are grouped
by period code.
You can work with estimates in the following ways:
Cost Templates
Cost templates are used in the calculations for revenue recognition for fixed-price
projects.
In Microsoft Dynamics AX, a cost template is an attribute on an estimate project.
The cost template and cost template lines determine which forecasts and which
actual transactions are included to calculate the percentage of the project that is
completed. The percent-complete value is then used to calculate how much
revenue is recognized.
Example
You are working on a website design project for a customer for a flat fee of
10,000 United States dollars (USD). You forecast that it will take 100 hours
(5,000 USD) to complete the project, and two plane tickets and four nights in
hotels for trips to the customers site (1,800 USD). This results in a total
forecasted cost of 6,800 USD.
9-36
Do you want to include all costs (hours and expenses) or just hours?
Your answers to these questions determine the options that you set on the cost
template and the categories that you select on the cost template lines.
The following table shows the results of different methods of calculating the
percent-complete value for this scenario.
Completion
based on
Dollar cost
or units
Percent
complete
Calculation
All hours, no
expenses
Dollar cost
37 percent
All hours, no
expenses
Units
40 percent
40 hours/100 hours
(including five unplanned
hours)
Planned hours,
no expenses
Dollar cost
or unit
35 percent
35 / 100 hours
or
35 x 50 USD /5,000
Dollar cost
27.2
percent
9-37
Therefore, if you use either of the first two methods that are
listed in the earlier table, you should change the plan (forecasted
units) when you become aware of deviations. In this case, you
would add or subtract hours based on your knowledge of what is
required to finish the project.
If the project requires another 65 hours to complete, you would
add five hours to the plan for a total of 105. If you know that
your assistant will have to perform another five hours of
research, the total will be 110 hours, and so on.
If you use the third method that is listed in the table, you would only
update the planned hours for your own time to keep the percentcomplete calculation accurate. Your profitability will change when
unplanned hours are logged. However, you will remain on a known
percent-complete trajectory.
If you use the fourth method that is listed in the table, the risk is that
expenses will occur at irregular times and might not be reflected in
your completion progress.
o
9-38
Summary
This chapter described the overall use and design of the Project management
and accounting module. Several types of projects exist that you can use to create
and manage project information. Projects can be linked to one another by using
subprojects to create a hierarchy of related projects. Each project is assigned to a
group that controls how the ledger postings will work for each project.
You can use the work breakdown structure to create a hierarchy of tasks or
activities that will be completed for a specific project. Activities can be
associated to resources that can be linked to resource requirements for
forecasting and scheduling the tasks.
Projects can have many transactions posted to record the various costs and
revenues for the project. The transactions can include hours, expenses, items, fee,
and on account payments. Journals are used to post these transactions. After
transactions are recorded, you can create invoice proposals and invoices to record
the project transactions against the customer's account and into the general
ledger. This requires that a project contract is set up first.
You can also record budgets and forecasts for projects to provide better reporting
and to set limits and controls on transactions.
You can use estimate projects to record estimates into the general ledger based
on cost templates that define how the revenue is to be recognized for a specific
project. Later when the project transactions are recorded, you can eliminate the
estimates.
9-39
9-40
9-41
2.
3.
9-42
Solutions
Test Your Knowledge
1. Describe the difference between project budgeting and project forecasting.
MODEL ANSWER:
Project budgeting helps companies monitor and control project revenue and
expenditures. By comparing budget and actual amounts, your organization
can reallocate money and resources to meet budgetary goals.
Project forecasting is a process that is used to forecast expected labor,
machines, expenses, and cash flow that is needed to run projects. Project
forecasting is expected to help optimize the running of a project by using
resources effectively, and by controlling expenses so that a reasonable profit
margin can be earned.
2. Which of the following statements are true about work breakdown
structures? (Select all that apply)
( ) Activities are shared between projects.
() Each project transaction can be associated with one activity.
() Project budgets can be associated with activities.
( ) Project forecasts cannot be associated with activities.
3. Which class hierarchy is used to control the functionality for each type of
project?
( ) ProjLineType
() ProjTableType
( ) ProjPostingType
( ) ProjTransactionType
4. What happens to the project transactions when a project is invoiced?
( ) The records are deleted from the ProjProposal... tables and copied into
the ProjInvoice... tables.
( ) The records are updated in the ProjProposal... tables with the final
invoice ID and the invoiced status.
() The records are updated in the ProjProposal... tables and copied into
the ProjInvoice... tables.
( ) Reversal records are created in the ProjProposal... tables and new
records are created in the ProjInvoice... tables.
9-43
9-44
Introduction
Production control in Microsoft Dynamics AX 2012 consists of many aspects of
the production environment. This includes creation, estimation, scheduling,
consumption, feedback, and cost accounting for production orders.
10-1
In this chapter, you will review the following major components of the
Production control module.
10-2
Routes: The path that the item takes from operation to operation
throughout the production life cycle.
Bill of Materials
A bill of materials (BOM) is a complete list of all the components, parts, raw
materials, assemblies and their quantities that are required to make a finished
product.
BOMs define the relationship between the components and the finished product
or sub-assembly. The item number that represents the BOM is often referred to as
the finished product, and the components that make up the finished good are
referred to as raw materials. In some cases the item number that represents a
BOM is not a finished good and is instead referred to as a sub-assembly which is
used in another BOM to create a finished product or another sub-assembly. A
clear definition of this relationship is important for the following.
Allocation of materials
Every item that must be physically accounted for in a finished product or subassembly product or financially accounted for in the costing phase must be
included in the BOM. Although BOMs define the components and their
relationships, they do not define the sequence of steps to produce or assemble the
finished item.
BOMs are made up of product types, versions, configurations, sites, levels, lines,
and information used for cost calculations. In the following sections, these
components and the data model for BOMs are reviewed to illustrate the
relationship between the tables.
10-3
BOM Version
A BOM can have multiple versions. When you create a BOM, you must have at
least one version. In order to use the BOM it must be approved and activated.
Later, if the BOM is no longer required, the activation and approval can be
removed. The BOM version is used to define which finished product item
numbers are linked to the BOM. You can also specify information about the date
of validity, site, quantity ranges, whether the version is active, and who approved
it.
Zero or more BOM versions can be valid or active for any item at any given
point in time. However, only one version can be applied. The applied version is
selected based on time, site, and quantity. The BOM version is useful in these
cases.
Two products that consist of the same raw materials but different
production processes will be able to use the same BOM but different
routes. For example, the same product is produced in two different
sites by using different equipment.
BOM Configuration
For planning, calculation, and consumption purposes, each BOM line must
specify whether the item has any configurations. A configuration is a standard
component combination, such as a satellite speaker and a sub-woofer that can be
specified for a BOM item during the ordering process. For example, the user
might select the size and color of speaker to be included in the home theater
system.
10-4
10-5
BOM Costing
Bills of material calculations use data from several sources to calculate the
rolled-up or total costs of a manufactured item. The sources include information
about items routing details, indirect cost calculation formulas, and the costing
version. The purchased item information that is used in a standard cost BOM
calculation includes cost, cost group, and warning conditions.
The manufactured item information that is used in a standard cost BOM
calculation includes standard order quantity for inventory and warning conditions
that are embedded in the item's BOM calculation group.
The bill of material information that is used in a standard cost BOM calculation
depends on the following.
BOM version
10-6
The BOMTable is the primary table of the construct. Contained within is the
setup for a Bill of Material, including Approved, BOMId, Name, Version, and
SiteId. This is best described as the header information that you must define for
the BOM. For example this is an Eight inch woofer speaker assembly.
The BOM is the line items associated with the primary table. You can have many
line items that are related to each BOMTable. Each BOM record is related to one
InventTable record to create the link for the components to the raw materials
items and services. For example, the woofer speaker assembly might include the
speakers, cabinet, and cross over assembly needed to construct the speaker. For
the speaker assemblies, they can be used for other cabinets or other
configurations.
The BOMVersion is the final table needed for the basic BOM set up. The
relationship between the BOMTable and BOMVersion is one or more versions
for each BOM. Each BOMVersion record is related to one InventTable record to
create the link to the finished product item number. For example, one version
could be used for one site and a different version for another site. Frequently
BOMs are phased out, with new components that are included in the latest
version.
10-7
Routes
Routes are the path or sequence that the product takes from operation to
operation, starting with the beginning of the production process and continuing to
the end. It is a set of sequential operations, or tasks, that are required to produce a
product. The route operations describe the requirements for the resources that are
required for performing each operation. Each route includes the following:
Operations to be performed.
Operations relations.
One or more routes can be mapped for each product, depending on the product
and the process. You can create a completely new route, or you can base a new
route on existing route information, and then adjust or update the information to
match the new production process. The same route can also be used for multiple
products.
In the following section, you will review how to use routes and operations and
the data model associated with them.
10-8
Know how many resources are needed for performing the operation,
and what those resources must be capable of. You should create
capabilities and also create resources and resource groups before you
set up the operations, because operations are closely related to
resources.
Sequence of Operations
Operations in a route must be attached to each other in a logical way to reflect the
production process. Depending on the complexity of the production, this can
result in a route network. For simple routes, where the operations are executed
one after the other, a route network is not required.
However, complex networks are frequently needed to reflect the production
environment. If this is the case, you can construct routes that contain several
operation branches that can be started independently.
Another network operation is concurrent operations. In this case, prerequisites
are run first, and then several operations run in parallel, ending in a completion
operation. Each operation in a route can have multiple predecessors, but only one
successor. As a consequence, a route may have multiple starting points, but only
one end-point. Therefore, only a subset of all possible networks may be modeled
as routes.
10-9
10-10
Also important for this model, is the relationship between Routes, ReqRoute, and
ProdRoute tables. For example, a regular route includes how the task or activity
is completed, the order and operation priority, and the requirements for the
resources that will perform them. The ReqRoute table is primarily populated
during master planning to record which operations are used for a production
order, and when the planned order is firmed. This data is then combined with the
operation relation to make up the production route in the ProdRoute table. This
makes sure that the route does not change mid-process and still allows planners
and schedulers to be able to update the Route table. The route on a specific
production order can be modified; much like a BOM can be, without affecting
the original route.
Production Orders
The production order contains information about what is to be produced, how
much (quantity), and the planned finish date. The system assigns an order status
to each step in the life cycle of the order. The status shows where the item is in
the production process.
The following sections include an overview of production orders, orders statuses,
the data model, the journal framework, and three production order classes.
10-11
10-12
Ended: Status of the production order after final costs are applied,
the item is complete, and the order is no longer active.
Step 4 Released
In this step, the system releases the production order when the schedule is
realistic. At this point, you can print production order documents such as the job
card and the route card. Now, the status of the production order changes to
Released and indicates that the production can start.
10-13
10-14
The ProdTable is the primary production order table, which contains the header
information about all of the production orders. Each production order contains is
related to at least one InventTransOrigin and InventTrans table record. Each
production order can be connected to a planned production order, a sales order or
a project.
When a production order is created from master planning, the planned production
order is stored in the ReqPO table. The ProdTableProj table contains information
about production orders that belong to projects. Such a production order is
connected to a real production order stored in the ProdTable table and to a project
stored in the ProjTable table.
The ProdBOM table contains a productions bill of materials. This information is
copied from the BOM and BOMTable.
10-15
ProdMulti
You can update production orders one at a time or update multiple orders one
time. You can use the RunBaseMultiParm structure to run different parameter
(parm) tables that use the same structure. The ProdMulti class is the base class
that you can use to update production orders. It is based on the
RunBaseMultiParm class. A user interface (UI) should be implemented for
derived classes.
10-16
}
else
{
}
prodMultiCostEstimation.runOnServer();
prodMultiCostEstimation.refreshCaller(_args);
RunBaseMultiParm::runSpecial(_args);
10-17
All selected records in the form data source are added to the appropriate parm
table. If the update is called from the main menu, there is no data source and no
records are found.
10-18
}
else
{
}
prodMultiCostEstimation.runOnServer();
prodMultiCostEstimation.refreshCaller(_args);
RunBaseMultiParm::runSpecial(_args);
The prompt displays the form where the user can change the settings to update
the order. There is also a Select button on the form that the user can click to
modify the query and select more records. When the form is opened from the
main menu (Production control > Periodic > Production orders), the query is
empty and the user must click this button to select the records for update.
The run() method is then called.
4. View the ProdMultiCostEstimation.run() method:
...
while (curParmCostEstimation)
{
try
{
prodTable =
this.initProdTable(curParmCostEstimation.ProdId);
prodTable.status().runCostEstimation(curParmCostEstimation,
false,prodPurch,this);
}
catch (Exception::Deadlock)
{
retry;
}
...
10-19
next curParmCostEstimation;
All records in the parm table are looped over. The ProdStatusType sub-class is
instantiated by using the status of the prodTable record, then the update is called.
ProdStatusType
Production order updates are controlled by using the ProdStatusType class and
subclasses.
Each stage of the update process must occur. If the current status of an order is
Estimated, and you try to update it to Report as Finished, then it must be
Scheduled, Released, and Started before it can be reported as Finished. The
required status and status sequences are configured in the Production control
parameters form.
Before each update is run, the system checks to determine whether the previous
status is already processed. If the update is not installed, then the system runs that
update. It also handles which updates can occur with a production order. For
example, a production order with the status Finished, cannot be Estimated.
while (prodParmReportFinished)
{
try
{
this.initProdTable(prodParmReportFinished.ProdId).status().
runReportFinished(prodParmReportFinished,false,this);
}
catch (Exception::Deadlock)
{
retry;
}
...
next prodParmReportFinished;
}
}
10-20
ask is set to true only when the method is called to ask whether the update is
allowed, not to run the update.
ProdUpdReportFinished::RunPreviousJob runs the update to the status Started.
3. View ProdUpdReportFinished::RunPreviousJob.
static void runPreviousJob(
ProdParmReportFinished
prodParmReportFinished,
RunbaseRecsMapable
_multi
= null)
{
ProdParmStartUp prodParmStartUp =
ProdUpdStartUp::initParmBufferFromRepFin(prodParmReportFini
shed);
prodParmStartUp.insert();
ProdTable::find(prodParmStartUp.ProdId).status().runStartUp
(
prodParmStartUp,
10-21
_prodPurch,
_multi);
_multi);
return true;
Because the previous status to Started is released, and because this order is
already released, it is not necessary to run the previous job.
As soon as the update to the status Started occurs, it returns to
ProdStatusType.runReportFinished(), then runs the update to Report as Finished.
10-22
The ProdUpd class is an abstract class, and you cannot make an instance out of it.
You can only inherit this class from other production update classes. To update
production order stage, the following classes are used:
ProdUpdBOMCalc
ProdUpdCostEstimation
ProdUpdScheduling
o
o
ProdUpdScheduling_Operation
ProdUpdScheduling_Job
ProdUpdRelease
ProdUpdStartUp
ProdUpdReportFinished
ProdUpdHistoricalCost
ProdUpdStatusDecrease
o
o
o
o
o
ProdUpdStatusDecrease_CostEstimate
ProdUpdStatusDecrease_Finished
ProdUpdStatusDecrease_Release
ProdUpdStatusDecrease_Schedule
ProdUpdStatusDecrease_StartUp
10-23
viewCacheProdRoute;
setprefix(ProdMultiStartUp::description());
setprefix(#PreFixField(ProdParmStartUp,ProdId));
try
{
ttsbegin;
this.setParameters();
if (! this.validate())
{
throw Exception::Error;
}
viewCacheProdRoute = null;
viewCacheProdRoute =
ProdRoute::viewCacheProdId(prodTable.ProdId,true);
this.updateProduction();
this.updateBOMConsumption();
prodTable.status().startUpUpdateRouteJobs(this);
this.updateRouteConsumption();
this.startupReferences();
this.updateJobJournal(ParmJobStatus::Executed);
TransactionLog::create(TransactionLogType::ProdStartUp,
strfmt("@SYS76498",
10-24
ttscommit;
this.printout();
...
10-25
Scheduling
Scheduling is an iterative activity where the system tries to find a set of resources
that can deliver the product on or before the requested date. In the following
sections, you will review the main production scheduling concepts that provide
an overview of scheduling, resources, the resources data model, and jobs.
Scheduling Overview
The scheduling engine is aligned with the new resource model in Microsoft
Dynamics AX 2012. This introduces capabilities and priorities, and replaces
work centers and work center groups by using resources and resource groups.
You can run scheduling after the production order is created and estimated.
Production dates and other information important to the production process are
established at this point. The role of the scheduling system is to plan the actual
production process so that each operation in the production route is assigned a
starting and ending date and time, and that the materials needed for production
are available when the operation starts.
Another important role of the scheduling system is to assign jobs and operations
to a resource or resource groups. This depends on whether job scheduling or
operation scheduling is used. Running scheduling raises the production status to
Scheduled.
Resources Overview
Microsoft Dynamics AX 2012 introduces resources that are assigned to jobs and
operations. Resources can be different types including machines, tools, human
resources, vendors or locations. The scheduling engine aligns with the new
resource model and can schedule resources based on their capabilities. Resources
and capabilities replace work centers and task groups to provide for more
flexibility in setup and maintenance. In Microsoft Dynamics AX 2012, resources
can be allocated to jobs and operations by matching the capabilities of the
resources with the requirements of the operation.
Alternative resources with the same capabilities are considered, unless there are
requirements for a specific resource or resource group. This applies whether you
select to run job scheduling or operations scheduling. The selection process
consists of matching the requirements of the operation with the capabilities of the
resources. Other requirements, such as location, resource working time, and
resource type are also considered when planning the production. Microsoft
Dynamics AX 2012 has changed the following to the Operations Resource
Model.
10-26
Separated the way resources are grouped for managing capacity from
the way resource requirements are specified for activities.
In the following section, you will review resources and recourse capabilities.
Resources
Resources are used throughout the production or project processes. They can be
machines, tools, people, vendors or locations that contribute to the production of
an item. After an operations resource is created, you can assign it to a resource
group and specific productions.
Resource groups have fixed location. You can move resources to another location
by reassigning them to a different resource group. However, a resource can only
be assigned to one resource group at a time. The Effective and Expiration date
fields on the Resource groups tab represent when the resource in question can
be used for production.
With this setup you can share a resource across many sites. When a resource
becomes a member of the resource group that has a different location, it
represents the physical move from one site to another. You can also copy
resources to make the setup of resources easier.
During the scheduling process, the capacity of a resource group is calculated as
the sum of the capacity of its resources. Resources are used in the detailed
planning of capacity requirements and in job scheduling. When job scheduling is
run, the operations in each resource are scheduled into individual tasks or "jobs."
Five types of resources are available.
Tool: Select this type if the resource is considered a tool. If you want
to schedule for tools, machines, or personnel at the same time, select
a primary operations resource that determines the capacity available.
10-27
10-28
Resource Requirements
When defining the requirements for a production route, you can also specify
skills, courses, certifications or title as requirements in addition to capabilities.
This does not require a relation to a worker. These values are set up in the
Human resource module and are not defined in the Capabilities form. When
defining skills, courses, certifications or title as requirements, you must have the
Human resources module enabled. You can define capabilities in the
Capabilities form that resemble or duplicate those from the Human resources
module. However, the Capabilities form does not contain the functionality that
is required to maintain skills, courses, certifications or titles.
Skills: You can use the Skills form to create and manage
competencies that are specified for employees or jobs. An operation
can require a human resource with a specific skill, and the
scheduling engine will find resources with the specific skills. It does
this by searching for the skill information on the worker to which the
resource is linked. This is only applicable for job scheduling, and not
operation scheduling.
Courses: You can create and maintain the courses your employees
have attended. An operation can require a human resource with a
specific course, and the scheduling engine can find resources with
specific courses. It does this by searching for the course information
on the worker to which the resource is linked. This is only applicable
for job scheduling.
Title: The title an employee has can also be a requirement for a job.
An operation can require a human resource with a specific title, and
the scheduling engine can find resources with specific titles. It does
this by searching for the title information on the worker to which the
resource is linked. This is only applicable for job scheduling.
10-29
10-30
Specific resource
Resource type
Capability
Skill
Course
Certificate
Title
When to produce it: Based on, for example, delivery dates for sales
orders.
10-31
When the requirements are not met by the current inventory, a planned
production order can be issued that specifies what is needed and when. Then the
planner knows what is missing and he or she can make decisions about how to
meet these requirements.
NOTE: Master planning can generate several types of planned orders such as
planned transfer, planned purchases, or kanbans, not just planned production
orders.
The following figure shows the steps for the Master planning module that must
be completed to run and generate the planned production orders.
10-32
LEAN Manufacturing
Lean manufacturing is a both a process philosophy and workable process
methodology. It introduces best practice material handling and best in class
manufacturing methods that are now standard across industries. The core
concepts for lean manufacturing provide a base level understanding of the system
functionality within Microsoft Dynamics AX 2012.
In the following section, you will review the Lean production principles, the
overview and rules for Kanban, and production flow processes.
Customer Value: When you identify the value, you specify what
creates value from the customer's perspective.
Flow: Create flow wherever possible in the process. Use one piece of
the flow by linking all the activities and processes into the most
efficient combinations to maximize value-added content while
minimizing waste.
Pull: Make only what is needed by the customer (short term response
to the customers rate of demand).
Kanban Overview
In Microsoft Dynamics AX 2012, the Lean manufacturing module introduces
kanbans as a pull-based just-in-time production system. Kanbans relate to a
sequence of kanban jobs. Each kanban job has a status that indicates its current
stage in the production or transfer process. Each kanban also has a status, the socalled handling unit status that indicates the overall state of a kanban and the
related handling unit.
10-33
Withdrawal kanbans
Manufacturing kanbans
10-34
Process jobs
Transfer jobs
Scheduled Kanbans
Master planning creates scheduled Kanbans automatically for planned Kanban
orders to cover the requirements within the firm horizon of the production
forecast. Scheduled Kanbans can also be manually created.
10-35
Production Flow
Typically, a Lean manufacturing scenario is more than an accumulation of
unrelated Kanban rules or material supply policies. The flow of material and
products throughout work cells and locations for a specific production or supply
scenario is described as a sequence or small network of process or transfer
activities, which is known as a production flow.
Microsoft Dynamics AX 2012 introduces the activity based production flows to
establish a production and cost context for various Kanban scenarios. All Kanban
rules are directly connected to this predefined structure. The activity based model
is used to set up a wider range of scenarios than those supported by earlier
versions of Lean manufacturing in Microsoft Dynamics AX. Additionally, it is
now easier for shop floor workers to use because all scenarios use the same
activity based user interface.
Unique name
Description
A production group.
NOTE: The production group defines the set of accounts that are used for the
financial postings that are related to the production flow. The most important
accounts are the WIP and Offset accounts. These are the basis of the variance
calculation for the production flow.
The setting of the financial dimension for the production flow is optional.
TIP: For more information about lean manufacturing, refer to the following two
whitepapers.
Lean manufacturing - kanban and pull-based manufacturing
(http://go.microsoft.com/fwlink/?LinkId=238243)
Lean Manufacturing Production flows and activities
(http://go.microsoft.com/fwlink/?LinkId=238244)
Additionally, you can refer to the Lean Manufacturing for Microsoft Dynamics
AX 2012 course.
Process Industries
Process Manufacturing for Microsoft Dynamics AX 2012 supports a range of
manufacturing processes. This includes make to order, make to stock, and mixed
mode. Mixed mode is a hybrid environment that enables discrete, lean, and
process requirements to coexist. You can integrate production processes to build
a flexible solution that meets your needs.
Overview
Process industry requirements are reflected in the following Microsoft Dynamics
AX 2012 functionalities.
10-37
Some features can be used with any license of Microsoft Dynamics AX2012,
while other features can be used only with a Process Manufacturing installation.
The two installations for Process Manufacturing include the following.
If your organization wants to use the Process Manufacturing solution, you must
implement one or both of the Process Manufacturing installations.
10-38
Challenge Yourself!
Use the following tables, maps, and forms to create a new field for Victor to
track returnable items at the BOM line level.
BOM table
ProdBOM table
ProdBOM form
BOMConsistOf form
BOMMap
10-39
Step by Step
1. Open the Development Workspace.
2. In the AOT window, expand the Data Dictionary node and then
right-click the Extended Data Types node and select New > Enum.
3. Set the following properties.
a. Name = IsReturnable
b. Label = Is returnable
c. Help text = Item can be returned to the vendor
d. Enum Type = NoYes
4. Save the extended data type. If you are prompted to synchronize the
database, select Yes.
5. Create a project (View > Project or Ctrl+Shift+P ).
6. Right-click the Shared space, New > Project.
7. Name the project.
8. Open the project.
9. Drag the new IsReturnable extended data type to the project.
10. Find the BOM table in the AOT.
11. Drag BOM table to the project.
12. Expand to the Fields node.
13. Find the ProdBOM table in the AOT.
14. Drag the ProdBOM table to the project.
15. Expand the Fields node.
16. Right-click IsReturnable(usr) and select Open New Window.
17. From the new window drag IsReturnable to the BOM fields and the
ProdBOM tables.
18. Close the AOT window with the IsReturn(usr) extended data type.
19. Save the project.
20. In the AOT window, expand the Forms node and locate
BOMConsistOf and ProdBom.
21. Drag the forms to the project.
22. Right-click the project and select Restore.
23. Expand the BOMConsistOf form to Data Sources > BOM > Fields
> IsReturnable, and then right-click and select Open New Window.
24. Expand the BOMConsistOf form to Designs > Design >
[Group:GroupBOM] > [Tab:Tab] > [TabPage:Overview] >
[Grid:GridBOM].
25. Drag IsReturnable to the [Grid:GridBOM].
10-40
10-41
Summary
A bill of material is a complete list of all the components, parts, raw materials,
assemblies and their quantities that are required to make a finished product. The
BOM Version identifies which BOM to use for producing an item under specific
circumstances.
Routes and operations are the path that the item takes from operation to
operation, starting with the beginning of the production process and continuing to
the end. It is a set of sequential operations, or tasks, that are required to produce
an item.
Production orders are used to track information about what is to be produced,
how much (quantity), and the planned finish date. The system assigns an order
status to each step in the life cycle of the order. The status shows where the item
is in the production process. Scheduling assigns resources and attempts to
schedule the operations on possible dates and times so that the requested date can
be met.
Planned production orders are created by master planning when requirements are
not met by current inventory. A planned production order is issued that specifies
what is needed and when. Then the planner knows what is missing and he or she
can make decisions about how to meet these requirements. This interacts with the
journals for each step for both real time information and auditing purposes.
Lean is a both a process philosophy and a workable process methodology. It
introduces best practice material handling and best in class manufacturing
methods that are now a standard across industries. Microsoft Dynamics AX 2012
integrates the concept of Kanbans and their effect on the production process.
You can integrate production processes in Microsoft Dynamics AX 2012 to build
a flexible solution that meets your needs by using process industries
functionality.
10-42
10-43
2.
3.
10-44
Solutions
Test Your Knowledge
1. Which of the following are items that are found on a BOM? (Select all that
apply)
() Components
() Parts
() Assemblies
() Raw materials
2. Which of the following is not a BOM line type?
( ) Phantom
( ) Pegged
( ) Vendor
() Shortest route
3. The applicable resources of an operation in Microsoft Dynamics AX 2012
can be restricted by which new feature?
( ) Operations to perform
() Capabilities
( ) Sequence of operations
( ) Customer value
4. Which of the follow is true about Production Orders? Select all that apply.
() Meeting sales demand when inventory is insufficient
() Creating safety stock based on possible demand
( ) Developing templates for receiving control
() Supply the BOM as sub-assemblies to other items in demand
10-45
10-46
Introduction
Workflow in Microsoft Dynamics AX 2012 uses a combination of Application
Object Tree (AOT) elements created by the developer and additional set up that
is completed by the end-user to control the configuration and process a workflow
will follow.
This course introduces advanced development topics that explain how to
implement line-item workflows, create workflow work item queues, create new
workflow providers, implement currency support in the Condition Editor, and
implement conditions on fields that represent hierarchies in the Condition Editor.
11-1
Line-Item Workflows
Workflows act on business documents. Sometimes patterns exist where there is a
relationship between two tablesone is a header table; for example, Expense
header, and the other is a line-item table. The line-item table contains records that
relate to the header, for example, an expense report has many expense lines.
Line-item workflow in Microsoft Dynamics AX 2012 supports this header and
line pattern. The developer must enable line-item support for each workflow
where a header and line-item relationship exists. Then the business user can
configure a workflow that includes a "Line-item workflow" element. In that
element, the business user can select the workflows that he or she wants to act on
the line items. For example, some transactions might be processed by using a
project approval workflow, others might be processed by using a workflow that
only requires approval by the manager. End-users interact with line-item
workflows in the same manner as other workflowsby taking workflow actions
on the line items.
NOTE: Some tables are enabled for line-item workflows out of the box, such as
purchase requisitions and expense reports.
11-2
11-3
Workflow Providers
Workflow providers in Microsoft Dynamics AX provide application specific data
for a workflow at run time. The application data provided can include the
following:
11-4
Due date: Determines the due date for a task or approval, or the due
date for a step in a task or approval.
Each task or workflow must have a due date provider defined to determine the
last date by which the workflow element can be compeleted. For example, the
maximum number of days to complete a task, or the maximum time permitted to
wait for an approval before automatic denial of the approval.
A provider is also used to select a user or group of users for the task or approval
step. For example, the participant provider could select a manager from a
manager's role to approve an expense report. In Microsoft Dynamics AX 2012
the providers for a workflow element are inferred. There are no special
parameters that must be set on the elements in the AOT to specify the type of
provider. Each workflow element can have many different types of providers
available. However, only one type of provider can be selected when configuring
a workflow element.
The WorkflowHierarchyProvider.getNextNode method is called when an
approval or task is started to retrieve the identity of the user in the hierarchy that
should be assigned a work item.
The WorkflowHierarchyProvider.getNodeDataType method is called when
the approval or task is started to return an object of the type the hierarchy
provider expects as input. Because each hierarchy provider implementation can
have a different input type, the input type is based on the type of hierarchy. For
example, an organizational hierarchy provider might return employee ID,
whereas a product hierarchy provider might return a product ID.
The WorkflowHierarchyProvider.convertToNodeDataType method is called
at run time when an extended data type value must be converted to a data type
that the hierarchy supports as the start node.
11-5
WorkflowDueDateProvider.getCalendarTokens
WorkflowDueDateProvider.resolve
WorkflowDueDateProvider.resolveNonUser
11-6
Participant Provider
You can use a participant provider to return a list of users from any abstraction,
such as a user group. Microsoft Dynamics AX workflow provides the
WorkflowUserGroupParticipantProvider class that returns a list of users
based on a Microsoft Dynamics AX user group.
The WorkflowUserGroupParticipantProvider class implements the
WorkflowParticipantProvider interface that contains the following methods:
WorkflowParticipantProvider.getParticipantTokens
WorkflowParticipantProvider.resolve
Queue Provider
You can use a queue provider to return a list work item queues that are
configured in the Home module. Microsoft Dynamics AX workflow provides the
WorkflowQueueProvider class that returns a list of work item queues.
The WorkflowWorkItemQueueProvider class implements the
WorkflowQueueProvider interface which contains the following methods:
WorkflowParticipantProvider.getQueueTokens
WorkflowParticipantProvider.queueIDToQueueName
WorkflowParticipantProvider.queueNameToQueueID
WorkflowParticipantProvider.resolve
11-7
11-8
5. Right-click in the Code Editor window, click New, and then enter
the following code for the getParticipantTokens method.
public WorkflowParticipantTokenList getParticipantTokens()
{
// Constructs the new user group list.
WorkflowParticipantTokenList userGroups =
WorkflowParticipantTokenList::construct();
;
// ToDo Define your user groups here.
return userGroups;
}
6. Right-click in the Code Editor window, click New, and then enter
the following code for the resolve method.
public WorkflowUserList resolve(WorkflowContext _context,
WorkflowParticipantToken _participantTokenName)
{
// Declare the variables.
UserGroupList userGroupList;
WorkflowUserList userList =
WorkflowUserList::construct();
;
// Verify that the participant token is set or throw
an error.
if (!_participantTokenName)
throw error("@SYS105453");
// ToDo Enter code to add users to the user list.
{
}
userList.add(userGroupList.UserId);
11-9
7. Close the Code Editor window and then click Yes to save the
changes.
Developer Actions
The developer must complete the following high level steps to enable queues for
a document.
1. Enable queues in the workflow document by setting the following
attribute on the workflow document class in the class declaration
WorkflowDocIsQueueEnabledAttribute(true,"<label>")
a. <label> is the label ID that represents the business document
name.
b. The business document name tells the workflow system that any
workflows based on this workflow document can have work
items generated that are assigned to a queue.
2. Next, create a custom WorkflowQueueCreatedEventHandler
class. This is necessary to store additional data that is used when you
view the work items that are assigned to a queue in the user
interface.
a. The custom class must derive from the base class
WorkflowQueueCreatedEventHandler
b. You have to override the mapFields() method
HINT: For an example of how to implement this, refer to the
TrvDocumentQueuedTaskEventHandler class in AOT. The mapFields method is
overridden to set the DocumentID, Type and Company.
3. Set the WorkItemsCreatedEventHandler property on the task
element in AOT with the custom
WorkflowQueueCreatedEventHander class created previously.
This guarantees that it is used at run time.
4. Create custom list page queries to allow for filters based on queue
assignment.
11-10
11-11
11-12
11-13
11-14
For other examples of queries and list pages that you can add to a document,
refer to the Purchase requisition list pages that are located in Procurement and
sourcing > Common > Purchase requisitions.
11-15
The currency code can be obtained for a field on the left side of the
condition that contains an amount.
The end-user can select a currency code for an amount entered on the
right side of the condition.
The left and right side of the condition can be converted into a
common currency so that they can be evaluated.
The most basic approach to implementing currency fields in the Condition Editor
is to set meta-data that will be used by the default currency provider. This metadata is then used by the Condition Editor together with a default currency
provider without any additional development. This is true only when the
currency code field is on the same table as the currency amount field. In all
other cases, coding is required to either extend the default currency provider
implementation or to implement a new currency provider that meets your
application needs.
11-16
11-17
IMPORTANT: A relation must be defined on the field that stores the currency
codes. This relation is used by the system to create a lookup for currency codes
in the Condition Editor. If a relation does not exist, the ellipses button will not
appear in the Condition Editor and the user cannot select the currency code from
a list.
11-18
11-19
11-20
In this example, the first condition is comparing the total expense report amount
to the requesters spending limit. For both fields, the currency code is passed in
automatically based on the record passed into the query. There is no need for the
user to select a currency code.
The second condition in this example is comparing the total expense report
amount to a fixed value of 10,000 United States dollars (USD). The user can
click the ellipsis button (...) to specify the currency for the value that is entered
into the right side of the condition. The currency code is still hidden on the left
side of the condition because it is being calculated by the system in the
parmAccountingCurrencyCode method.
11-21
Developer Actions
To implement a new field that supports hierarchies in the Condition Editor, the
developer must follow these steps.
1. Create a new class that implements the
ExpressionHierarchyProvider base class. This class must
implement the methods that are required to enable hierarchy support
in the Condition Editor
a. getDistance(): Returns the distance from the target node to the
source node in a hierarchy. If a direct path from the source node
to the target node does not exist then a nonzero value must be
returned.
b. getLookup(): Displays a lookup table that represents the
hierarchy from which the user can select a node. The lookup
table is typically the primary key table for this field in the
foreign key table.
11-22
Developer Actions
To implement a new field that supports hierarchies in the Condition Editor, the
developer must follow these steps.
1. Create a new class that implements the
ExpressionHierarchyProvider base class. This class must
implement the methods that are required to enable hierarchy support
in the Condition Editor
a. getDistance(): Returns the distance from the target node to the
source node in a hierarchy. If a direct path from the source node
to the target node does not exist then a nonzero value must be
returned.
b. getLookup(): Displays a lookup table that represents the
hierarchy from which the user can select a node. The lookup
table is typically the primary key table for this field in the
foreign key table.
2. Register the new class on the workflow document class that is used
by decorating the class with the following attribute:
[WorkflowHierarchyProviderAttribute
(classstr(MyHierarchyProviderImplementation), myTableId,
myFieldId)]
11-23
11-24
Challenge Yourself!
By using the information that is provided in the scenario, create a new workflow
type for free text invoice lines called
CustFreeTextInvoiceLineWorkflowTemplate that includes a new approval
element. Make sure that you create a new status field on the lines of the free text
invoice and that you enable work item queues for the free text invoice template.
When you are finished, add the new free text invoice line workflow into the
CustFreeTextInvoiceTemplate as a line-item workflow.
11-25
11-26
11-27
11-28
11-29
11-30
3.
4.
5.
6.
11-31
11-32
11-33
11-34
11-35
11-36
Summary
Workflow in Microsoft Dynamics AX 2012 supports many new advanced
features. The line-item workflow types are used to create a workflow for data that
has a header and line relationship.
Additionally, the workflow provider framework gives developers the flexibility
to assign workflow elements to participants, queues, and users in a hierarchical
structure.
This chapter also reviewed the classes and attributes that can be called and
extended by the developer to present currency and hierarchy type fields in the
Condition Editor.
11-37
11-38
11-39
2.
3.
11-40
Solutions
Test Your Knowledge
1. Put the following steps for developing a new work item queue in order:
Step:
8
11-41
11-42
Describe the key concepts involved when specifying data for your
reports.
Create a new query and then bind the query to a new SQL Server
Reporting Services report together with an auto design.
Explain how to print a report, set the print settings, prevent the
display of print setup, set the query range, and set a report parameter
value in X++.
Describe the components of print management and the steps that are
used to implement each component of print management.
Introduction
SQL Server Reporting Services (SSRS) is the primary reporting platform for
Microsoft Dynamics AX 2012. The default, out-of-the-box reports that are
provided with Microsoft Dynamics AX run on the Reporting Services platform.
They give users better looking reports, more export formats, and a more capable
report designer. The goals for this transition include following:
12-1
Reporting Architecture
The report development pattern in used for SSRS reports Microsoft Dynamics
AX 2012 uses the Model-View-Controller (MVC) design pattern variation. This
pattern allows many client types to call Microsoft Dynamics AX 2012 Reporting
Services reports including: Microsoft Dynamics AX clients, Enterprise Portal,
and Batch Job. This also means that Reporting Services can be replaced by a
different application for rendering reports.
The following figure illustrates the SSRS architecture in Microsoft Dynamics AX
2012.
12-2
Upgrade Consideration
Reports and cubes are not upgraded to Microsoft Dynamics AX 2012. The X++
reporting framework is being deprecated in Microsoft Dynamics AX 2012.
Reports that are based on the X++ reporting framework and existing SQL Server
Reporting Services reports will be copied to the Microsoft Dynamics AX 2012
system. However, they will not be upgraded. It is recommended to use a SQL
Server Reporting Services report that is provided with Microsoft Dynamics AX
2012 as a template and customize it to meet your needs.
Configuration
You can use the Reporting services framework to modify the queries used to
retrieve data for reports. This means that you can now use SQL Reporting
Services capabilities to filter, group, and sort data in reports.
Auto-Reports
With Microsoft Dynamics AX 2012, you can use the Auto-report wizard to
create custom, ad hoc reports that are based on the SQL Server Reporting
Services framework. To start the Auto-report wizard, click the Print icon on a
form.
Batch Support
SQL Server Reporting Services reports in Microsoft Dynamics AX 2012 are now
integrated with the Microsoft Dynamics AX batch framework. You can schedule
a long-running report to print during off-peak hours and schedule a report to print
on a recurring basis.
12-3
12-4
Report Datasets
A report dataset identifies the data from a data source that displays in a report.
When you define a dataset, you must specify the data source and the means used
to retrieve the data, such as a query or data method. The following table describes
the options for retrieving data for a report.
Data source
Dynamics AX
SQL
OLAP
Option
Queries that are defined in the AOT
TSQL query
Stored procedure
Dynamics AX OLAP
If your report uses the Dynamics AX data source and a query that is defined in
the AOT in Microsoft Dynamics AX, you must be especially careful when
updating the query in the AOT. For example, if you remove a field in the query
and the field displays in the report, the report will display an empty column for
the field. Whenever you make updates to a query, consider how those updates
can affect your reports. Updates to a query can also require updates to your
reports.
A report can have multiple datasets. A dataset can be used by one or more data
regions in a report.
12-5
Description
Query
Business Logic
12-6
Description
Report Data
Provider
A controller class runs the report by creating the UI, calling SQL Server
Reporting Services, and preprocessing the parameters for the report.
If any of the following scenarios occur, you must extend the
SrsReportRunController class to create a custom controller for the report.
NOTE: Reports that use a controller class must take care of the parameters
when the report is used on the Enterprise Portal.
12-7
Development Actions
The following demonstration shows how to create a query bound report that
exposes Customer Transaction data.
The steps that are involved include create a Microsoft Dynamics AX query, add
field data to the query, create a new report model in Visual Studio, create a report
dataset, create a report design and apply style templates.
12-8
12-9
12-10
12-11
12-12
12-13
12-14
12-15
12-16
12-17
12-18
12-19
12-20
Challenge Yourself!
Use the information that is provided to create a query bound report that exposes
vendor transaction data. Create the new report in Visual Studio and add sorting
and grouping by vendor account to the report. Then add a report filter for the
account number, and add a dynamic parameter for the vendor account. When you
are finished, save and deploy the report and add a menu item to the Accounts
Payable module to view the report on the menu.
12-21
12-22
12-23
12-24
12.
13.
14.
15.
16.
12-25
7.
8.
9.
10.
11.
12.
13.
12-26
Model-View-Controller
Model-view-controller (MVC) is a pattern used to isolate business logic from the
user interface. By using MVC, the model represents the information (the data) of
the application and the business rules used to manipulate the data, the view
corresponds to elements of the user interface such as text, checkbox items, and so
on, and the controller manages details involving the communication between the
model and view. The controller handles user actions such as keystrokes and
mouse movements and pipes them into the model or view as required.
Model: Responsible for retrieving data and for business logic, this
can included queries, data methods, or other classes that are designed
to retrieve data.
View: Responsible for the User Interface, this can also be thought of
as the design for the report.
12-27
The Creating Basic Reports from a Query topic reviewed a simple example of a
report where all of these elements existed. However, the design and the control of
the report were not modified. Instead the base classes for the SSRS reporting
framework in Microsoft Dynamics AX 2012 rendered the report dialog and
handled the logic that was required to run the report.
The steps used to create a report data provider that will deliver data to a report
follow.
12-28
TIP: Before you begin development for a new report visualize the layout of the
report using by Microsoft Office Excel or draw the report design on a piece of
paper.
12-29
12-30
12-31
12-32
12-33
12-34
12-35
12-36
reportRun;
NOTE: This example runs a simple report that does not have a modified
contract.
TIP: In a more complex example where the report uses a data contract class,
additional code will be required. For an example of how to implement this, refer
to the EPSendDocument class makeDocument() method. This class is designed to
print a different report based on the record that is passed in.
12-37
12-38
12-39
12-40
12-41
12-42
TIP: Other methods are available to hide various objects within the reporting
framework. For example, if you want to hide the report dialog box you can call
the showDialog() method and pass in false to set the value. For a complete list of
methods and their functionality, refer to the developer help on MSDN.
12-43
TIP: To use the code sample provided, create a new SSRS report in Visual
Studio. Next, create a data method with the code sample provided, and then
create a new Data Set. Make sure that you set the Data Source Type property to
Business Logic, and then in the Query property select the RetrieveItemData
method that you created. Then you must design the report. When you are finished
you can preview the report.
Data methods can have parameters. A parameter for a data method can be any
.NET type. When a data method is used in a dataset, a report parameter is
automatically generated for each parameter in the data method. Report
parameters display below the Parameters node in the Model Editor.
The following scenarios are not supported in data methods.
Overloading data methods is not supported. You can have only one
data method of a particular name inside a model. If you overload a
data method, you will receive an error stating that multiple data
methods with the specified name exist, and you will be unable to use
the data method within the report.
12-44
12-45
Print Management
Print management gives users control of print settings for selected Microsoft
Dynamics AX reports. Print settings include the number of copies, the printer
destination, and the multilanguage text that can be included on the report. Some
additional print management features that you can use include the following.
12-46
Your new or existing feature has reports that require specialized print
management.
Defining Metadata
Print management metadata is defined completely in code and originates from
four main classes or concepts: PrintMgmtDocType (documents), PrintMgmtNode
(nodes), PrintMgmtHierarchy (hierarchies), and PrintMgmtReportFormat
(formats).
A document is the document or report to which specific print management
settings apply. Documents are the core of print management because all settings
are defined for documents of a particular type. When users set up this
information, it is used when that document is printed. The documents in the print
management system are defined in the PrintMgmtDocType class and are always
related to specific nodes in print management.
A node is a particular level of defaulting in a hierarchy. For example, in the
Accounts Receivable module print management settings can exist at the Sales
Order Transaction level, the Customer level and the Module level. Each of these
levels is considered a node and each node in print management must derive from
the abstract PrintMgmtNode class. While nodes define the level at which print
management settings can exist, they have no order by themselves which is where
hierarchies help.
12-47
The Accounts Receivable node represents the module level settings and all
documents present in the module apply at this level. The Customer node
represents settings that apply to specific customers and all documents present in
the module apply. At the lowest level the nodes represent transaction level
settings and only certain documents apply to each specific transaction.
Sometimes to integrate with print management, you might have to modify
existing nodes or hierarchies to meet the needs of the documents that you want to
print. You might also be required to create new nodes, hierarchies or documents
to accomplish the same goal. The following sections outline the steps that are
required to accomplish these common integration tasks.
12-48
12-49
12-50
3. Create a new class that derives from the PrintMgmtNode class. Make
sure that you reference the existing PrintMgmtNode derivatives for
examples. The class should be prefixed with 'PrintMgmtNode_' and
should follow the naming pattern of the existing nodes. If the node is
tied to a particular table, the table name should follow the prefix such
as PrintMgmtNode_CustTable, for example.
o
o
o
This method controls the caption that will appear for the
instance of the node in the Print Management window.
Return the appropriate label for Module level settings.
Refer to existing examples in PrintMgmtNode_Purch or
PrintMgmtNode_Sales.
Return strfmt("@SYS108943", _tableBuffer.caption())
for account level settings. Refer to the existing example
in PrintMgmtNode_CustTable or
PrintMgmtNode_VendTable.
Return strfmt("@SYS108944", _tableBuffer.caption())
for transaction level settings. Refer to existing examples
in PrintMgmtNode_SalesTable or
PrintMgmtNode_PurchTable.
Customize as necessary for unique situations.
12-51
This method controls the icon that will appear for the
instance of the node in the Print Management window.
Return the resource ID used to display the icon
representing this node. The resAppl macro contains the
resource ID definitions for icon images. This method
should return one of those resource IDs. If additional
resource IDs are used, they should also be added to the
build method of the ImageListAppl_PrintMgmt class.
Module level nodes should use the same icon that is used
for the module, account level nodes should use
#ImagePrintManagementAccount, and transaction level
nodes should use #ImagePrintManagementTrans.
12-52
7. Add the node to the appropriate hierarchy. See the Create or Modify
Hierarchies section for the steps that are required to perform this
action.
8. Add the node to the PrintMgmt shared project.
12-53
12-54
Copy an existing SSRS report (the .RDL file) with a new name.
Summary
This chapter introduced the features of SSRS and demonstrated how to create a
simple report by using a query and an auto-design. Additionally, the chapter
showed how you can use the report data provider framework to deliver business
logic to a report in more complex business scenarios.
The MVC is a pattern used to separate the data (Model) from the user interface
(View) and the business logic (Controller) is used to communicate between the
Model and the View. You can implement this framework by decorating your
classes together with attributes such as the DataContractAttribute and the
DataMemberAttribute.
You can use the SRSReportRun framework to control how the printing and
output of a report will be handled. You can also use X++ to set parameter values
when running a report.
In addition to the query framework and the report data provider framework, you
can use business logic in Visual Studio to retrieve the data for a report. To use
business logic in a report you must create a data method that includes the
DataMethhod() attribute. A data method can also be used within report
expressions to perform data manipulations or calculations for fields that display
in the report.
Developers can implement print management for selected Microsoft Dynamics
AX reports. This gives users control of print settings. A developer must create or
modify the document, node, and hierarchy for each report that you want to enable
print management for.
12-55
12-56
12-57
2.
3.
12-58
Solutions
Test Your Knowledge
1. Put the following steps in the correct order to create a new SSRS report from
a Microsoft Dynamics AX query:
Step:
6
12-59
Item 3: TSQL
6. Which of the following is not a step in the process for saving and deploying a
report project?
( ) Rebuild the solution
( ) Save the report to the AOT
() Import the report into the AOT
( ) Deploy the report
12-60