Tuesday 29 September 2015

The binary hotfix must be installed to execute reports that use the pre-preprocessed temporary table concept. See the KB article 2858835 for details on this hotfix. - Axapta 2012

Hello Guys..!

Error :
while running reports in axapta 2012 R2 getting the below error.

The binary hotfix must be installed to execute reports that use the pre-preprocessed temporary table concept. See the KB article 2858835 for details on this hotfix.


Reason with Example:

 -> I have ax 2012 R2 environment with CU7. Due to some reasons i have reinstalled AOS service.

-> After doing the above changes , AOS server is not having CU7 files . But still my Axapta model database is having CU7 files.

Solution :

Install Axpta 2012 R2 CU7 in AOS server.


@Rahul Talasila



Tuesday 18 August 2015

Settle Vendor Invoice/Payment through X++ code - AX 2012

Hello Guys..!

Here I'm sharing code for Settle Vendor Invoice/Payment through X++ 

Code:
-----------
static void VendorSettlement(Args _args)
{
VendTable vendTable;
VendTrans invVendTrans, payVendTrans;
SpecTransManager manager;
CustVendTransData custVendTransData;
;
vendTable = VendTable::find("12345");
// Find the oldest unsettled invoice
select firstonly invVendTrans  order by TransDate asc
                            where invVendTrans.AccountNum == vendTable.AccountNum &&
                            invVendTrans.TransType == LedgerTransType::Purch &&
                            !invVendTrans.closed;
// Find the oldest unsettled payment
select firstonly payVendTrans order by TransDate asc
                    where payVendTrans.AccountNum == vendTable.AccountNum &&
                    payVendTrans.TransType == LedgerTransType::Payment &&
                    !payVendTrans.closed;
ttsbegin;
// Create an object of the CustVendTransData class with the invoice transaction as parameter
custVendTransData = CustVendTransData::construct(invVendTrans);
// Mark it for settlement
custVendTransData.markForSettlement(vendTable);
// Create an object of the CustVendTransData class with the payment transaction as parameter
custVendTransData = CustVendTransData::construct(payVendTrans);
//mark it for settlement
custVendTransData.markForSettlement(vendTable);
ttscommit;
// Settle all marked transactions
if(VendTrans::settleTransact(vendTable, null, true,SettleDatePrinc::DaysDate, systemdateget()))
info("Transactions settled");
}


@Rahul Talasila

Wednesday 12 August 2015

Dataset parameter must reference a valid report parameter - Axapta 2012

Hello Guys..!

Issue :

 while deploying SSRS report from visual studio getting error in Axapta 2012

"Dataset parameter must reference a valid report parameter".

Reason :

If you have a dataset parameter in your report that references the report parameter that you moved to the parameter group, you must update the dataset parameter reference or you will get an error that the Dataset parameter must reference a valid report parameter. The following steps describe how to update the reference to the report parameter.

Solution :

-> The default naming convention for a report parameter is [DatasetName]_[DatasetParameterName]. In Model Editor, expand the dataset that contains a reference to the report parameter that you added to the parameter group, and then select the dataset parameter.

-> In the Properties window, select the Report parameter drop-down list and then select the report parameter that you added to the parameter group.

For more information go through below link
https://technet.microsoft.com/en-us/library/gg731925.aspx


@Rahul Talasila

Sunday 2 August 2015

How to change grid row color in listpage/form in Dynamics Ax 2012

Hello Guys...!

Problem

How to change grid row color in listpage/ form in Dynamics Ax 2012 ?

Solution :

Go to Form Datasource and override Displayoption() method and write code according to your requirement.

Example :

 public void displayOption(Common _record, FormRowDisplayOption _options)
{
    SalesTable prodtablelocal;
   
    prodtablelocal = _record;
   
    Switch(prodtablelocal.SalesStatus)
    {
    Case SalesStatus::Delivered:
    _options.backColor(65535); //Light Yellow
    //_options.affectedElementsByControl(Salestable_SalesId.id());
    Break;
    Case SalesStatus::Invoiced:
    _options.backColor(8421631); //Light Red
    //_options.affectedElementsByControl(Salestable_SalesId.id());
    Break;
    Case SalesStatus::Backorder:
    _options.backColor(65408); //Light Green
    //_options.affectedElementsByControl(Salestable_SalesId.id());
    _options.textColor(12582912);
    Break;
    }
}



@Rahul Talasila

Thursday 23 July 2015

How to get today's +1 date in Dynamics Axapta X++? Or How to get tomorow date in Dynamics Axapta X++?

Hello Guys..!

 How to get today's +1 date in Dynamics Axapta?

Solution

your date variable = DateTimeUtil::date(DateTimeUtil::addDays(DateTimeUtil::getSystemDateTime(), 1));




@Rahul Talasila

Tuesday 21 July 2015

"Unable to Log on to Microsoft Dynamics Ax" error message displayed while generating SSRS reports in Ax 2012

Hello Guys..!

Error :

"Unable to Log on to Microsoft Dynamics Ax" error message displayed while generating SSRS reports in Ax 2012


Reason:

BC Proxy(Business Connector )Account does not have proper permissions .

Solution :

Check Report server "Execution Account" . Give same account in system service account place.

Go To System administration->Setup-> system service accounts and  give the BC Execution Account .



@Rahul Talasila


 

Monday 20 July 2015

Make sure that SQL Server Reporting Services is configured correctly. Verify the Web Service URL and Report Manager URL configuration in the SQL Reporting Services Configuration Manager - AX 2012

Hello Guys..!

I’m trying to validate  report server setup of a client and got the error below

“Make sure that SQL Server Reporting Services is configured correctly. Verify the Web Service URL and Report Manager URL configuration in the SQL Reporting Services Configuration Manager.”


Solution :

UAC has to be turned off via registry by changing the DWORD “EnableLUA” from 1 to 0 in “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system”.

You will get a notification that a reboot is required. After the reboot, UAC is disabled.

After UAC is disabled, the issue is resolved.

Steps :

Start -> Regedit

Press Enter

Go to  -> “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system”

 Change “EnableLUA” 1 to 0





@Rahul Talasila

Saturday 11 July 2015

Error: Restore failed for Server 'ServerName\InstanceName'. System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use.

Hello Guys..!

Some times while restoring Ax database we get below error.

Error: Restore failed for Server 'ServerName\InstanceName'.  System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. 


Reason : Ax Database is using by some service.

Solution : Kill all active connections which are using Ax database

Change the database name in the query and execute .

 
DECLARE @dbname NVARCHAR(128)
SET @dbname = 'DB name here'
 -- db to drop connections
DECLARE @processid INT
SELECT  @processid = MIN(spid)
FROM    master.dbo.sysprocesses
WHERE   dbid = DB_ID(@dbname)
WHILE @processid IS NOT NULL
    BEGIN
        EXEC ('KILL ' + @processid)
        SELECT  @processid = MIN(spid)
        FROM    master.dbo.sysprocesses
        WHERE   dbid = DB_ID(@dbname)
    END




That's It...


@Rahul Talasila


 

Sunday 28 June 2015

ERROR IN INVENTORY RECALCULATION "Account Number for transaction type Inventory, inventory receipt does not exist" - Ax 2012

Hello Guys..!

While doing inventory closing got below error

 "Account Number for transaction type Inventory, inventory receipt does not exist"


Reason :

I have given all accounts in posting profiles , but still same problem. Finally I found that offset ledger dimension value is missing in "InventTransPosting" table.

Solution :

By updating offset ledger dimension value in InventTransPosting Table.

Copy and Paste below code in AOT->Jobs and then run the job.

Note : Change from and todate in the below job according to your requirement

Example : If you are doing inventory closing from 1 JAN 2015 to 28 Feb 2015 .
                 Give same dates in below job.


static void UpdateInventTransPosting(Args _args)
{
    InventTransPosting                      inventTransPosting;
    GeneralJournalEntry                     generalJournalEntry;
    GeneralJournalAccountEntry              generalJournalAccountEntry;
    SubledgerVoucherGeneralJournalEntry     subledgerVoucherGeneralJournalEntry;
    TransDate                               frmDt = mkDate(04,05,2015);// Need to change
    TransDate                               toDt = mkDate(15,05,2015);// Need to change
    ;
    startLengthyOperation();
    ttsBegin;
    while select inventTransPosting where inventTransPosting.TransDate <= frmDt && inventTransPosting.TransDate >= toDt
        && inventTransPosting.OffsetLedgerDimension
        && inventTransPosting.InventTransPostingType == InventTransPostingType::Financial
    {
        select LedgerDimension from generalJournalAccountEntry
        join RecId from generalJournalEntry
        where generalJournalEntry.RecId == generalJournalAccountEntry.GeneralJournalEntry
        && (generalJournalAccountEntry.PostingType == LedgerPostingType::InventLoss || generalJournalAccountEntry.PostingType == LedgerPostingType::InventProfit)
        join RecId from subledgerVoucherGeneralJournalEntry
        where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.RecId
        && subledgerVoucherGeneralJournalEntry.Voucher == inventTransPosting.Voucher
        && subledgerVoucherGeneralJournalEntry.VoucherDataAreaId == inventTransPosting.dataAreaId
        && subledgerVoucherGeneralJournalEntry.AccountingDate == inventTransPosting.TransDate;
       if (generalJournalAccountEntry.LedgerDimension)
        {
            inventTransPosting.selectForUpdate(true);
            inventTransPosting.OffsetLedgerDimension = generalJournalAccountEntry.LedgerDimension;
            inventTransPosting.doUpdate();
        }
    }
    ttsCommit;
    info('Updation completed');
    endLengthyOperation();
}


That's It...!


@Rahul Talasila

Thursday 25 June 2015

10.00 cannot be picked because only 0.00 is/are available from the inventory - Axapta 2012

Hello Guys..!

while posting product receipt I got below error

“ #### cannot be picked because only 0.00 is/are available from the inventory.”

Reason :

This happens when item quantity is reserved in purchase order line.

Solution :

Step 1 :

Step :2

Make "Reservation" field 0(Zero).




That's it...

@Rahul Talasila

Monday 15 June 2015

Physical updating quantity in the inventory unit PCS must be other than zero - Ax 2012

Hello Guys ..!


Some times we get below error while doing purchase product receipt


"Physical updating quantity in the inventory unit must be other than zero."

Reason 1:

->Through code we updated receivenow qty in purchline but it is not properly updated in other areas.

Reason 2:                                                    
-> In purchline Table RemainInventPhysical , RemainPurchPhysical fields values are zero(0) but through code you are trying to post product receipt.


Solution For Reason 1:

Call "modifiedfield" method after assigning value to "PurchReceivedNow "

Example :


purchLine.PurchReceivedNow = 35.00;// Your Receive Now Qty
purchLine.modifiedField(fieldNum(purchLine, PurchReceivedNow));



Solution For Reason 2:

Update RemainInventPhysical , RemainPurchPhysical in purchline table with Ordered Qty

That's it...


Note : Check purchase line item unit Id conversion is exist or not.

@Rahul Talasila

Short Cuts In Axapta

Hello Guys..!

Here I'm sharing all short cuts in Axapta .

Viewing/Navigation options


 

Accelerator Keys
Task Description
Alt+F1
Show Navigation Pane (if it is not in auto-hide mode)
 
This shortcut works from both MDI & SDI windows, so it is a good shortcut to get back to the main workspace.
Shift+Alt+F1
Enable/Disable auto-hide for the Navigation Pane
Ctrl+Shift+D
Toggles the Content Pane between Developer and Content modes.  Developer mode makes the content frame (where Area pages & List pages are viewed) restorable/minimizable so it is easier to work with developer windows.
Ctrl+F1
Open global search pane
Alt+F5
Toggle the docking status of a docking window
Alt+F6
Move to the next docked window
Alt+Shift+F6
Move to the previous docked window
Ctrl+F6
Move to the next MDI window
Ctrl+Shift+F6
Move to the previous MDI window
Ctrl+Shift+V
Open “Version control parameters” form
Ctrl+W
Open a new workspace
F11
Focus the Address Bar in edit mode (works from anywhere)
Alt+Left Arrow
Shortcut for the Back button on the Address bar
Alt+Right Arrow
Shortcut for the Forward button on the Address bar
From AreaPage, ListPage or developer (MDI) window
 
Alt+M
Show the Microsoft Dynamics AX Command Bar
Alt+W
Show Windows menu
 
Hint: do this then press “a” to close all windows.
Alt+V
Show View menu
Alt+H
Show Help menu
Alt
Show Keytips
 
Press the corresponding key to navigate directly to ActionPaneTab/Group/Button
 
There may be one or more ActionPaneTabs/Groups/Buttons with the same letter for a Keytip.  To execute a duplicate Keytip, keep pressing the letter until focus is on the one you want and then hit Enter.


Accelerator Keys
Task Description
Ctrl+N
Create a new record
Ctrl+S
Save current record
Alt+F9
Delete record(s)
Ctrl+F4
Close the active window (saving changes)
Esc
or
Ctrl+Q
Close the active window (cancelling changes)
Alt+F4
Close the active window from SDI form (saving changes), Close the application from the main window
Ctrl+P
Print auto-report associated with current form
Ctrl+A
Select all rows in the currently active data source (works regardless of whether you are in a grid or not)
Alt+Down Arrow
Drops down a lookup field or drop-down-list
Ctrl+Alt+F4
or
Menu[i] + G
Go to Main Table Form
F10
Activate the form’s menu bar (File, Edit, etc.)
Enter or Tab
Move to the next field
 
Enter will skip over buttons and will move to fields across tabs.
 
Tab will navigate to buttons and will always stay on the same tab page.
Shift+Enter or Shift+Tab
Move to the previous field (same caveats as previous row)
Ctrl+Shift+Home
Go to the first entry field in the form
Ctrl+Shift+End
Go to the last entry field in the form
Ctrl+Page Up
Go to the previous field group
Ctrl+Page Down
Go to the next field group
Shift+F10
Open context menu for current field
Page Up
Move to the previous page of records
Page Down
Move to the next page of records
Ctrl+Home
Move to the first record
Ctrl+End
Move to the last record
F5
Refresh all data sources on the current form
Ctrl+F5
Restore only the active record



Accelerator Keys
Task Description
Ctrl+F
Find by Field (clears previously applied filters)
Ctrl+K
Filter by Field (appends to previously applied filters)
Alt+F3
Filter by Selection
Ctrl+F3
Open Advanced Filter window
Ctrl+Shift+F3
Clear all filters
Within a Grid
 
Ctrl+G
Enable/Disable Filter by Grid
Ctrl+Up Arrow
From a grid cell, move focus to the Filter by Grid input cell for that column (Filter by Grid must be enabled)
On a ListPage
 
Shift+F3
Focus the Quick Filter (“Type to filter” area)
Focus in Quick Filter
 
Enter
Execute/Clear Quick Filter
Down Arrow
Drop down the Quick Filter’s Field Chooser menu

 

Accelerator Keys
Task Description
Ctrl+E
Export to Excel (only contents of grid)
Ctrl+C
Copy:
 
1)      If Single cell is selected, copies just that cell contents
2)      If the entire row is selected or multiple rows are selected, copies values for ALL fields on all the rows (including those off the grid)
Up/Down Arrow
Move focus to the next/previous record, unselecting the current record
Ctrl+Up/Down Arrow
Move focus to the previous/next record, leaving the current record marked and not marking the newly focused record
Shift+Up/Down Arrow
Move focus to the previous/next record, leaving the current record marked and marking the newly focused record
Ctrl+Shift+Home/End
Mark all records between the currently selected record and the first/last record
Editable Grids
 
Shift+Space
Mark the current record, leaving previously marked records marked.
Read-only Grids
(such as on a ListPage)
 
Enter
Execute default action (only on ListPage grids, usually opens the corresponding details form for selected record)
 
For, Non-ListPage forms, Enter will move to the next field
Left Arrow
Move focus one field to the left.  If focus is already in the left-most column, hitting Left Arrow will “mark” the row.
Right Arrow
Move focus one field to the right.
Ctrl+Space
Mark the current record, leaving previously marked records marked.
Shift+Space
Mark all records between the current record and the top-most marked record (or the top record if none are marked), leaving previously marked records marked.
Shift+Page Up/Page Down
Mark all records between the currently selected record and the previous/next page of records.

AOT
 

Accelerator Keys
Task Description
Ctrl+D
Open the AOT
Ctrl+Shift+P
Open the Projects window
Ctrl+ O  or
Menu + O
Context: Description
Job: Execute the job
Class: Run the main(Args) method
Form: Launch the form
Report: Run the report
Table: Launch Table Browser for this table
Menu + W
Open new AOT window, with only the current node
Ctrl+N
Create a new object
Enter
or
Ctrl+Shift+F2
Edit an object
Ctrl+S
Save current object
Ctrl+Shift+S
Save all modified objects
Delete
Delete current object
F2
Rename current object
Menu + R
Restore the state of the current object from disk, cancelling any pending changes
Ctrl+Shift+I
Import one or more application objects from a file
Menu + X
Export the current node to an XPO
F7
Compile
Ctrl+P
Print the active application object (basically XPO contents)
Alt+Enter
Open the property sheet
Ctrl+F
Find window
Ctrl+G
Compare different versions of the application object
Alt+Left Arrow
Move the object to the level of its current parent node in the tree
Alt+Right Arrow
Make the current object a child of the nearest container above it in the tree
Alt+Up Arrow
Move the object one slot up in its current level of the tree
Alt+Down Arrow
Move the object one slot down its current level of the tree
Number Pad *
Expand all sub-trees under this node
Shift+F9
View breakpoints
Ctrl+Shift+F9
Remove all breakpoints
Source Control
 
Alt+I
Check the application object into the version control system
Alt+O
Check out the application object for editing
Alt+U
Undo check out
 

 

Accelerator Keys
Task Description
Ctrl+N
Create a new method/job
Ctrl+S
Save current method/job
F5
Context: Description
Job: Execute the job
Class: Run the main(Args) method
Form: Launch the form
Report: Run the report
Ctrl+F
Find and Replace (Find tab focused)
Ctrl+H
Find and Replace (Replace tab focused)
F3
Repeat the last find
Ctrl+G
Go to the specified line
F4
Go to the next error/warning/task
F9
Insert or remove a breakpoint
Ctrl+F9
Enable or disable a breakpoint
Shift+F9
View breakpoints
Ctrl+Shift+F9
Remove all breakpoints
Ctrl+Space
List properties and methods for the selected object
Ctrl+Alt+Space
Lookup a selected label or text
Ctrl+Shift+Space
Go to the definition of the selected method
F2
List all tables
Ctrl+T
List all Extended Data Types
F11
List all enums
F12
List all classes
Shift+F2
List language-reserved words
Shift+F4
List built-in functions
Alt+R
Open the “Scripts” context menu
F6
Close the current tab discarding all changes since last save
F8
Close, and save the current tab
Ctrl+L
Delete the current line
Ctrl+Shift+L
Delete from cursor to the end of the line
Selection Modes
 
Alt+A
“Select Area” - Area Selection Mode – clicking and selecting an area in the editor occurs as in typical editors (default setting)
Alt+O
“Select Columns” - Block Selection Mode – clicking and selecting an area will do so in a rectangle starting from the initial mouse cursor position (entire lines are not selected)
Alt+L
“Select Lines” - Line Selection Mode – clicking a line will select the entire row, clicking and selecting an area will always select the entire lines.
Alt+U
“Undo Selection” - Unselect the current selection.

Debugger
 

Accelerator Keys
Task Description
F5
Go
Shift+F5
Stop
F11
Step into function calls
F10
Step over function calls
Ctrl+F11
Step out of the function
Ctrl+F10
Run to cursor
Ctrl+Shift+F10
Set next statement
Alt+Number Pad *
Show next statement
Shift+F9
View breakpoints
F9
Insert or remove a breakpoint
Ctrl+F9
Enable or disable a breakpoint
Ctrl+Shift+F9
Remove all breakpoints
Ctrl+Alt+Line
Show/hide line numbers
Ctrl+Alt+V
View variables
Ctrl+Alt+C
Display the call stack
Ctrl+Alt+O
View output
Ctrl+Alt+B
View breakpoints
Ctrl+Alt+W
View watch
Ctrl+Alt+M
Toggle workbook mode
Ctrl+Alt+D
Restore default layout
Ctrl+F4
Close window
Ctrl+Shift+F4
Close all windows
Ctrl+F6
Next window
Ctrl+Shift+F6
Previous window
During code execution
 
Ctrl+Break
Break execution of currently running script.
 
To open the debugger where the execution is stopped, when the “Are you sure that you want to cancel this operation?” dialog comes up, hold SHIFT and click the No button.

 
@Rahul Talasila

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...