web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Cannot execute the required database operation. Invalid physical table name specified

(1) ShareShare
ReportReport
Posted on by 39
I have customized standard Customer account statement report. Now the requirement is, need to send the customized report through email as attachment.
 
On a form by selecting From Date, To Date and customer account from grid, on clicking send email button it should send the report to all the selected customer accounts.
 
But i am getting this error when clicking on Send Email button.
 
I have written the below code by overriding clicked() method of button.
 
[Control(/Button/)]
    class FormEmailButton
    {
        /// <summary>
        /// Clicked method of button.
        /// </summary>
        public void clicked()
        {
            CustAccount accNum;
            TransDate TDate, FDate;
            CustTable custTable1;
            CustTrans custTrans1;
            CustInvoiceTable custInvTable;
            CustAccountStatementExtContract contract = new CustAccountStatementExtContract();
            SrsReportRunImpl srsReportRun;
            ReportName rptName = /GOD_CustAccStatementExt.Report/;
            #SRSFramework
            
            SrsReportRunController    controller = new SrsReportRunController();
            //CustAccountStatementExtController custController = new CustAccountStatementExtController();
            
            SRSPrintDestinationSettings     settings;
            Array                           arrayFiles;
            System.Byte[]                   reportBytes = new System.Byte[0]();
            SRSProxy                        srsProxy;
            SRSReportRunService             srsReportRunService = new SrsReportRunService();
            Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[]  parameterValueArray;
            Map reportParametersMap;
            SRSReportExecutionInfo executionInfo = new SRSReportExecutionInfo();
            ;
            PrintJobHeader printJobHeader;
            DocuRef docuRef;
            DocuValue docuValue;
            str TDay;
            date Today;
            ;
            
            super();
            FDate = GOD_FromDateSelected.dateValue();
            TDate = GOD_ToDateSelected.dateValue();
            contract = new CustAccountStatementExtContract();
            for(custTable1 = getFirstSelection(CustTable_ds); custTable1; custTable1 = CustTable_ds.getNext())
            {
                PDFName = strFmt(/%1/,custTable1.AccountNum + /_/ +custTable1.BankAccount); //trFmt(@'C://Temp////%1.pdf ',custTable1.AccountNum);
                contract.parmCustAccount(custTable1.AccountNum);
                contract.parmFromDate(FDate);
                contract.parmToDate(TDate);
                controller.parmReportName(ssrsReportStr(GOD_CustAccStatementExt,Report));
               
                controller.parmShowDialog(false);
                controller.parmLoadFromSysLastValue(false);
                controller.parmReportContract().parmRdpContract(contract);
  
                settings = controller.parmReportContract().parmPrintSettings();
                settings.printMediumType(SRSPrintMediumType::Archive);
                settings.fileName(PDFName);
                settings.fileFormat(SRSReportFileFormat::PDF);
                
                controller.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration());
                controller.parmReportContract().parmReportExecutionInfo(executionInfo);
                
                
                srsReportRunService.getReportDataContract(controller.parmreportcontract().parmReportName());
                srsReportRunService.preRunReport(controller.parmreportcontract());
                reportParametersMap = srsReportRunService.createParamMapFromContract(controller.parmReportContract());
                parameterValueArray =SrsReportRunUtil::getParameterValueArray(reportParametersMap);
                srsProxy =SRSProxy::constructWithConfiguration(controller.parmReportContract().parmReportServerConfig());
               
                reportBytes = srsproxy.renderReportToByteArray(controller.parmreportcontract().parmreportpath(),
                                              parameterValueArray,
                                              settings.fileFormat(),
                                              settings.deviceinfo());
            }
 
 
It is throwing the exception for this line :  srsReportRunService.preRunReport(controller.parmreportcontract());
 
please help me to get this resolved
I have the same question (0)
  • Martin Dráb Profile Picture
    238,789 Most Valuable Professional on at
    As you see, knowing just that something goes wrong in some code called inside preRunReport() didn't allow you to identify the problem, therefore you'll need to do more work on debugging. You should find the place where the exception is thrown.
     
    For example, you may be able to look at StackTrace property of the exception, or you can walk through code in preRunReport() in debugger (then you'll need debugging enabled for Application Foundation package).

    It sounds like a problem with a TempDB table to me.
  • Nikita Mhamane Profile Picture
    39 on at
    Hello Martin, 
     
    thanks for the reply. I will try this and let you know.
  • Nikita Mhamane Profile Picture
    39 on at
    Hello Martin,
     
    I got the following stackTrace for the exception, can you help me understand this?
     
    Microsoft.Dynamics.Ax.Xpp.ErrorException
      HResult=0x80131500
      Message=Cannot execute the required database operation.
    Invalid physical table name specified
      Source=aoskernel
      StackTrace:
       at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue, interpret* ip)
       at Microsoft.Dynamics.Ax.MSIL.cqlCursorIL.useExistingTempDBTable(IntPtr table, String _name)
       at Microsoft.Dynamics.Ax.Xpp.Common.useExistingTempDBTable(String _newValue)
       at Dynamics.AX.Application.CustAccountStatementExtDP.`processReport() in xppSource://Source/Foundation\AxClass_CustAccountStatementExtDP.xpp:line 254
       at Dynamics.AX.Application.CustAccountStatementExtDP.processReport()
       at Dynamics.AX.Application.SrsReportRunRdpPreProcessStrategyTempDB.`execute(Boolean _isPreview, Boolean @_isPreview_IsDefaultSet) in xppSource://Source/ApplicationFoundation\AxClass_SrsReportRunRdpPreProcessStrategyTempDB.xpp:line 120
       at Dynamics.AX.Application.SrsReportRunRdpPreProcessStrategyTempDB.execute(Boolean _isPreview, Boolean @_isPreview_IsDefaultSet)
       at Dynamics.AX.Application.SrsReportRunRdpPreProcessStrategyTempDB.execute(Boolean _isPreview)
       at Dynamics.AX.Application.SrsReportRunRdpPreProcessService.initAndExecutePreProcessStrategy(Boolean _isPreviewData) in xppSource://Source/ApplicationFoundation\AxClass_SrsReportRunRdpPreProcessService.xpp:line 147
       at Dynamics.AX.Application.SrsReportRunRdpPreProcessService.`executeWithContract(SrsReportDataContract _reportContract, Int64 _preProcessedRecId, SrsReportDataProviderPreProcessInterface _rdpInstance, Boolean _isPreviewData, Boolean @_preProcessedRecId_IsDefaultSet, Boolean @_rdpInstance_IsDefaultSet, Boolean @_isPreviewData_IsDefaultSet) in xppSource://Source/ApplicationFoundation\AxClass_SrsReportRunRdpPreProcessService.xpp:line 136
       at Dynamics.AX.Application.SrsReportRunRdpPreProcessService.executeWithContract(SrsReportDataContract _reportContract, Int64 _preProcessedRecId, SrsReportDataProviderPreProcessInterface _rdpInstance, Boolean _isPreviewData, Boolean @_preProcessedRecId_IsDefaultSet, Boolean @_rdpInstance_IsDefaultSet, Boolean @_isPreviewData_IsDefaultSet)
       at Dynamics.AX.Application.SrsReportRunRdpPreProcessService.executeWithContract(SrsReportDataContract _reportContract, Int64 _preProcessedRecId)
       at Dynamics.AX.Application.SrsReportRunService.executeRdpPreProcessServiceAsynchronously(Object[] parameters) in xppSource://Source/ApplicationFoundation\AxClass_SrsReportRunService.xpp:line 588
       at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)
  • André Arnaud de Calavon Profile Picture
    303,390 Super User 2026 Season 1 on at
    Hi Nikita,
     
    With the latest provided information, we can't help you. The stack trace is a confirmation that it is related to a temporary table. As suggested by Martin, you would need to use the debugger to find out the exact culprit.
  • Sathish_Chinnappan Profile Picture
    1,318 on at
    Have you able to fix the issue?

    I can send email with customer statement pdf with no customer statement content. However, the content does exist by manually with the same parameters.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 512 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 386

#3
Adis Profile Picture

Adis 259 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans