Buscar este blog

jueves, 27 de marzo de 2014

Dynamics AX interview Questions

Delete actions & its types

Types of delete action
a. Cascade
A cascading deletion action will delete all records in the related table, where the foreign key is equivalent to the primary key of the current table. That is, deleting the parent record will also delete the child record(s) in the related table.
This cascading will take place whether the deletion is performed in code or directly by a user through the user interface.
b. Restricted
A restricting delete action will raise an error message if the user tries to delete a record, where records exist in the related table where the foreign key is equivalent to the primary key of the current table.
This error will only appear if the deletion is performed through the user interface. A deletion from X++ code will be allowed to proceed and will not be cascaded to the related table. In this case the programmer should call .validateDelete() themselves prior to the call to .delete()
c. Cascade+Restricted
This delete action normally works as a Restricted delete action. However if the deletion is performed through X++ code, no error will be raised and the deletion will be cascaded to the related table. 


How many types of MAP there in Dynamics AX?

Types of MAP in dynamics AX
There are two types of Maps available in dynamics AX

1. X++ Maps: it can be used as a temp data store for the given scope of a process. This takes us less over head, and is much quicker than a TempTable. For Further reading
2. AOT Maps: A map can unify the access to similar columns and methods that are present in multiple tables. You associate a map field with a field in one or more tables. This enables you to use the same field name to access fields with different names in different tables. Methods on maps enable you to create or modify methods that act on the table fields that the map references.


Table groups & its types

Table groups provide a method for categorizing tables according to the type of data they contain.
When exporting data, you can use table groups to filter records. For example, if you wanted to specify that customers should be exported but customer transactions should not. The table group that a table belongs to is defined by the TableGroup property of the table.
The available table group values are listed in the following table.
  1. Parameter: The table contains data primarily used as parameters or setup information for one of the main tables (a table that has a TableGroup property of Main).The table typically contains only one record per company. Examples: CustParameters, VendParameters
  2. Group: The table contains data primarily used to categorize one of the main tables (a table that has a TableGroup property of Main). There is a one-to-many relationship between a Group table and a Main table. Examples: CustGroup, VendGroup
  3. Main: The table is one of the principal tables in the application and contains data for a central business object.The table typically holds static, base information. There is a one-to-many relationship between a Main table and a Transaction table. Examples: CustTable, VendTable
  4. Transaction: The table contains transaction data.The table is typically not used for data entry directly. Examples:CustTrans, VendTrans
  5. WorksheetHeader: The table typically categorizes information in the WorkSheetLine tables. There is a one-to-many relationship between a WorkSheetHeader table and a WorkSheetLine table.Examples:SalesTable
  6. WorksheetLine: The table contains information to be validated and made into transactions. In comparison to the data contained in a Transaction table, the data in WorkSheetLine tables is temporary and may be deleted without affecting system stability. Examples: SalesLine
  7. Miscellaneous: The table does not fit in any of the other categories. This is the default value for a new table. Examples: TableExpImpDef

Creation of PO & SO thru code (AX 2009)

Code for creating Sales order:
SalesTableType and SalesLinetype. Insert() should be called for creating the sales order.

static void createSalesTable(CustAccount _custAccount)
{
SalesTable salesTable;
NumberSeq NumberSeq;
;
NumberSeq = NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().numberSequence);
salesTable.SalesId = NumberSeq.num();
salesTable.initValue();
salesTable.CustAccount = _custAccount;
salesTable.initFromCustTable();
salesTable.insert();
}

Example: Create a Sales Line
static void createSalesLine(SalesId _salesId, ItemId _itemId)
{
SalesLine salesLine;
;
salesLine.clear();
salesLine.SalesId = _salesId;
salesLine.ItemId = _itemId;
salesLine.createLine(NoYes::Yes, // Validate
NoYes::Yes, // initFromSalesTable
NoYes::Yes, // initFromInventTable
NoYes::Yes, // calcInventQty
NoYes::Yes, // searchMarkup
NoYes::Yes); // searchPrice
}

//Code for posting Sales order Invoice
static void createSalesOrder(Args _args)
{
SalesFormLetter formLetterObj;
formLetterObj = SalesFormLetter::construct(DocumentStatus::Invoice);
formLetterObj.update(SalesTable::find(“SO-101248));
}
Code to Create Purchase Order and Post the Invoice:
Following Job creates the Purchase order from code and post the invoice by making use of PurchFormLetter class. If you don't have demo data , please test with your input values.

static void Dev_CreatePO_and_Invoice(Args _args)
{
NumberSeq numberSeq;
Purchtable Purchtable;
PurchLine PurchLine;
PurchFormLetter purchFormLetter;
;
ttsbegin;
numberSeq = NumberSeq::newGetNumFromCode(purchParameters::numRefPurchaseOrderId().NumberSequence,true);
// Initialize Purchase order values
Purchtable.initValue();
Purchtable.PurchId = numberSeq.num();
Purchtable.OrderAccount = '3000';
Purchtable.initFromVendTable();
if (!Purchtable.validateWrite())
{
throw Exception::Error;
}
Purchtable.insert();
// Initialize Purchase Line items
PurchLine.PurchId = Purchtable.PurchId;
PurchLine.ItemId = 'B-R14';
PurchLine.createLine(true, true, true, true, true, false);
ttscommit;
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchtable, // Purchase record Buffer
"Inv_"+purchTable.PurchId, // Invoice Number
systemdateget()); // Transaction date
if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
{
info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
}
}

Change the DocumentStatus to packingSlip , if you want to post packing slip.




What precautions you need for overriding fetch() method for a report?


http://msdn.microsoft.com/en-us/library/bb395110.aspx



Difference between view and table

 

Difference between a view and a base relation: -

Views:
1. This is one type of relation which is not a part of the physical database.
2. It has no direct or physical relation with the database.
3. Views can be used to provide security mechanism.
4. Modification through a view (e.g. insert, update, delete) generally 
not permitted

Base Relation:
1. A base relation is a relation that is not a derived relation.
2. While it can manipulate the conceptual or physical relations stored 
in the data.
3. It does not provide security.
4. Modification may be done with a base relation.
We can assign the view, a name & relate it the query expression as
Create View as 
Let EMPLOYEE be the relation. We create the table EMPLOYEE as follows:

     Create table EMPLOYEE
     (Emp_No integer of null,
     Name char (20),
     Skill chars (20),
     Sal_Rate decimal (10, 2),
     DOB date,
     Address char (100),)
For a very personal or confidential matter, every user is not permitted to see the Sal_Rate of an EMPLOYEE. For such users, DBA can create a view, for example, EMP_VIEW defined as:

Create view EMP_VIEW as
(Select Emp_No, Name, Skill, DOB, Address 
         From EMPLOYEE)


Explain sales/purchase order processes in AX.


sd

No hay comentarios:

Publicar un comentario