How to Publish AX Reports for a specific AOS Instance

DAX Knowledge Pot

If you are running multiple instances of AX on a single environment, you have more than likely gone through the instructions as per this URL http://technet.microsoft.com/en-us/library/hh389760.aspx.

One of the steps identified in this URL talks about publishing reports using the following AX Powershell command: publish-axreports.

What isn’t perhaps obvious from the examples shown on the Deploy reports to the new Reporting Services Instance [AX 2012] page is – How do I publish reports for a specific AOS instance? (The examples shown is for the default instance)

 

When you look at the full syntax of the Publish-AxReports powershell command:

 

You will notice two optional parameters that are of interest, namely:

  • ServicesAOSName
  • ServicesAOSWSDLPort

 

These two parameters are used to “tell” the Publish-AXReports powershell command, which AOS to connect to when publishing reports.

The syntax used for these two parameters are as follow:

  • ServicesAOSName

    This parameter contains the name…

View original post 89 more words

Powershell command to deploy SSRS reports AX 2012

You have to run Power shell Management Shell as Administrator.

1) $reports = Get-AXReport -ReportName *

This power shell scripts helps to get the list of Dynamics Ax 2012 SSRS reports available for deployment.

2) We can also filter the list of report . Dynamics Ax 2012 provide the only two filter options Report Name and changed date. You can use following statement.

$Reports | Select-object Name, ChangedDate

For example if we want all reports similar to ABC classification we can filter something like this

$Reports | Select-object Name, ChangedDate | where { $_.Name -like “ABC*” }

3) If we want to deploy a single requierd report we have to use following statement.

Publish-AxReport -Id SSRSConfigId -ReportName CustTransList

SSRSConfigID will be the machine name.

4) If we have to deploy all reports then we can use following statement.

Publish-AXReport –Id SSRSConfigID –ReportName *

5) Above statement also works if we did not use SSRSConfigID.

Publish-AXReport –ReportName *

Page Break at Nth row in SSRS Report

Page break at nth row in SSRS AX 2012.

SQL Server Rider

We can design a SSRS report with a constraint of only N rows per page. It will be interesting if I explain this with an example.

Scenario

Report developer get a request from team lead saying… Design a simple report with table component and display all rows available in a table x. But, you should show only 10 rows per page in the SSRS report. PS: I am expecting this report to be done with in 15 mins.

The brave report developer just design a report by pulling data to the report without our the 10 rows per page constraint.

I will be showing you that how to display only N rows in the report in this article.

Implementation

Design a report as described in the article. This implementation topic has page break configuration in the report.

Step 1: A simple design to show all rows in a table using table…

View original post 121 more words

Ledger Transactions Import – AX 2012

Tags

, , , , ,

static void LedgerTransImport(Args _args)

{

    Voucher                         voucherNum;

    #define.Name(“Gen”)

    #define.Account(“110180”)

    #define.OffsetAccount(“999999”)

    #define.BusinessUnit(“001”)

    #define.Department(“022”)

    #define.CostCenter(“007”)

    #define.ItemGroup(“Audio”)

    #define.Text(“Test”)

    #define.Currency(“USD”)

    #define.Debit(100)

    #define.Credit(0)

    LedgerJournalName   ledgerJournalName;

    LedgerJournalTable  ledgerJournalTable;

    LedgerJournalTrans  ledgerJournalTrans;

     try

    {

        ttsbegin;

         ledgerJournalName = LedgerJournalName::find(#Name);

         if (ledgerJournalName)

        {

            //Journal header

            ledgerJournalTable.clear();

            ledgerJournalTable.initValue();

 

            ledgerJournalTable.initFromLedgerJournalName(ledgerJournalName.JournalName);

            ledgerJournalTable.JournalNum = NumberSeq::newGetNum(LedgerParameters::numRefJournalNum()).num();

            //ledgerJournalTable.JournalNum = NumberSeq::newGetNum(LedgerParameters::numRefJournalNum()).num();

            ledgerJournalTable.Name = #Description;

             if (ledgerJournalTable.validateWrite())

            {

                ledgerJournalTable.insert();

                 //Journal line

                ledgerJournalTrans.clear();

                ledgerJournalTrans.initValue();

                 ledgerJournalTrans.JournalNum = ledgerJournalTable.JournalNum;

                ledgerJournalTrans.TransDate = systemDateGet();

                voucherNum = new JournalVoucherNum(JournalTableData::newTable(ledgerJournalTable)).getNew(false);

               ledgerJournalTrans.Voucher = #Voucher;

               ledgerJournalTrans.Voucher      = voucherNum;

                ledgerJournalTrans.AccountType = LedgerJournalACType::Ledger;

                ledgerJournalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(

                [strFmt(“%1-%2-%3”, #Account, #BusinessUnit, #Department),

                #Account, 2, “BusinessUnit”, #BusinessUnit, “Department”, #Department]));

                ledgerJournalTrans.OffsetAccountType = LedgerJournalACType::Ledger;

                ledgerJournalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(

                [strFmt(“%1-%2-%3-%4-%5”, #OffsetAccount, #BusinessUnit, #Department, #CostCenter, #ItemGroup),

                #OffsetAccount, 4, “BusinessUnit”, #BusinessUnit, “Department”, #Department, “CostCenter”, #CostCenter, “ItemGroup”, #ItemGroup]));

                 ledgerJournalTrans.Txt = #Text;

                 ledgerJournalTrans.CurrencyCode = #Currency;

                ledgerJournalTrans.AmountCurDebit = #Debit;

                ledgerJournalTrans.AmountCurCredit = #Credit;

                 if (ledgerJournalTrans.validateWrite())

                {

                    ledgerJournalTrans.insert();

                }

                else

                    throw error(“Journal line”);

            }

            else

                throw error(“Journal header”);

        }

        else

            throw error(“Journal name”);

         ttscommit;

    }

    catch

    {

        error(“Error!”);

        return;

    }

     info(“Done!”);

}

SSRS report with RDP framework

Suppose I have a requirement where I have to show data related to one sales id.

Step 1) Create a query SampleSalesTableQuery with SalesTable as datasource and create a temp table with name SampleSalesTmpTable;

Step 2) Create contract class.


 

[DataContractAttribute]
public class SampleSalesContract
{
RecId recordId;

}

[DataMemberAttribute(‘RecordId’)]
public RecId parmRecordId(RecId _recordId = recordId)
{
recordId = _recordId;
return recordId;
}

 

Step 3) Create controller class


 

public class SampleSalesController extends SrsReportRunController
{
#define.reportName(‘ReportName.DesignName’)

SampleSalesContract contract;

SalesTable                 sTable;

}

protected void preRunModifyContract()
{

contract = this.parmReportContract().parmRdpContract() as SampleSalesContract;

sTable = this.parmArgs().record();
contract.parmRecordId(sTable.RecId);

super();

}

public static void main(Args _args)
{
SampleSalesController  formLetterController = new SampleSalesController();

formLetterController.parmArgs(_args);
formLetterController.parmReportName(#ReportName);
formLetterController.parmShowDialog(false);
formLetterController.startOperation();
}

 

Step 4) Create DP class.


 

[
SRSReportParameterAttribute(classStr(SampleSalesContract))
]
public class NTT_FakturPajakDP extends SRSReportDataProviderBase
{

RecId                                                  salesRecId;

SampleSalesTmpTable                       salesTmpTable;

}

 

[SRSReportDataSetAttribute(tableStr(SampleSalesTmpTable))]
public SampleSalesTmpTable getSampleSalesTmpTable()
{
select salesTmpTable;
return salesTmpTable;
}

private void insertSalesTableTmp()
{

//write code to insert data into temp table.

}

[SysEntryPointAttribute(false)]
public void processReport()
{

SampleSalesContract      contract;

Query      q;

QueryRun   qr;

q = new Query(queryStr(SampleSalesTableQuery));

contract = this.parmDataContract() as SampleSalesContract;

salesRecId = contract.parmRecordId();

q.dataSourceTable(tablenum(SalesTable)).addRange(fieldnum(SalesTable, RecId)).value(queryValue(salesRecId));

qr = new QueryRun(q);

while(qr.next())

{

this.insertSalesTableTmp();

}

}

Button enable-disable on Listpageform in AX 2012

Tags

, , ,

Hi All,

Today one of my friend asked me how to do the button enable disable on the form based on the condition of the records . I simply said that either you write it active method or there must be some class written where you have to do the change. Later I found out that it is a listpageform (SalesTableListPage). Most of the new comers dont know how to accomplish such task.

Let me give you small demo how to do it.

I will use the same form (SalesTableListPage) on action pane “Sales Order”, after attachent button, I have to add a button named “Run”.

If the order type is returned then this button should get enabled.

Now if we look at the properties of the form, we can see that class used here is “SalesTableListPageInteraction”. There might be different ways to accomplish this task. I will explain one of them.

Step 1) First I created a button named “RunFormButton” on the form and set the autodeclaration property to yes.

Step 2) There is a method named “selectionChanged()”, here there is a line 

                salesTable = this.currentSalesTable();

                after this line we have the buffer of salesTable, hence we are going to write our code after this.

Step 3) Create new method named setButtonRun(boolean  _run)

             protected void setButtonRun(boolean  _run)

             {

                        this.listPage().actionPaneControlEnabled(formControlStr(SalesTableListPage, RunFormButton), _run);

              }

Step 4) In selectionChanged method find the below code

                   salesTable = this.currentSalesTable();

                after this line we have the buffer of salesTable, add following code into it.

                 if (salesTable.SalesType == SalesType::ReturnItem)

                 {

                            this.setButtonRun(true);

                  }

                   else

                   {

                            this.setButtonRun(false);

                    }

 

Step 5) Run the form and enjoy 🙂

Debug BP errors in Dynamics AX 2012

Hi all,

Very interesting topic it is. 

With Dynamics AX 2012, some new BP errors have been introduced. Often, while fixing BP errors, I turn to the List of Best Practice Error and Warning Messages page on MSDN for help.

But what if you are getting a BP error and there is no clear description on how to fix it. In such scenarios, I always debug the BP error and try to see what is causing this BP error in the first place.

This guy explained it very well, please follow the below link. please  click on the below link or copy and paste in URL to read it in details.

http://microsoft-dynamics-ax-erp.blogspot.in/2012/12/debug-bp-errors-in-dynamics-ax-2012.html

Thanks

Menstrual taboos and ancient wisdom

Sorry to share non-ax content, but this is worth it…..

Mythri Speaks

“Why am I not allowed to visit a temple during my period?”A student sharing her experience

“Will the pickle really spoil if I touched it during menstruation?”

“Akka, why do they tell us not to touch anyone, to sit in a separate room and eat from a separate plate when we get our period?

Two thoughts play hide and seek in my mind as I try to answer these questions from young girls. One, that I should help them understand that these restrictions are not because they become impure or polluted during menstruation. Two, that I should never, ever, hurt their religious or cultural sentiments beacuse I have neither the knowledge nor the right to make that judgement. The latter makes it difficult to do the former, and so round and round I go in my explanations, at best being able to tell them that these practises have been in place for ages to…

View original post 2,477 more words