Skip to main content

Posts

Code to call Excel Macro using MSD X++ language or axapta

Code to call Excel Macro using X++ language or axapta SysExcelApplication ExcelApplication1; SysExcelWorkbooks WorkBooks; SysExcelWorkbook WorkBook; SysExcelWorksheet Worksheet; ; ExcelApplication1= SysExcelApplication::construct(); ExcelApplication1.displayAlerts(true); ExcelApplication1.visible(true); ExcelApplication1.workbooks().open("SomeExcelFile.xls"); Workbook = ExcelApplication1.workbooks().item(1); Worksheet = Workbook.worksheets().itemFromName("Name of worksheet"); ExcelApp.comObject().Run("Macro1");

How to add the form node to project in MSD Axapta

How to add the form node to project ,You can write following code in job to test adding node code. void AddnodeToProject(HWND AxChild) { ProjectNode ChildMenuItemNode; ; ChildMenuItemNode = CDT_Global::extractProjNode(AxChild); if (ChildMenuItemNode) { ChildMenuItemNode = ChildMenuItemNode.getRunNode(); ChildMenuItemNode.lockUpdate(); ChildMenuItemNode.addUtilNode(UtilElementType::Form, formName); ChildMenuItemNode.unlockUpdate(); ChildMenuItemNode.AOTcompile(1); ChildMenuItemNode.AOTcompile(1); ChildMenuItemNode.AOTSave(); } }

strScan and Find a first occurrence of a string in a string using x++

strScan (Find a first occurrence of a string in a string) info("int strScan(str _text1,str _text2,int _position,int _number)"); info("Searches a text string for the occurrence of another string."); info("_text1 - The text string to search."); info("_text2 - The string to find."); info("_position - The position at which the search should start."); info("_number - The number of characters that should be searched."); info(int2str(strScan("ABCDEFGHIJ","DE",1,10)));

Infolog in MSD axapta

Infolog The Infolog is used to communicate with the application users. You use the Infolog to inform the user of validations, if an error occurs, or to display information to the user while processing a job. The Infolog is opened in a separate window, and opens automatically when called by a program. Information in the Infolog is removed when the Infolog window is closed, so if you need the information for later use, you can print the contents of the Infolog window by using the print menu item in the top menu. Information in the Infolog can be triggered both from code and by the kernel. Kernel information typically involves system integrity issues, such as information about mandatory database fields. From X++ you can control the information in the Infolog. There are three types of information in the Infolog. The types, which may be identified by the associated icon include: info , warning and error . Info text is generally displayed to inform the user about actions being perfor

Stop or Close a Period in MSD axapta

Stop or Close a Period in axapta Follow these steps to stop or close a period. 1. Click General ledger, click Setup, click Periods, and then click Periods. 2. Click the period to edit, and then click the Status arrow. 3. Select either Stopped or Closed in the Status field. By setting a prior period to stopped, no additional postings can occur in that period. Because you cannot reopen a closed period, set periods to stopped instead of closed.

How to use Switch case in MSD axapta

How to use Switch case in axapta The switch statement evaluates the variable used in the statement and instantly knows which case to continue to, as opposed to the if else if that has to evaluate from top to bottom until the if statement returns true. Notice that you have to use the break statement at the bottom of each case. If not, it will continue to execute the next case as well. The default statement can be used in a similar way as the else statement to say that if none of the other cases contained the correct value, jump to the default case instead. switch (carGroup) { case CarGroup::Economy : info("Kia Picanto"); break; case CarGroup::Compact : info("Toyota Auris"); break; case CarGroup::MidSize : info("Toyota Rav4"); break; case CarGroup::Luxury info("BMW 520"); break; default info("Standard cars"); break; }