Search This Blog

Wednesday 23 January 2013

Creating Purchase Order and Invoice In Microsft Dynamics AX 2012

In the previous post we have created the product and than released that product.Now in this post we will create the purchase order of that Product and than we will create the Inoice of that product.

Below are the step for Creating Purchase Order and Invoice.

Step 1:

Just go to the Account Payable ->Purchase Orders -> All Purchase Orders

A new window will come as you can see in the below image.Then press the New Purchase Order from the action pane.














When you click the Purchase Order button the new window will come as you can see in the image below where you have to select the vendor account and than press ok.
















After pressing the ok button A new form will appear where you have to select the product its quantity and price etc as you can see in the image below.
















when you select the item from the above screen than an exception will create as you can see in the below image.

























This issue is because we have not selected the Dimension Group while creating the product.
Now go to the  Product information management -> Common -> Released products

A new form will open as you can see in the below image.












Now select the product and than click the edit button and than select the storage dimension group,tracking dimension group and the item model group and item group as you can see in the below image.










Now after selecting these dimensions close the form and than again go to the purchase order form and than select the product as you can see in the below image.

Note: Item group option is not shown in the above image as we also have to select it.This option is in the manage cost fast tab of the above form.








Now  go to the purchase tab and press the confirm button as you can see in the above image to confirm the purchase order.It will take some time to confirm the purchase order.

Now in the next step we will create the invoice against the purchase order  click the invoice tab on the same form and than click the invoice button from the action pane as you can see in the below image.








When you click the invoice button a new form will open where you have to give the invoice number and than invoice date and and than click the post button from the action pane .A wizard will open than again you have to click the post button from the action pane.As you can see  in the image below.

















 While Posting the invoice this below issue may accur i.e




















The above issue is because of we have not selected the warehouse while creating the purchase order.

Again go to the warehouse form and than select the warehouse field as you can see in the below image.








Now again generate invoice of that purchase order and than post the warning will no more generaete and invoice will successfully posted.

Now our Invoicing is completed.Now I will show this product i.e 14th street pizza in our in hand inventory.

just go to the Inventory and warehouse management -> Inquiry -> On hand inventory

A new form will open where you can see the inhand inventory








This was all from my side.Thanks for visiting my blog :) :)

Thanks

Muhammad Zahid.

Wednesday 16 January 2013

Creating New Product and than releasing that product in Microsoft Dynamics AX 2012

In this Post I will show you the demo on how can we create new Product in Microsoft Dynamics AX 2012 and than Create Different Variations against that product (What Variations are I will discuss latter).and that I release that Product and than I will create Purchase Order against that product and than confirm that purchase order and than Create Invoice against that purchase order and than I will show that product in on hand inventory.

Below are the steps we need to perform that  I have discussed above:

Step 1:

First of all we have to create the new product.

Just go to the Product Information Management -> Common -> Products -> All Products and Product Masters.

A new form will  open containing all the existing products and than Click the new product button in the Action Pane as you can see on the below image.












When you click the button.A new form will open for product Creation as you can see in the below image.





















Now as you can see in the second field of the above image i.e the product subtype.There are to types of product subtypes One is Product that I have selected in the above image and the other one is product master.

The main difference between product and product master is that the product has not dimension for example there is a product like a cup of glass.This glass is of only single type like it does not have any diffrent types of colour or different types sizes so in such a case when we are creating a product in which there is not more than one properties of the product are available than we select product subtype = Product and in such cases in which we are having diffrent types of the same product than we select the product subtype = Product Master.

Now when we select the product subtype = Product Master than there are more fields become visible as you can see in the below image.


     

















The field product dimension group as you can see in the above image is the dimensions of the product like if I am creating a table than the table may be of different colours and of different sizes so  these colours and  sizes are the dimensions of the table we can make our own dimensions as well.Just right click the dimension group field and than click view details as I have shown in above image.Now the new form will open as you can see in the below image where you can create your own dimensions.


















In the above form you can create your own dimension also.As I am using the PG_4 this means that my product have different dimension,size,colour.

Now after selection of product dimention group in the product creation form.Press the ok button your product will be created successfully.

Now click the product dimension button as you can see in the below image.



















A new form will open where you have to set the dimensions.You can see the example in the image below.














Now close that form and than click Product Variants as you can see in the below image.



















A new form will open where you have to select the variant suggestions.This will make different types of the product based on the product dimension that you have made earlier.You can see below the image of the form.


















Now click on the variant suggestions button.A new form will open as you can see in the below image.





















Now select all these variations and then click create.

Now Variations will be created and than appeared on your product variant form.Now click on the Release Product Button in the Action Pane.

As you can see in the below image also.


















A new Form will open as you can see in the below image.Click the select companies button and than select the company and than press the ok button.


























After you press the ok button a new window will come as you can see on the image below than again press the ok button.It will take some time to release that product.
















Now your product is released.You can also check it just go to the
Product information management -> Common -> Released products.

This was all for creating new product and Releasing that product in Microsoft Dynamics AX.

In the next post i will show you how to create purchase order of that product and than Create Invoice of that product and than check that product in our inhand inventory.

Thanks

Muhammad Zahid. 

Thursday 10 January 2013

How to increase the Budget of particular dimension line in Microsoft Dynamics AX 2012

Some times  the error message shown that the budget assined against this dimension is exceeded this from the allocated.

To remove this issue we have to increase the budget against the dimension line.

just go to the budgeting ->Common -> Budget Register Entries ->All Budget Register Entries.

And than select the register entry for which you want to increase the budget and than click the Edit Button.

As you can see in the below image.





















Now when you click the edit button a new form will open as you can see in the below iamge.
In that form you can see the budget amount that I have already highlighted below.You have to just increase that amount and than close that form.
















After closing that form your warning will no more come.Until your expense exceeded that updated amount.

Thanks

Muhammad Zahid.

Thursday 3 January 2013

AIF Framework In Dynamics AX 2012 Part 2

In the Last Session i,e in the Part 1 I have guide you on how to configure the AIF Service.Now in this session I will guide you on how to Consume the AIF service.

Below are some steps to consume the AIF service:

Step 1:

 First of all I will create the Console Application in dot net c#.And than add the refrence of our AIF service that we have created in the part 1.

After creating your project just go to the solution explorer and than right click service refrences and than click add service refrence as you can see in the below image.









Now when you click the add service refrence a new wizard will open on which you have to past the WSDL URL that we have got during the making of the inbound port.

You can see the screen shot of that port in the below image.














 
 
 
 


Now press the ok button.IT will make the refrence of the service.
 
Step 2:
 
 Now in the next step i will show you the code snippet.

First of all we have to add the name spaces i.e

using project.servicename;

in my case it is:

using zahidemp.zahidempServiceRefrence1;

using System.Diagnostics;

Now i have to define the company name in which i am going to perform the insert update delete operation.

Callcontext context = new CallContext { Company = "dat"};

EntityKey[] keys = null;

In will tell you inside the code that why i have use that EntityKey.

Now I am going to show you the code snippet for the adding the data in to the ax table.

Axdgetemp1 empinfo = new Axdgetemp1();


/**Creating the Data ***/
 
Console.WriteLine("Inserting the record");

List<AxdEntity_employee_1> emplist=new List<AxdEntity_employee_1>();

AxdEntity_employee_1 zahid=new AxdEntity_employee_1();

zahid.EmpNo=1;

zahid.EmpNoSpecified =
true;

zahid.Dob="28-5-1989";

zahid.Empname = "Muhammad Zahid";

AxdEntity_employee_1 asim=new AxdEntity_employee_1();

asim.EmpNo = 2;

asim.EmpNoSpecified =
true;

asim.Empname ="Muhammad Asim";

asim.Dob="19-5-1955";

emplist.Add(zahid);

emplist.Add(asim);

               

empinfo.employee_1 = emplist.ToArray();


keys = client.create(context,empinfo);

Console.WriteLine("Records inserted successfully");
Console.ReadKey();


What I did in the above code is.I have just made the object of my query i,e empinfo and than
 and than made the list in which i will add the employee names and than make the object of one employee i.e zahid and the object of another employee i,e Asim and than i have assign the values in these objects and than added them into the list and than added that list to the object of Query and than we have call the create method of our proxy class that inserted that data.

Now when the data is inserted successfully it will return the Recid of the record which we are going to save it into the keys object that i have created earlier in the code which I told that I will inform you inside the code.

Now the data is inserted successfuly I am going to show you the screen shot of the record inside the table that i have inserted.


 Step 3:

Now I will show you the demo about how can we comsume the service in update operation.

below is the code snippet for the update operation.

Console.WriteLine("Updating the record"); 
List<CriteriaElement> criterialist = new List<CriteriaElement>();

CriteriaElement criteria = new CriteriaElement();

criteria.DataSourceName = "employee_1"; 
criteria.FieldName = "EmpNo"; 
criteria.Operator = Operator.Equal; 
criteria.Value1 = "1"; 
criterialist.Add(criteria);QueryCriteria querycriteria = new QueryCriteria();

querycriteria.CriteriaElement = criterialist.ToArray();

keys = client.findKeys(context,querycriteria);

empinfo = client.read(context, keys);

zahid = empinfo.employee_1[0];

zahid.Empname = "Zahid";
 

List<AxdEntity_empdepartment_1> departmentlist = new List<AxdEntity_empdepartment_1>();


AxdEntity_empdepartment_1 empdepartment =new AxdEntity_empdepartment_1();

empdepartment.Empdepartment = "Dynamics Core";
empdepartment.Experience = 1;

departmentlist.Add(empdepartment);

zahid.empdepartment_1 = departmentlist.ToArray();

client.update(context, keys, empinfo)
Console.WriteLine("Data Updated successfully");

Console.ReadKey();

In the above code i have just made the criteria on bahalf of which i am going to get the record and than updating that record and than there is another table empdepartment related to the table emp.I am also inserting the record in that table.

Note:There is the relation between emp table and emp department table.

Step 4:

Now I will show you the demo on how can we consume the service in delete operation.

//for delete

criterialist =new List<CriteriaElement>();

criteria =new CriteriaElement();
criteria.DataSourceName = "employee_1";

criteria.FieldName = "EmpNo";

criteria.Operator =Operator.Equal;
criteria.Value1 = "1";

criterialist.Add(criteria);

querycriteria =
new QueryCriteria();

querycriteria.CriteriaElement = criterialist.ToArray();

keys = client.findKeys(context, querycriteria);
Debug.Assert(keys.Length == 1);

client.delete(context, keys);

Now I will show you the demo on how can we consume the service in delete operations.In the above code I have just created the criteris as I did earlier in the update operation and than deleted the record based on that criteria.

Now that was all in the AIF Framework part 2.I have shown all the examples of Insert,Update and Delete Operations through AIF Service.

There is the link below if you want  to go the AIF Framework Part 1.

AIF Framework Part 1

Thanks

Muhammad Zahid.


Thursday 20 December 2012

AIF Framework in Microsoft Dynamics AX 2012 Part 1

Following the features of Application Integration Frameworl in Microsoft Dynamics AX 2012.

. Enables companies to integrate and communicate with external business processes and partners.
 
. Exchange of data through formatted XML
 
. Formatted XML is referred to as a document
 
. Service can be hosted on
 
    . AOS
 
    . IIS
 

AIF Service Types:

 
There are following three types of  Services:
 

1. Document Services:

 
Query-based services that can be used to exchange data with external systems by sending and receiving XML documents
 

2. Custom Services:

 
Can be used by developers to expose any X++ logic such as X++ classes and their members, through a service interface.
 
 Example of Custom Services is Business Operation Framework.
 

3. System Services:

 
Provided by Microsoft Dynamics AX .System services include the query service,the metadata service, and the user session service.System services are not customizable ,and they are not mapped to any query or X++ code. 
 
 In this session i will explain only Document Services.
 

Document Services:

. The XML Document Framework contains these types of classes:
 
     . Axd<Document> classes (also known as an Axd class)
 
          . containg the business logic for related entities.
 
. Ax<Table> classes
 
    . abstraction of a table and encapsulate the business logic associated with creation and modification of records in the database table.
 

AXD Document Classes:

 
These are the main methods called when data is created or updated.
1.prepareForSaveExtended.
 
  .Called when records are created.
 
2.prepareForUpdateExtended.
 
 .Called when records are updated.

Docuement Service Operations:

.create
This item creates a record for a new item in the database.
 
.delete
 
This operation deletes a record in the database.
 
.find
 
This opearation searches for the specified database record.
 
.findkeys
 
This operation retrieves a list of entity keys that correspond to the specified search criteria
 
.read
 
This operation retrieves the specified record from the database.
 
.Update
 
This operation updates the record in the databaseOnly the fields that are contained in the message are updated.Values for all other database fields remain unchanged.
 

Implementation:

Now I will show you the implementation of the Application Integration Framework.
 
Note:In this session I am showing only the example of the Document Service of AIF.
 
Step 1:
 
First of all i have created the Project in which i have create two tables and then make relations between them.In the first table I  have created the employee table which contains the fields i.e emp date of birth,emp name,emp number and than I have created the employee department table in which i have created the fields employee department and employee experience.Employee is the parent table and employee department is the child table.Than made the Query to fetch the data from these tables.Note that i have created the outer join in the query to fetch all the records and than set the property update =  true because we will also update the record in this example.
 
you can see tables of my project in the below image:
 
 
 
 
 
 



















And in the below image you can see the Query that I have created you can also see its properties.

























Step 2:

Now we will go and create our document service .

just go to the tools->application integration framework->create document service

as you can see in the below image:
















 

 A new wizard will open.Now click the next button

A new screen will come and than select your query that you have created in early step.

You can see the below image.

 
Now click the next button.A new wizard will come here you can see the axd classes names that are generated and then select operations that you want to perform through this service. and then click on the checkboxes under axbc generation.These are the proxy classes need by the Application Integration Framework.

You can see the screen in the image below:





















Now click the next button. A new wizard will open and than click the generate button.This will create the new project which contains all the proxy classes that will be use by the service consumer.As you can see in the image below:

























Now we need to register that service as valid AX service.Just right click the service file that I have highlighted in the above project and than go to adds-in and than click the register service.It will take some time to register.

Now our service is ready but not yes accessible from the outside world we need to create the inbound ports.

just go to the System Administration -> Inbound ports.

A new screen will open as you can see in the below image:
















New click on the new button as you can see in the above image to create new inbound port.
And than enter the name of the port as i have highlighted in the above image and than check the
check box include exceptions in fault.Checking this checkbox is not necessary but its for development point of view that if during the insertion of data if some exceptions occur than we can easily see that.

Now click the Service operations button as you can see in the above image.After clicking this button a new wizard will open as you can see in the below image.

 
 

Now select the service operations that we have created in the project.These service operations will be consumed by this port.

After selecting the service operations close this wizard and then click the activate button as you can see the second last image in the above.

Now your service will be activate and is able to consume by the consumer code.After the activation of the service you will get the WSDL URI that will be use in the consumer code to refrence this service. As you can see the image below the generated WSDL URI.
















Now  the process of how to consume this service I will show this in the next part 2.
I hope this session will help you on how to configure AIF service.

Thanks

Muhammad Zahid.

 
 

Thursday 6 December 2012

Unit of Work Framework In Microsoft Dynamics AX 2012

Unit of Work Framework is use to commit number of records in a single Transaction.The main reason for introducing unit of work is that it is impossible to insert the lines table record before its header table  because there is a relation between the header table and the lines table.The Recid of the header table is comes as a foreign key in the child table.

Lets took an example as you can see in the microsoft dynamics ax there are two tables i.e custtransopen and custtransopenline.These two tables are related with each other CustTrabsOpen is the parent table and custtransopenline is the child table.

As you can see in the below image about  these two tables and there relations.


There is a common field on both the tables i.e amountcur.

In the parent table i.e in the custtransopen table this amountcur contains the total of the custtransopenlines amountcur.
Now we cant insert the records in the custtransopenline table because it needs the recid of the parent table i.e custtransopen and similarly we cant insert thet record first in the parent table i.e custtransopen because it needs the total amountcur from the custtransopenline.

To resolve this issue Unit of Work Franework is introduced.It allows to perform create, update and delete operations without worrying about the order of those and without a need to specify surrogate key values. It will all be done automatically in the kernel!

Now to show the Implementation of the Unit Of Work I have created two tables i.e invoiceheader and invoiceline and than made the relation between them.The invoiceheader contains the field i.e totalquantity which holds the total quantity of the invoiceline field i,e quantity.

Below image will show you these two tables,their fields and there relations.
























Now the below  job will insert the invoiceheader with calculated totals and 2 lines. Note, that there is no place where recid is mentioned in the code. Business data only.







































One thing that I need to mention there is that.In the above code I have write the code i.e "line.invoiceheader(header);"

This is the method use to link the invoiceline table and the parent table.To call this method we have to first set the property CreateNavigationPaneProperty to "Yes".As shown in the image below:



Now When I run this job an exception will occured as you can see in the below image.

























I have run a job due to this issue the exception is occured to resolve this issue I have to make a static method inside the class and also include server tags in that method.as you can see in the below image.







Now when I call this method the data will be inserted successfully.you can see the below image of tables which contains the data that I have inserted.
 



 

 
 




































Thanks

Muhammad Zahid.

Saturday 1 December 2012

Links on Fields on Forms

When we open the form.There are some fields which are like hyperlinks and when we click on these
fields a new form is open.

As you can see the example below just go to the Account Receivable->Customers->All Customers.
The new form will open with fields cotaining the hyperlink.





And when I click on this field a new form is open as you can see in the below image.

 
 
 
Basically these fields physically exist in other table and they are showing on this table through foreign key.
 
The question is how the form is open when we click on these fields.The simple answer is that to open the form on this field just go to the table in which this field actually resides and than in the property of that table set the formref=formname.

Now The Query that shows the data on the Preview Pane is "CustListPagePreviewPane".In that Query there is table i.e custtable which uses that field i.e "CustGroup".Now we will go into the relation of that table to show that what is the parent table in which this field actually exist.

You can see the image of the custtable in the below image.























Now we will go to the property of the table CustGroup and see the FormRef propery.

















As you can see the name of the form in the formref property.This is the form which open when we click on the link custgroup.

Thanks

Muhammad Zahid.