How to add multiple report design under Print management in AX 2012

If you have new formats for Sales/Purchase/Quotation confirmation/Picking/Packing/Invoice..., following these steps :

Step1. Create new Design for report under visual studio
Step2. Add code to method:
\Data Dictionary\Tables\PrintMgmtReportFormat\Methods\populate
Add code  before TTSCOMMIT:
addOther(PrintMgmtDocumentType::SalesOrderPackingSlip, ssrsReportStr(SalesPackingSlipReportUD), ssrsReportStr(SalesPackingSlipReportUD), #NoCountryRegionId);     
Step 3. Choose you new format under:
AR -> setup -> form setup -> Print management -> Sales order Packing slip original -> report format to  SalesPackingslip.ReportUD
Step 4.
New Report design can be executed from use Print management from Inquiry journal forms or during posting by selecting Print management destination.
Step 5. (Optional)
In case: the report still keep original design, add this code to class TradeDocumentReportController in method outputReport:
//original menu item or your new menu item
if(args.menuItemName() == menuitemOutputStr(SalesPackingSlipOriginal)) 
formLetterReport.getCurrentPrintSetting().parmReportFormatName(ssrsReportStr(SalesPackingSlipOriginal, ReportUD)); 
}

AxBuild in AX 2012 CU7 perform faster full compile and fix error from AxBuild

AxBuild.exe can accomplish a full compile of all X++ code, into AX p-code, many times faster than the traditional compile that you start from the MorphX client menu.AxBuild.exe is run on the Application Object Server (AOS) tier at a cmd.exe command prompt.

AxBuild.exe became available in cumulative update 7 for Microsoft Dynamics AX 2012 R2.

enter: Cmd >> go to specified path C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin
enter: axbuild xppcompileall /s=01
or
axbuild xppcompileall /s=01 /log="E:\log" /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin" /compiler="C:\Program Files\Microsoft Dynamics AX\60\Server\AX2012R2\bin\ax32serv.exe"




















Result: total time 1 hour 3 mins











Fix error from AxBuild:
*** After compiling with AXBuild, maybe you tried to do a full CIL Generation. This always results in the following error code 351: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Go to "C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\Log" (or the path you defined in command)
Open AxCompileAll.html you will see all the error here, go to class or form from error list... compile them manually.
Do full comile CIL again

How to entering Sales Lines by bar code in AX 2012

In AX 2012, we only choose bar code after we have item id on sales line.













This is a simple code to show you how to chose bar code and auto bring item id and product dimension to sales lines:
Comment this code in class SalesTableForm method adjustLineAccessBasedOnItem






Comment this code in Form SalesTable method setReturnFields




Overide method modified of BarCode field in SalesLine datasource