39,59 €
Microsoft Dynamics AX is a comprehensive Enterprise Resource Planning (ERP) solution for mid-size and large organizations. Dynamics AX implementations are used worldwide by thousands of customers. With the new version - Dynamics AX 2012 - the system is due to expand even more rapidly.
Every new implementation requires some level of customization, and all organizations want this to be done to the highest standards using proven approaches.
Written by one of the leading experts in Microsoft Dynamics AX, 'Microsoft Dynamics AX 2012 Development Cookbook' is packed with over 80 task-based and immediately reusable recipes that will help you manage your company's or customer's ERP information and operations efficiently, and solve your business process problems in an effective and quick way. This book focuses on commonly used custom modifications in major Dynamics AX modules. The recipes in this book cover various areas of Dynamics AX to help developers not only learn about programming, but also about the functional side of Dynamics AX. The practical recipes will also allow you to look at the development from the perspective of business processes. You will learn to enhance your user interface using various Dynamics AX UI elements and managing your data and functions will become easier.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 323
Veröffentlichungsjahr: 2012
Copyright © 2012 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: December 2009
Second edition: May 2012
Production Reference: 1270412
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84968-464-4
www.packtpub.com
Cover Image by David Gutierrez (<[email protected]>)
Author
Mindaugas Pocius
Reviewers
Angela McClelland
Yev Taranovs
Acquisition Editor
Kerry George
Lead Technical Editor
Meeta Rajani
Azharuddin Sheikh
Technical Editors
Merin Jose
Lubna Shaikh
Mehreen Shaikh
Copy Editor
Brandt D'Mello
Project Coordinators
Alka Nayak
Proofreader
Kelly Hutchinson
Indexer
Tejal Daruwale
Rekha Nair
Hemangini Bari
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
Mindaugas Pocius is currently a freelance Dynamics AX technical and functional consultant and trainer at DynamicsLab Limited (www.dynamicslab.com). The company specializes in providing development, consulting, and training services for Microsoft Dynamics AX resellers and customers.
Mindaugas started his IT consulting career back in 2001 while still in his Information Technology Master Studies at a Lithuanian university. Since then he has become a recognized Microsoft Certified Professional for AX in all major areas: Development, Configuration and Installation, Financials, Projects, and Trade and Logistics. He is also a Certified Microsoft Trainer for Dynamics AX and has delivered numerous Dynamics AX training courses across Europe.
From 2001 to 2012, Mindaugas has participated in over 20 Dynamics AX implementations. He has had a wide range of development, consulting, and leading roles, while always maintaining a significant role as a business application developer.
In December 2009, Mindaugas released his first book, "Microsoft Dynamics AX 2009 Development Cookbook", Packt Publishing, which is the predecessor of this book.
First of all, I would like to thank my wife Rasa and my two boys Dominykas and Augustas for their support and understanding during my long hours spent on this book. I also want to apologize for the time I have stolen from them to make this book real.
Secondly, I wish to thank the reviewers—Angela and Yev—my colleagues, very experienced Dynamics AX developers, and good friends.
And lastly, special thanks should be given to the Packt Publishing team who made this book possible.
Angela McClelland is a Software Developer and Technical Consultant for Dynamics AX (AX) currently working as a freelance consultant in the United Kingdom.
Angela began working with AX in 2001, while completing a Computer Science degree at The University of Waikato in New Zealand. After a successful implementation of version 2.5, and a later upgrade to 3, the spouse and bags were packed up and moved over to England to seek out bigger project challenges, and for a taste of world travel.
Since this move, Angela has worked on many AX implementations, specializing in business solutions design, X++ programming, reporting, and business intelligence. She is a Microsoft Certified Professional for AX: Development, Installation and Configuration, as well as key modules: Finance, Projects, Production, and Trade and Logistics. She is also a Microsoft Certified Trainer for AX.
A big thanks to Mindaugas for his efforts in writing this book, and for inviting me to be one of the reviewers. I have learned a lot, and already have plans to make use of some of these handy recipes.
Yev Taranovs is an experienced Dynamics AX consultant. Yev has been working with AX since 2002 and has a wide angle of expertise, both technical and functional. Apart from Dynamics AX, Yev is also working with other Microsoft technologies including Microsoft CRM, SharePoint, Reporting Services, Analysis Services, and Visual Studio.
Yev's home town is Riga, Latvia. He started his Dynamics career there and moved to the United Kingdom in 2005. Yev is currently working for Hitachi Solutions.
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.
As a Dynamics AX developer, your responsibility is to deliver all kinds of application customizations, whether it is a small adjustment or a bespoke module. Dynamics AX is a highly customizable system and requires a significant amount of knowledge and experience to deliver quality solutions. One goal can be achieved in multiple ways and there is always the question of which way is the best.
This book takes you through numerous recipes to help you with daily development tasks. Each recipe contains detailed step-by-step instructions along with application screenshots and in-depth explanations. The recipes cover multiple Dynamics AX modules, so at the same time the book provides an overview of the functional aspects of the system for developers.
Chapter 1, Processing Data, focuses on data manipulation. It explains how to build data queries, how to check and modify existing data, how to read and write external files, and how to use date effectiveness.
Chapter 2, Working with Forms, covers various aspects of building forms in Dynamics AX. In this chapter, dialogs and their events are explained. Also, various useful features such as splitters, tree controls, checklists, and others are explained.
Chapter 3, Working with Data in Forms, basically supplements the previous chapter and explains data organization in forms. Examples in this chapter include instructions on how to build form data filters, process multiple records, and work with images and colors.
Chapter 4, Building Lookups, covers all kinds of lookups in the system. The chapter starts with a simple automatically-generated lookup, continues with more advanced ones, and finishes with standard Windows lookups such as the file selection dialog and color picker.
Chapter 5, Processing Business Tasks, explains the usage of the Dynamics AX business logic API. In this chapter, we cover topics on how to process journals, purchase orders, and sales orders. Other features such as modifying transaction text and creating electronic payment formats are included too.
Chapter 6, Integration with Microsoft Office, shows how Word, Excel, Outlook, and Microsoft Project applications could be integrated with Dynamics AX.
Chapter 7, Using Services, explains how to use services in Dynamics AX. The chapter covers standard query, metadata, and document system services. It also demonstrates how to create custom services and how to consume external services.
Chapter 8, Improving Development Efficiency, presents a few ideas about how to make daily development tasks easier. This chapter demonstrates how to build code templates, modify the tools and the right-click context menus, use search in development projects, and how to customize the personalization form.
Chapter 9, Improving Dynamics AX Performance, discusses how system performance could be improved by following several simple rules. This chapter explains how to calculate code execution time, how to write efficient SQL statements, how to properly cache display methods, and how to use Dynamics AX Trace Parser and SQL Server Database Engine Tuning Advisor.
All coding examples were done using a virtual Microsoft Dynamics AX 2012 Image from the Microsoft Learning Download Center. The following list of software from the virtual image was used in this book:
Although all recipes were tested on the mentioned software, they might work on older or newer software versions without any implications or with minor code adjustments.
This book is for Dynamics AX developers primarily focused on delivering time proven application modifications. Although new X++ developers could use this book alongside their beginner guides, this book is more focused on people who are willing to raise their programming skills above beginner level and at the same time learn functional aspects of Dynamics AX. So, some Dynamics AX coding experience is expected.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title through the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
In this chapter, we will cover the following topics:
This chapter focuses on data manipulation exercises. Here, we will discuss how to work with query objects from X++ code. We will also discuss how to reuse macros in X++ SQL statements and how to send SQL statements directly to the database. This chapter will explain how to rename primary keys, how to merge and copy records, how to add document handling notes to selected records, and how to create and read XML and comma-separated files. The chapter ends with a recipe about the date effectiveness feature.
Number sequences in Dynamics AX are used to generate specifically formatted numbers for record identification. It could be anything from voucher numbers or transaction identification numbers to customer or vendor accounts.
When developing custom functionality, very often one of the tasks is to add a new number sequence to the system to support newly created tables. Dynamics AX contains a list of NumberSeqApplicationModule derivative classes, which holds the number sequence setup data for the specific module.
These classes are read by the number sequence wizard, which detects existing number sequences and proposes to create the missing ones or newly added ones. The wizard is normally run as part of the application initialization. It can also be rerun at any time later when expanding the Dynamics AX functionality used, where a setup of additional number sequences is required. The wizard also has to be rerun if new custom number sequences are added to the system.
In this recipe, we will add a new number sequence to the system. In a standard application, the customer group number is not driven by any number sequence, so we will enhance this by creating it.
Carry out the following steps in order to complete this recipe:
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
We start the recipe by adding a number sequence initialization code into the NumberSeqModuleCustomer class. As we can understand from its name, it holds the initialization of all number sequences that belong to the Accounts receivable module.
The code in the loadModule() method defines the default number sequence settings to be used in the wizard, such as data type, description, highest possible number, and so on. Additional options, such as starting sequence number, number format, and others could also be added here. All mentioned options could be changed while running the wizard. The addParameterType() method is used to define number sequence scope. In the example we created a separate sequence for each Dynamics AX company.
Before we start the wizard, we need to initialize number sequence references. This is normally done as a part of the Dynamics AX initialization checklist, but in this example we have to execute it manually by calling the loadAll() method of the NumberSeqApplicationModule class.
Next, we will run the wizard. We will skip the welcome page and in the second step of the wizard, the Details button can be used to display more options. The options can also be changed later in the Number sequences form before or even after the number sequence is actually used. The last page shows an overview of what will be created. Once completed, the wizard creates new records in the Number sequences form for each company.
The newly created number sequence reference appears in the Segment configuration form. Here we can see that the Data area checkbox is checked, meaning that we will have separate number lists for each company. The number sequence setup can normally be located in the module parameter forms.
See Chapter 3, Working with Data in Forms:
