Wednesday, November 16, 2011

How to decide the RunOn property value in Dynamics AX?

While working with Client-Server programming, code placement is crucial to decide otherwise it will results in performance hit. Let's have a look at RunOn property of different AOT objects.

Classes
-     The value of RunOn property for a class will be same as the parent class if the parent class has a RunOn property other than Called from i.e. the RunOn property cannot be changed for a class if the parent class has as its value either Client or Server. 
-     If the parent class has Called from as its RunOn property value, it can be changed to Client or Server and if it is not changed it will retain the inherited value i.e. Called from.
-     The Called from value of the RunOn property means the object will live at the tier where the code creating it (by calling the new constructor) is running.

Methods
-     Class static methods and table methods (except for the database methods) can have their default behavior.
-     The execution place for a method can be changed to Server or Client by adding the Client or Server modifier keywords in the method declaration as shown below:
o    server static boolean mymethod(): to make server the execution place.
o    client static boolean mymethod(): to make client the execution place.
o    client server static boolean mymethod(): to make called from the execution place.

GUI Objects and Reports
-     GUI objects always live on Client. GUI objects include the FormRun, FormDataSource, all FormControls, DialogBox, and OperationProgress objects.
-     Reports always live on Called from, which means the object will live at the tier where the code creating it (by calling the new constructor) is running.

Temporary Tables
-     Temporary tables instantiate and live at the tier where data is first inserted and it does not matter where they are declared. Since the placement of temporary tables is very critical for performance, temporary tables should live at the tier where they are used. If a table is utilized in more than one tier then it should live on the tier where the greatest number of inserts and updates are performed.

Queries
-     QueryRun has called from as the default value of the RunOn property. The QueryRun should always be supplied from the same tier from where it was originally run.
-     If you want to create a new QueryRun in place of an old one, it should be created on the same tier where the old QueryRun was executed.

Tuesday, April 5, 2011

Calculate Cost Price & Sales Price of BOM item.


To calculate Cost and Sales Price of BOM item we have two options as explain below.
      1) Use Cost specified in cost field on Item Details card. 
         2)     Use “Active cost” specified using costing version.

Let’s go with 1st approach first.
  • To use Cost price specified on Item Details Card use Costing Version of type “Planned Cost” also specify fallback = Active or particular version.
Let’s have one example.
> Create one item 005, type = BOM, Costing Version = TestCost(Planned Cost Type)
> Create two item to use as bom line for 005,
> Which are 005Line1 & 005Line2, type = item, Costing Version = TestCost(Planned Cost Type).
> Attach this two item to 005 as bom lines, Activate & Approve BOM.
> Now, for item 005 press “Price” button it pops up window, then press “Calculate” button it again pops up another window select Costing Version TestCost, Site, BOM Version. Also select Fallback version = Active.
Press ok button, this calculates Cost Price & Sales Price as you wanted.

Now here is the way to calculate price with 2nd approach.
  • To use Costing Version of type “Standard Cost” first Active price of (components) which are used to make BOM item. Then select the cost version in which you have activated price while calculating price. In this case fallback is not necessary.
Let’s have one example.
> Create one item 006, type = BOM, Costing Version = StdCost(Standard Cost Type)
> Create two item to use as bom line for 006,
   Which are 006Line1 & 006Line2, type = item, Costing Version = StdCost(Standard Cost Type).
> Attach this two item to 006 as bom lines, Activate & Approve BOM.
> Now press “Price” button for 006Line1 & Active cost value for StdCost Version.
> Again press “Price” button for 006Line2 & Active cost value for StdCost Version.

> Finally press “Price” button for 006 it pops up window, on that window press “Calculate” button. It pops up another window select Costing Version StdCost, Site, BOM Version. Also select Fallback version = None.
> Press ok button, this calculates Cost Price & Sales Price as you wanted.