11 Temmuz 2014 Cuma

AX 2012 - Send marked records to SSRS RDP Report

SSRS DP Class don't accept table or container data types as parm method. I searched at forums and saw str data type adviced. But I think this's not best approach. At last learned best way already in standard AX SSRS reports. At this link there's a PDF file tells look for check report. I generated this report with look form ChequeDP and ChequeController classes:

Controller class:

class declaration:

class myController extends SrsReportRunController
{
    #define.ReportName('myreport.Report')
   myTMPTable   myTMPTable;
}

public static void main(Args _args)
{
    SysLastValue    SysLastValue;
    myController controller = new myController();
    controller.parmReportName(#ReportName);
    controller.parmArgs(_args);
    controller.DeleteTmpData();
    controller.init();
    controller.startOperation();
}


protected void prePromptModifyContract()
{

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

    new SRSReportRunPermission().assert();
    contract.parmTmpTableDataRecId(SRSTmpTblMarshaller::SendTmpTblToDataProvider(myTMPTable));

}


public void init()
{
    FormDataSource      ds;
    TransDate           transDate;
    VendTrans           vendTrans;


    if (!this.parmArgs()             ||
        !this.parmArgs().record()    ||
        this.parmArgs().dataset() != tableNum(VendTrans))
        throw error("Report should be call with correct parameter!..");

    ds = this.parmArgs().record().dataSource();

    vendTrans = ds.getFirst(1);
    transDate = vendTrans.transDate;
    PaymentReceipt.VendAccount = vendTrans.AccountNum;

    for (vendTrans = ds.getFirst(1); vendTrans != null; vendTrans = ds.getNext())
    {
        myTMPTable.Date             = vendTrans.TransDate;

...
        myTMPTable.insert();
    }
}


DP Class:

// <ETG - memre > GN:   T: 11.07.2014 A:
[SRSReportParameterAttribute(classStr(SrsTmpTblMarshallerContract))]
public class mpDP extends SRSReportDataProviderBase
{
    myTMPTAble myTMPTable;
}


private void initTmpTable()
{
    SrsTmpTblMarshallerContract contract = this.parmDataContract() as SrsTmpTblMarshallerContract;

    new SRSReportRunPermission().assert();

    myTMPTable = SRSTmpTblMarshaller::getTmpTbl(contract.parmTmpTableDataRecId());

    SRSTmpTblMarshaller::deleteTmpTblData(contract.parmTmpTableDataRecId());
    CodeAccessPermission::revertAssert();
}


public void processReport()
{

    CompanyInfo                 Company;
    VendTable                   vendTable;
    AmountMST                   amount;
    TempStr                     NumtoTxt;
    LedgerJournalTrans          LedgerTrans;

    this.initTmpTable();

...
}

1 yorum:

  1. hello,
    Facing the following error while cheque printing:
    -----------------------------------------------------------
    SrsTmpTblMarshallerContract object not initialized.

    Stack trace

    (C)\Classes\ChequeController\preRunModifyContract - line 10
    (C)\Classes\SrsReportRunController\runReport - line 31
    (C)\Classes\SrsReportRunController\run - line 6
    (C)\Classes\SysOperationController\startOperation - line 10
    (C)\Classes\SrsReportRunController\startOperation - line 12
    (C)\Classes\ChequeController\main - line 8
    (C)\Classes\xMenuFunction\runClient
    (S)\Classes\MenuFunction\runClient - line 18
    (S)\Classes\MenuFunction\runSSRSMenuItem - line 8
    (S)\Classes\MenuFunction\run - line 70
    (S)\Classes\BankChequePrint\runReport - line 11
    (S)\Classes\BankChequePrint\printDocument - line 10
    (S)\Classes\VendOutPaym_Cheque\printDocument - line 46
    (S)\Classes\VendOutPaym_Cheque\close - line 39
    (S)\Classes\CustVendSumForPaym\run - line 75
    (S)\Classes\VendSumForPaym\main - line 23
    (S)\Classes\xMenuFunction\runServer
    (C)\Classes\FormFunctionButtonControl\Clicked
    (C)\Forms\LedgerJournalTransVendPaym\Designs\DesignList\buttonCreatePayment\Methods\Clicked - line 23
    -----------------------------------------------------------

    The code in preRunModifyContract is same as you mentioned.

    Thanks

    YanıtlaSil