Tag Archives: Dynamics AX 2012 R3
Sales return order line registration in D365FO and AX 2012
Introduction: Sales return order line registration in X++ Details: Consider SalesReturnOrderRegisterLine is the table where records are with SalesLine referenced. If we are required to register serialized items than salesReturnOrderRegisterLine.inventSerialId will be considered and if item referred with batch then salesReturnOrderRegisterLine.inventBatchId will be considered. public static void inventoryRegistration(SalesId _salesId) { SalesReturnOrderRegisterLine salesReturnOrderRegisterLine; SalesLine salesLine; TmpInventTransWMS tmpInventTransWMS; InventTransWMS_Register inventTransWMS_Register; InventDim inventDim; InventTrans inventTrans; VendPackingSlipTrans vendPackingSlipTransLoc; InventTransOrigin inventTransOrigin; while select salesReturnOrderRegisterLine where salesReturnOrderRegisterLine.SalesId == _salesId { salesLine = SalesReturnOrderRegister::updateDispositionCode(salesReturnOrderRegisterLine.InventTransId); inventTransWMS_Register = InventTransWMS_Register::newStandard(tmpInventTransWMS); select firstonly inventTrans where inventTrans.StatusReceipt == StatusReceipt::Ordered exists join inventTransOrigin where inventTransOrigin.RecId == inventTrans.InventTransOrigin && inventTransOrigin.InventTransId == salesLine.InventTransId && inventTransOrigin.ReferenceId == _salesId; tmpInventTransWMS.clear(); tmpInventTransWMS.initFromInventTrans(inventTrans); tmpInventTransWMS.InventQty = salesReturnOrderRegisterLine.SalesQty; tmpInventTransWMS.LineNum = int642int(salesLine.LineNum); inventDim = salesLine.inventDim(); inventDim.inventSerialId = salesReturnOrderRegisterLine.inventSerialId; inventDim.inventBatchId = salesReturnOrderRegisterLine.inventBatchId; tmpInventTransWMS.InventDimId = InventDim::findOrCreate(inventDim).inventDimId; tmpInventTransWMS.ItemId = salesLine.ItemId; inventTransWMS_Register.writeTmpInventTransWMS(tmpInventTransWMS, inventTrans, InventDim::find(tmpInventTransWMS.InventDimId)); if (!inventTransWMS_Register.updateInvent(salesLine)) { throw error(“Error during sales return order registration”); } } } Consider SalesReturnOrderRegister is the class which has below static methods public static SalesLine updateDispositionCode(InventTransId _inventTransId) { SalesLine salesLine = SalesLine::findInventTransId(_inventTransId, true); ReturnDispositionCode returnDispositionCode; SalesReturnOrderRegister::runPreReturnOrderRegisterLine(salesLine); salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; salesLine.update(); return salesLine; } public static void runPreReturnOrderRegisterLine(SalesLine _salesLine) { InventTransOriginId salesLineInventTransOriginId; InventTransOriginId reservationLineInventTransOriginId; SalesLine reservationLine; ReturnDispositionCode returnDispositionCode; if (_salesLine.ReturnStatus == ReturnStatusLine::Awaiting) { if (!_salesLine.ReturnAllowReservation && _salesLine.isStocked()) { SalesLine::changeReturnOrderType(_salesLine.InventTransId); _salesLine = SalesLine::findInventTransId(_salesLine.InventTransId, true); } select firstOnly returnDispositionCode where returnDispositionCode.DispositionAction == DispositionAction::Credit; _salesLine.ReturnDispositionCodeId = returnDispositionCode.DispositionCodeId; _salesLine.update(); } else if (_salesLine.ReturnStatus == ReturnStatusLine::Registered) { select forupdate firstonly reservationLine where reservationLine.InventRefTransId == _salesLine.InventTransId; if (reservationLine || _salesLine.qtyMarked()) { if ((_salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReplaceScrap || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::ReturnToCust || _salesLine.returnDispositionCode().DispositionAction == DispositionAction::Scrap)) { if (reservationLine.SalesQty == reservationLine.RemainSalesPhysical) { reservationLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(reservationLine.DataAreaId, reservationLine.InventTransId); salesLineInventTransOriginId = InventTransOriginSalesLine::findInventTransOriginId(_salesLine.DataAreaId, _salesLine.InventTransId); InventTransOrigin::deleteMarking(salesLineInventTransOriginId, reservationLineInventTransOriginId, -_salesLine.QtyOrdered); reservationLine.delete(); } } else { throw error(“@SYS332911”); } } } } Thanks for reading and stay connected with us for more updates!!! Jagdish Solanki | Senior Technical Consultant | CloudFronts Business Empowering Solutions Team “Solving Complex Business Challenges with Microsoft Dynamics 365 & Power Platform”
How to export projects layerwise in Microsoft Dynamics AX 2012
Introduction: How to export projects layerwise (usr, cus, var, etc.) in Microsoft Dynamics AX 2012? Details: Here, we will see how we can export the projects from AX 2012. Now It’s very easy to do so. We need to create a class or job in the respective environment and just need to do run. static void exportProjects(Args _args) { #AotExport TreeNodeIterator tni; ProjectNode projectNode; int exportFlag; Dialog dialog = new Dialog(); DialogField folderName; DialogField projectDefinitionOnly; DialogField exportFromLayer; DialogField projectType; UtilEntryLevel layer; SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelCells cells; SysExcelCell cell; SysExcelFont font; int row; CustTable custTable; str fileName; fileName = “D:\\Backup XPOs.xlsx”; //By specifying the directly, we will get the list of exported projects //Excel Part…………………………………………………………………… dialog.addText(“This will export all projects (shared or private) that exist in a selected model.”); projectType = dialog.addFieldValue(enumStr(ProjectSharedPrivate), ProjectSharedPrivate::ProjShared); projectDefinitionOnly = dialog.addField(extendedTypeStr(NoYesId), ‘Project Definition Only’); folderName = dialog.addField(extendedTypeStr(FilePath)); exportFromLayer = dialog.addField(enumStr(UtilEntryLevel), ‘Projects from layer’); dialog.run(); if (dialog.closedOk()) { if (!folderName.value()) throw error(“Missing folder”); exportFlag = #export; if (projectDefinitionOnly.value()) exportFlag += #expProjectOnly; layer = exportFromLayer.value(); switch (projectType.value()) { case ProjectSharedPrivate::ProjPrivate: tni = SysTreeNode::getPrivateProject().AOTiterator(); break; case ProjectSharedPrivate::ProjShared: tni = SysTreeNode::getSharedProject().AOTiterator(); break; } projectNode = tni.next() as ProjectNode; while (projectNode) { if (projectNode.AOTLayer() == layer && projectNode.name() like “CFS*”) //if [like] specifies, system will export the projects which names starts with CFS { projectNode.treeNodeExport(folderName.value() + ‘\\’ + projectNode.name() + ‘.xpo’, exportFlag); row++; } projectNode = tni.next() as ProjectNode; } info(“Projects Exported Successfully & Exported Projects List to Excel Sheet”); } else warning(“No action taken…”); } After running the class it will prompt as below. After that select the directory where to export all projects and select the layer from which layer all projects should be exported. Thanks for reading!!!
Import, Export and Uninstall the model from Microsoft Dynamics AX 2012
Introduction: In this blog, we will see how we can import, export and uninstall the model from Microsoft Dynamics AX 2012 Details: Prerequisite for import, export and uninstall the model from the environment, run the command prompt as in administrator mode. Form Importing the model script: Install-AXModel -File “Path_Of_the_Model_File” -server ServerName -database DatabaseName_Model –Details Exmaple: Install-AXModel -File “D:\Model\VARModel.axmodel” -server CFSEnvVM -database DAX2012R3CFSEnv_Model –Details Form Exporting the model script: Export-AXModel -Model ‘Model’ -File ‘Path’ -server ‘ServerName\DBName’ -database ‘DatabaseName_Model’ Exmaple: Export-AXModel -Model ‘CUS Model’ -File ‘C:\ModelFile\CUSModel.axmodel’ -server ‘TESTSERVER\CFSDAXSQL2014’ -database ‘DAX2012R3Blank_model’ Form Uninstalling the model script: Uninstall-AXModel -Model ‘Model’ -server ‘ServerName’ -database ‘DatabseName_Model’ Exmaple: Uninstall-AXModel -Model ‘VAR Model’ -server ‘CFSEnvVM’ -database ‘DAX2012R3Test_model’ Thanks for reading !!!
What is Kernel Hotfix and Application Hotfix in Microsoft Dynamics AX 2012?
Introduction: In this blog, we will see what includes in Kernel Hotfix and Application Hotfix in Microsoft Dynamics AX 2012. Details: 1. Kernel Hotfix: · This hotfix updates Microsoft dlls. E.g. update are the executable files (ax32.exe, ax32serv.exe) and assemblies (Microsoft.Dynamics.AX.*.dll) · There are no code-level changes. · This hotfix required to install at all the client PCs & Servers, where any of the components of AX is installed. · A kernel fix is always cumulative. 2. Application Hotfix: · This type of hotfixes affects code development done by partners. · Updates in the SYP, GLP, FPP & SLP layers (the layers reserved for Microsoft code). These changes are made in the AX model store in AX 2012 and later versions · An application fix is NOT cumulative.
Product Configuration Model in AX 2012 R3
Product Configuration is generic Product structure with distinct variants that allow user to use product easily in sales process as per customer requirement. You can use product configuration on Sales Order line as well as on Sales Quotation line. Example of Bicycle configuration: Bicycle is configured by using five attributes such as Bicycle Type, Bicycle Colour, Saddle Type, Suspension and Wheels. Each attribute type has set of value which is mentioned in below table. Attribute Type Attribute Value Bicycle Type Racing Bicycle, Touring Bicycle, Cruiser bicycles Bicycle Colour Red, White, Blue, Black Saddle Type Racing Saddle, Comfort Saddle, Cruiser Saddle Suspension Yes, No Wheels Number of Wheels Below are steps to create Product Configuration Model for Bicycle Create Product Configuration Model Navigation: Product information management > Common > Product configuration models to open the list page. Click Product configuration model in the New group of the Action Pane to open the New product configuration model Add name Bicycle for Product Configuration Model, enter description, select New component and enter name Bicycle Configuration for component (Component: Component is generic element that can be assigned to product configuration model. This can include information about user requirements, attributes, constraints, sub component, BOM lines, and route operations) Click OK Create Attribute Type: Navigation: Product information management > Common > Product configuration models list page. Click Attribute types in the Setup group of the Action Pane. Create new attribute types Bicycle colour, Bicycle Type, Saddle Type, Bicycle Suspension and Wheels Add values for which is mentioned in below table Attribute Type Base Type Attribute Value Bicycle Type Text Racing Bicycle, Touring Bicycle, Cruiser bicycles Bicycle Colour Text Red, White, Blue, Black Saddle Type Text Racing Saddle, Comfort Saddle, Cruiser Saddle Suspension Boolean Yes, No Wheels Integer Number of Wheels (Attribute types – Attribute types specify the set of data types or domains for attributes that are used in a product configuration model. The following data types can be used in a product configuration model: text, boolean, integer, and decimal.) Create Attributes Navigation: Product information management > Common > Product configuration models. Select the product configuration model and then click Edit in the Maintain group of the Action Pane to open the Constraint-based product configuration model details Click the Attributes FastTab. Add attribute name, solver name and description Select attribute type for each. (Attributes: Attributes describe the properties of the components. You can use attributes to specify the features that can be selected when a distinct product variant is configured.) Create Constraints: Navigation: Product information management > Common > Product configuration models. Select the product configuration model and then click Edit in the Maintain group of the Action Pane to open the Constraint-based product configuration model details Click the Constraints FastTab Below are the Rules and its expression constraints which is used to create condition for Bicycle Configuration. Configuration Rules Rule 1: IF Bicycle Type = Racing Bicycle THEN Bicycle Colour = Blue Or Black Expression constraints: Implies[ BicycleType == “RacingBicycle” , SaddleType == “RacingSaddle” ] Rule 2: IF Bicycle Type = Touring Bicycle THEN Bicycle Colour = Red Or White Expression constraints: Implies[ BicycleType == “TouringBicycle” , BicycleColour == “Red” | BicycleColour == “White” ] Rule 3: IF Bicycle Type = Cruiser Bicycle THEN Bicycle Colour = White Or Black Expression constraints: Implies[ BicycleType == “CruiserBicycles” , BicycleColour == “White” | BicycleColour == “Black” ] Rule 4: IF Bicycle Type = Racing Bicycle THEN Saddle Type = Racing Saddle Expression constraints: Implies[ BicycleType == “RacingBicycle” , SaddleType == “RacingSaddle” ] Rule 5: IF Bicycle Type = Touring Bicycle THEN Saddle Type = Comfort Saddle Expression constraints: Implies[ BicycleType == “TouringBicycle” , SaddleType == “ComfortSaddle” ] Rule 6: IF Bicycle Type = Cruiser Bicycle THEN Saddle Type = Cruiser Saddle Expression constraints: Implies[ BicycleType == “CruiserBicycles” , SaddleType == “CruiserSaddle” ] Rule 7: IF Saddle Type = Comfort Saddle or Cruise Saddle THEN Suspension = True Expression constraints: Implies[ SaddleType == “ComfortSaddle” | SaddleType == “CruiserSaddle” , BicycleSuspension == True ] (Constraints: Constraints describe the restrictions of the product configuration model, and they are used to make sure that only valid values are selected when the product configuration model is configured. There are two type of constraints Expression constraints which is used in above example and Table constraints. Expression constraints: express relations between attributes to make sure that compatible values are selected when you configure a product. Table constraints: A constraint type that specifies allowed attribute combinations. Each row in the table displays a legal combination of values.) Create Calculation, Sub component and User requirement: Navigation: Product information management > Common > Product configuration models. Select the product configuration model and then click Edit in the Maintain group of the Action Pane to open the Constraint-based product configuration model details Click the Calculation, Sub Component, Use requirement Fast Tabs You can use calculation, sub component and user requirement if require otherwise it is optional Create BOM Lines (for Bicycle Wheels) Navigation: Product information management > Common > Product configuration models. Select the product configuration model and then click Edit in the Maintain group of the Action Pane to open the Constraint-based product configuration model details Click the Constraints FastTab Enter name, description, condition (optional) of BOM line. Click the BOM line details button to open the BOM line details form In BOM line detail form select Item Y20I (Wheel) Open detail fast tab and select Set and Calculation check box In Setup tab, in consumption calculation field, select set and attribute check box and in Quantity field select attribute Wheels. In Per series field select set check box specify one. (BOM Lines: BOM lines are included in the product configuration model to identify the manufacturing BOM for each component. A BOM line can reference an item or a service, and all item properties can be set to a fixed value or mapped to an attribute.) Create Route Operation: Navigation: Product information management > Common > Product configuration models. Select the product configuration model and then … Continue reading Product Configuration Model in AX 2012 R3
Account Receivable Reconciliation Process
Accounts Receivable is process of matching customer account balances with the general ledger balance. The reconciliation should be done at least monthly as part of the month-end closing procedures so any adjustments needed can be included in the correct period. Below are steps to process accounts receivable reconciliation. 1. The Ledger accounts to be checked in the ‘Customer Posting profile’ accounts. Navigation: Accounts Receivable→ Setup→ Customer Posting Profile 2. Summary accounts for Accounts Receivable should not be allowed for manual entry. 3. Run the report for ‘Balance List’ for the above ledger accounts. Navigation General Ledger→ Reports→ Transactions→ Balance List Enter the Start & End Date for the closing month. Click ‘Select’ Select all the ledger accounts required. Click ‘Ok’. Run the report with the selected ledger accounts. 4. Now run the Report for Customer Balance List. Navigation Accounts Receivable→ Reports→ Status→ Customer Balance List Select From date, Report period start date and To date Click OK The Total Ledger Balance for ‘Accounts Receivable’ should match with the total ‘Customer Balance’. If they do not match, we need to find the transactions with discrepancies. To find the transactions with discrepancies, Run the report for ‘Customer-Ledger Reconciliation’. 5. Run Customer-Ledger Reconciliation report Navigation General Ledger→ Reports→ Reconciliations→ Customer→ Customer Select the Dates, Posting Profiles. Select the check boxes for Include Details Differences only. Click OK to get the transactions with discrepancies. 6. All the transactions with differences should be analysed to find the transactions. The reasons for the discrepancies can be as follows. The posting profile changes (Change of ledger accounts in the posting profile during that period) Manual entries to the Ledgers 1. The posting profile changes Posting profile is a setup where the ledger accounts defined for the customer balances. A ledger account can be defined for all customers or for a group of customers or even for an individual customer. During a fiscal period, if the ledger account is changed for a customer in the posting profile; there arises a discrepancy in the customer account balances & their ledger balances. 2. Manual Journal Another reason for a discrepancies is a manual entry to the ledger account for the customer. 7. Steps to correct discrepancies A journal voucher can posted to transfer the balance from one ledger account For example: Suppose the ledger account defined for all customers is defined as ‘130100’ & after that for a specific customer group, a new ledger account is mapped; which is ‘130110’. When the ledger account is changed, all the transactions for the customer group before the change would show discrepancies. Solution: A journal voucher can be posted to transfer the balances between the two ledgers. The transactions with incorrect posting should be reversed & then they should be posted again. Solution: A manual journal is required to be posted to transfer balances between the two ledger accounts. Summary: You can use Account Reconciliation Process to check discrepancies before month end closing. Run Balance list report, Customer balance list and Customer reconciliation report to find discrepancies. Use journal to correct discrepancies or if possible then reverse posted transaction to correct discrepancies.