Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

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

(1) ShareShare
ReportReport
Posted on by 23
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
  • Sathish_Chinnappan Profile Picture
    Sathish_Chinnappan 1,307 on at
    Cannot execute the required database operation. Invalid physical table name specified
    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.
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,642 Super User 2024 Season 2 on at
    Cannot execute the required database operation. Invalid physical table name specified
    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.
  • Nikita Mhamane Profile Picture
    Nikita Mhamane 23 on at
    Cannot execute the required database operation. Invalid physical table name specified
    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)
  • Nikita Mhamane Profile Picture
    Nikita Mhamane 23 on at
    Cannot execute the required database operation. Invalid physical table name specified
    Hello Martin, 
     
    thanks for the reply. I will try this and let you know.
  • Martin Dráb Profile Picture
    Martin Dráb 230,371 Most Valuable Professional on at
    Cannot execute the required database operation. Invalid physical table name specified
    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.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans