AX 2012 - Using Financial Dimensions when Creating Products
I hope everyone is having a great week so far, and your knee deep into your Dynamics AX projects. I wanted to take a little time this morning, and post a bit about the use of Financial Dimensions when creating products in AX 2012.
I covered the creation of products, using the EcoResProductService, in the following post: Microsoft Dynamics AX 2012 - A Dive into Services, Consuming Document Services
What I did not cover in this post, is around the filling of the DefaultDimension field, from the InventTable object, during the Releasing of a Product to a legal entity, via the InventItemService. Since the time of that posting, I've had a chance to work with this further, and wanted to share, how you would go about, still using these document services, to assign the Default Dimension for a Released Product.
With the understanding we have from the previous post, we need to know understand our starting point for being able to set the Default Dimension value, for a released product. There is a set of classes, that are apart of the AIF class framework within AX 2012, that enable us to build up the default dimension for a specific released products. These are: AifDimensionAttributeValueSet & AifDimensionAttributeValue.
Also as part of this Dimension value set creation process, there is a need to work with the AfStronglyTypedDataContainerList, which is a container for the AifDimensionAttributeValue objects we build up for setting our product dimension values.
So since this is our starting point, we would need to define these, in the header section of whatever method or job is performing the action of releasing creating products. We would then, have something that looked like the following code.:
// DefaultDimension variables:
AifDimensionAttributeValueSet DefaultDimSet;
AifDimensionAttributeValue dimensionAttributeValue;
AfStronglyTypedDataContainerList dimensionAttributeValues;
With this, we know have the variables needed, in which we can use, along with the InventItemService for setting our Default Dimensions. Moving forward then, within this concept, and assuming you've already got the code from the previous post, lets work with these objects and see the process of creating our Default Dimensions.
// Set DefaultDimension data
dimensionAttributeValues = new
AfStronglyTypedDataContainerList(#AifDimensionAttributeValue);
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("Department");
dimensionAttributeValue.parmValue("SomeValue");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("Purpose");
dimensionAttributeValue.parmValue("SomeValue");
dimensionAttributeValue = dimensionAttributeValues.addNew();
dimensionAttributeValue.parmName("CostCenter");
dimensionAttributeValue.parmValue("SomeValue");
invTbl.createDefaultDimension().parmValues(dimensionAttributeValues);
With the above code example, we can see that via the InvTable variable, which represents an InventItem_InventTable object, we can create our DefaultDimensions, as well as fill in the Financial dimension name as well as value. In doing this, we are now able to set default financial dimensions correctly, for products we are releasing to a specific legal entity.
To help with this topic further, Becky Newell, a super star support engineer for Microsoft, gave us an early Christmas Present this past Dec., in which she gives us code example of working with Financial dimensions, for Journal Entries. You can find that post, at the following: Creating General Journals in AX 2012 in X++.
Well thats all I have time for this post, I hope this helps you out, and futher shows the powerfully simple nature of AX 2012, and the ability to work with the infinitely possible financial dimensions that can exists. Till Next time!
Visit Hillstar Business Intelligence (www.HillstarBI.com) in order to truly unlock your data trapped in your Microsoft Dynamics investment. With our value driven business intelligence strategy Hillstar help you transform into a data informed company.
Labels: AX 2012, Code Example, Document Services, Dynamics AX, EcoResProduct, Financial Dimensions, Microsoft, PDM, PIM, Releasing products, Tech Support
0 Comments:
Post a Comment
<< Home