Our team really gets around…servicing Enterprise and Supply Chain clients around the globe.
ERP Cloud Demo-Free 30 Day trial for Microsoft Dynamics AX
- Complete ERP and CRM integrated solutions including full-featured accounting, CRM and E-Commerce
- Industry Solutions for manufacturing, retail, professional services, wholesale and distribution
- Reduced IT costs and complexity while receiving maintenance and upgrades to your system
- Complete ability to customize and create a solution that meets your company’s needs
- Local support and expertise with specific industry knowledge
- Scalable cloud platform for faster growth, guaranteed uptime and 24/7/365 support
Sapphire NOW + ASUG Annual Conference
Join us in Orlando, FL on May 14-16, 2013 for the SAP Sapphire NOW + ASUG Annual Conference
Who should attend?
Senior executives, lines of business and IT decision makers, business managers, and ASUG members from across all process, technology, and industry areas. In addition, influencers, project managers, and implementation and support teams involved in deploying business technology initiatives.
Why should you attend?
- Hear from SAP executives and thought-leaders about the latest business technology trends and innovations
- Learn best practices and approaches from your peers who have integrated the same SAP solutions that will help your business run like never before
- See technology in action and test drive applications in hands-on demo areas
- Attend hundreds of ASUG member-driven education sessions across specific technology, process and industry areas
- New Forums at SAPPHIRE NOW – 12, one day, programs on the show floor that offer must-see content for key industries and lines of business areas.
- Get an in-depth look at future SAP applications that will support your growth strategies, create a competitive advantage and transform your business
- Learn how SAP solutions can deliver a rapid and significant return on investment
- Participate in ASUG’s extensive Influence program, leveraging a collective voice to help shape the future of SAP solutions and services
- Collaborate and network with the entire SAP ecosystem in one location
- Explore the latest SAP-supporting technologies and services from SAP partners and solution providers
- Meet with ASUG membership experts to learn how to maximize your connection to the world’s largest SAP user group
How to implement a subset sum algorithm in Microsoft Dynamics AX
Clients want to ensure that during the development phase of an AX implementation methodologies stay efficient. Whether that means making the right business decision or solving the problem the right way through X++, efficiency is always a key concern. Recently, we ran into a situation at a client where a business flow required that cases of inventory be picked in an efficient manner to be loaded onto a truck; taking into consideration a desired goal and multiple inventory locations, each location with a potential different quantity. This is a common and well documented problem called the subset sum problem. In subset sum, you attempt to reach a certain sum (goal) given a list of values.
The decision was easy: implement a subset sum algorithm into AX that would allow for the inventory to be loaded from different locations, attempting to get as close as possible to the eventual goal (in this case, a sales order). The problem: how do you implement a subset sum algorithm in AX, and especially when in a time crunch?
We first looked into implementing Microsoft Solver Foundation 3.1, and quickly found how powerful the tool was for implementing common computer science problems (such as the traveling salesman problem and the subset sum problem). While powerful, MSF 3.1 ended up being a bit of overkill for what we needed, which was just an efficient implementation of subset sum in X++.
Computational time is a constant concern when developing high-usage functionality, so that needed to be taken into consideration during development. The eventual decision was to design a randomization algorithm that could quickly iterate through all potential inventory locations and try to combine groups of inventory to meet the sales order quantity (the goal, in this case). The base algorithm is below, with comments to explain what is happening throughout the code. This job is very easy to customize and allows for high-volume testing of the algorithm if need-be.
static void subsetsum_randomization(Args _args)
{
boolean testMode = true;
// our goal
int goal = 62;
// <tolerance> – the percentage at which we say a goal needs to be me
// i.e. a tolerance is .1, if a goal is 100 and our sum is at 90, the goal will be “reached”
// introduce stricter tolerance levels to increase precision
// <tcount> – the counter to increase tolerance level
// i.e. at tcount iterations, the tolerance level will decrease by 1%
// this value is set for testing purposes later on as the original container length times ten
real tolerance = 0.00;
int tcount = 0;
int tLimit;
// iteration counter to avoid overflow
counter icount = 0;
// start and end times for algorithm speed
utcDateTime utcStart;
utcDateTime utcEnd;
// instantiate set & length
container lpncon;
int origLen;
// the lists to manipulate
container used, unused;
// for loop iterator)
int i;
// value and index for easy access
int leftVal, rightVal, lefti, righti;
// running sum of the used list
int usedSum = 0;
// initialize randomization for con building
Random Random = new Random();
int coin;
// TEST PURPOSES ONLY
if (!testMode)
{
lpncon = [ 50, 61 , 64, 59, 67 , 81, 45, 63 ];
}
while ( conLen(lpncon) < 100 && testMode)
{
lpncon += [( 15 + Random.nextInt() mod 30)];
}
// set original length & tolerance iterator
origLen = conLen(lpncon);
tlimit = origLen * 10;
// set start time
utcStart = DateTimeUtil::utcNow();
// build used & unused lists
for (i = 0; i < origLen; i++)
{
if (conPeek (lpncon, i) == goal)
{
used = [conPeek(lpncon, i)];
usedSum = conPeek(lpncon, i);
info( “Result found prematurely.”);
utcEnd = DateTimeUtil::utcNow();
info( strFmt(‘Optimization took %1 seconds with a tolerance of %2.’ , DateTimeUtil::getDifference(utcEnd, utcStart), tolerance));
info( strFmt(‘Goal: %1 | Optimization: %2 | Result set: %3′ , goal, usedSum, con2Str(used)));
return;
}
// get index & val of next int in orig list
lefti = 1 + (Random.nextInt() mod conLen(lpncon));
leftVal = conPeek(lpncon, lefti);
// reset coin
coin = ( 1 + Random.nextInt() mod 100);
// determine which list to add to
if ((coin > 50 && usedSum < goal) || conLen(used) == 0 )
{
// add to used list
used += [leftVal];
// update sum
usedSum += leftVal;
}
// otherwise, add to unused
else
{
unused += [leftVal];
}
// delete from orig list
lpncon = conDel(lpncon, lefti, 1);
}
// now we have 2 lists, one that’s kind of close, one that’s extra numbers. try to optimize within tolerance acceptance
while ((usedSum < (goal – (goal * tolerance))) || (usedSum > (goal + (goal * tolerance))) && icount < 100000)
{
// tolerance handler
if (tcount == tLimit)
{
tolerance += 0.01;
tcount = 0;
}
// if sum is too big
if (usedSum > (goal + (goal * tolerance)))
{
lefti = 1 + Random.nextInt() mod conLen(used);
leftVal = conPeek(used, lefti);
used = conDel(used, lefti, 1);
usedSum -= leftVal;
unused += [leftVal];
}
// if sum is too small
else if (usedSum < (goal – (goal * tolerance)))
{
righti = 1 + Random.nextInt() mod conLen(unused);
rightVal = conPeek(unused, righti);
used += [rightVal];
usedSum += rightVal;
unused = conDel(unused, righti, 1);
}
icount++;
tcount++;
}
utcEnd = DateTimeUtil::utcNow();
info( strFmt(‘Optimization took %1 seconds with a tolerance of %2.’ , DateTimeUtil::getDifference(utcEnd, utcStart), tolerance));
info( strFmt(‘Goal: %1 | Optimization: %2 | Result set: %3′ , goal, usedSum, con2Str(used)));
}
Essentially, the algorithm randomly builds up two lists to begin with: one that imprecisely attempts to reach our goal (but not going over), and the other is the remainder inventory quantities. Then, the left hand list (our attempted goal) has elements randomly removed and ones from the right inserted. If we haven’t reached the goal with tolerance in mind, we randomly remove a left element and insert it into the right container. In a speedy manner, a list is built and the result printed out in an infolog. That result contains our goal, our closest match to the goal, the list of quantities required to reach our goal, the eventual allowed tolerance, and the computational time required.
The randomization algorithm may seem inefficient because we are randomly grabbing elements from a container to try to reach our goal. It’s actually an extremely efficient solution computationally, as removing and reinserting values into containers is not taxing on a system at all. This algorithm can run over thousands of iterations before reaching 1 second in operation time, so it’s a great solution for clients worried about efficiency and keeping AX fast. In the end, this implementation of subset sum did exactly what we needed it to in just a few lines of code and using the basic container manipulation that X++ provides us.
Introduction to the Data Migration Framework in Microsoft Dynamics
Intro to the Data Migration Framework (DMF)
For any organization embarking into a new MS Dynamics AX 2012(AX 2012) implementation loading legacy data from difference sources into AX2012 is a critical component to have a good start and a successful implementation. Microsoft introduced the new Data Migration Framework (DMF) as an extension of AX 2012 to address the challenge of loading data to AX 2012. We consider that the DMF tool represents a great step forward for data upload and with great potential that can be used to complete data migration for the most common data entities needed for an implementation as well as a framework that can be customized to load other required entities.
DMF Process Overview
The DMF process can be summarized in the following diagram and includes preparing source data, defining the type and order of AX entities to load, mapping the source file to the staging table, transferring from the source file to the staging table and finally transferring the data to the final destination in AX.
DMF Process Overview
Prepare Source Data
During this step, source data files are created and prepared to be uploaded to the AX application. A typical source file will have a header row with field names identifying each data column. The number of fields for each file will depend on the requirements for data upload. Thus it is important to note that some of these field names are required for each entity. The DMF version only supports flat files. Future versions of the DMF tool will support data from ODBC and AX destinations.
Define type of AX entity to be used
During this step we define the entity or entities that will be loaded to AX. These DMF entities are predefined relationships that come in the application and include common AX entities such as customers, vendors, products, etc. and available AX fields.
Fields in the Source file are mapped from the source file to the staging table
During the mapping stage, the DMF tool will allow you to map each field from the source file to an AX field in the in the staging table for the corresponding DMF entity. The DMF tool uses the field name to map them against the available fields in the AX Staging table. Users have the ability to review and manually map these fields.
Transferring Data to the Staging Table
Once fields from the source file have been mapped to AX fields in the staging table data should be ready to be transferred to the staging table. This staging table acts as a temporary area and intermediate location before data is transferred to the final AX destination. While the data resides on the staging table, the DMF can apply some basic validation for referential data integrity.
Data transferred from the Staging tables to the final AX Target destination.
Once data has been reviewed and validated in the stating table, the data is then moved to the target AX entity and AX records are created. If data is reloaded the DMF tool will try to update the AX fields.
DMF Components
Accessing the DMF tool.
After installation, the DMF tool can be accessed from the AX client and shows as a module in the AX application. You will see a common, setup and periodic areas as part of the DMF module.
Data Migration Framework in AX 2012
Set Up – Target Entities
There is some setup that needs to be configured prior to use the DMF tool….
To continue reading, download this full document.


