Skip to Content
avatar image
Former Member

CrystalReportViewer - Setting parameter throws ancestor error on page navigation

We are having web application reports in the application using BO-XI SDK Viewer API. This API approach was working fine earlier. We upgrade our reporting component to SAP BO-4 (Crystal Server 2011) due to EOL of BOXI.

We have updated new API’s provided by SAP as per guide.

We updated web based Crystal Report Viewer (DHTML Viewer). The crystalreportviewer folder coming with SAP CS 2011.

We applied updated patch set upto last patch released CS2011 SP4 Patch4.

We still facing issue while viewing report in DHTML viewer provided by SAP. Please advice on below.

In our web application we do have updated folder for /crystalreportviewer.

We dynamically creating enterprise session object to get client document which explained as below –

IEnterpriseSession es = null;

try{

es = sm.logon(mUser, mPassword, mAPSName, mAuthType);

}catch(Exception e){

// request dispatched to error page
}

// Get the Report Application Factory service from Crystal Enterprise

IReportAppFactory rptAppFactory = (IReportAppFactory)es.getService("", "RASReportService");

// Get the InfoStore service from Crystal Enterprise

IInfoStore infoStore = (IInfoStore)es.getService("", "InfoStore");

IInfoObjects oInfoObjects = infoStore.query(“Select * From CI_INFOOBJECTS…for RPT File.”);

ReportClientDocument clientDoc = rptAppFactory.openDocument((IInfoObject)oInfoObjects.get(0), 0, objLocale);

Setting parameter

// Setting Parameter to clientDoc

Object[] parameters = { 

                                                parseDate(fromDate),

                                                parseDate(endDate),

                                                getLanguageID(request),

                                                reportName,

                                                getLanguageID(request)

                                };                                             

Fields parameterFields = clientDoc.getDataDefController().getDataDefinition().getParameterFields();

for(int index=0; index < parameters.length; index++){

                ParameterField oldParameter = (ParameterField)parameterFields.getField(index);

                ParameterField newParameter = (ParameterField) oldParameter.clone(true);

                newParameter.getCurrentValues().removeAllElements();                                                   

                ParameterFieldDiscreteValue newDiscreteValueObj = new ParameterFieldDiscreteValue();

                newDiscreteValueObj.setValue(parameters[index]);

                newParameter.getCurrentValues().add(newDiscreteValueObj);

                ParameterFieldController paramController = clientDoc.getDataDefController().getParameterFieldController();

                paramController.modify(oldParameter, newParameter);

}

// Create an  Viewer

CrystalReportViewer viewer = new CrystalReportViewer();

//Set the name for the interactive viewer

  • viewer.setName("Crystal_Report_Viewer");
  • viewer.setDisplayPage(true);

//Set Navigation button false

  • viewer.setHasHistoryNavigationButtons(false);

//Set best fit to page true

  • viewer.setBestFitPage(true);

// Set reuse parameter on referesh

  • viewer.setReuseParameterValuesOnRefresh(true);

// Set Own Page true

  • viewer.setOwnPage(true);

// Enabled export and print button

  • viewer.setHasExportButton(true);
  • viewer.setHasPrintButton(true);

// Group Tree Removed

  • viewer.setDisplayGroupTree(false);

// Toggle group false

  • viewer.setHasToggleGroupTreeButton(false);

//viewer.refresh();

// Removed refersh button

  • viewer.setHasRefreshButton(false);
  • viewer.setPrintMode(CrPrintMode.ACTIVEX);

// Set the source for the interactive viewer to the client documents report source

  • viewer.setReportSource(clientDoc.getReportSource());

// Retain parameter and set again for pagination in viewer

setReportURL(viewer,request);

// Process the http request to view the report

  • viewer.processHttpRequest(request, response, getServletConfig().getServletContext(), out);

//response.flushBuffer();

// Close client document

  1. clientDoc.close();

// Dispose of the viewer object

  • viewer.dispose();
  1. es.logoff();

Issue we faced?

a) On Pagination thorws exception in webreportinglog as


[@APPNAME@] ERROR [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] WebReportLogger.error(62) | Unable to set the ancestors

  1. com.businessobjects.report.web.json.JSONException: JSONObject["ancestors"] is not a JSONArray.

                at com.businessobjects.report.web.json.JSONObject.getJSONArray(JSONObject.java:456)

                at com.businessobjects.report.web.shared.JSONParameter.getDiscreteValueFromJSON(JSONParameter.java:670)

                at com.businessobjects.report.web.shared.JSONParameter.getValueFromJSON(JSONParameter.java:609)

                at com.businessobjects.report.web.shared.JSONParameter.jsonToDefaultFieldValues(JSONParameter.java:587)

                at com.businessobjects.report.web.shared.JSONParameter.getDefaultValues(JSONParameter.java:474)

                at com.businessobjects.report.web.shared.JSONParameter.toParameterField(JSONParameter.java:872)

                at com.businessobjects.report.web.shared.ParametersHelper.jsonToFields(ParametersHelper.java:309)

                at com.businessobjects.report.web.state.ViewerState.restoreCommonState(ViewerState.java:2838)

                at com.businessobjects.report.web.state.ViewerState.restore(ViewerState.java:2741)

                at com.businessobjects.report.web.component.ViewerContainer.restoreState(ViewerContainer.java:210)

                at com.businessobjects.report.web.WorkflowController.loadViewState(WorkflowController.java:418)

                at com.businessobjects.report.web.WorkflowController.init(WorkflowController.java:393)

b) On Export / print button nothing happened even request didn’t passed.

WEB-INF/web.xml entry as below.

<?xml version="1.0"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

               

                <context-param>

        <param-name>crystal_document_view</param-name>

                                <!-- weblayout : Fills the entire report view pane with the report. There is no grey background -->

        <param-value>weblayout</param-value>

                </context-param>

               

                <context-param>

                                <param-name>crystal_exception_log_file</param-name>

                                <param-value>webreportingexception.log</param-value>

                </context-param>

                <context-param>

        <param-name>crystal_exception_info</param-name>

                                <!-- long - Displays the exception information with the accompanying stack trace. -->

        <param-value>long</param-value>

                </context-param>

                <context-param>

                                <param-name>crystal_image_uri</param-name>

                                <param-value>/TangibleWebApp/crystalreportviewers</param-value>

                </context-param>

                <context-param>

        <param-name>crystal_image_use_relative</param-name>

        <param-value>webapp</param-value>

                </context-param>

                <context-param>

                                <param-name>crystal_processing_indicator_delay</param-name>

                                <param-value>100</param-value>

                </context-param>

                <context-param>

                                <param-name>crystal_use_asynchronous_requests</param-name>

                                <param-value>false</param-value>

                </context-param>

                <context-param>

                                <param-name>crystal_servlet_uri</param-name>

                                <param-value>/TangibleWebApp/CrystalReportViewerHandler</param-value>

                </context-param>

                <servlet>

        <servlet-name>CrystalReportViewerServlet</servlet-name>

        <servlet-class>com.crystaldecisions.report.web.viewer.CrystalReportViewerServlet</servlet-class>

                </servlet>

                <servlet-mapping>

                                <servlet-name>CrystalReportViewerServlet</servlet-name>

                                <url-pattern>/TangibleWebApp/CrystalReportViewerHandler</url-pattern>

                </servlet-mapping>

               

                <servlet>

                                <servlet-name>document</servlet-name>

                                <servlet-class>com.oreilly.servlet.OpenDoc</servlet-class>

                </servlet>

                <servlet>

                                <servlet-name>InitialServlet</servlet-name>

                                <servlet-class>com.servlet.InitialServlet</servlet-class>

                                <load-on-startup>1</load-on-startup>

                </servlet>

               

                <servlet>

                                <servlet-name>FactorsLogo</servlet-name>

                                <servlet-class>com.servlet.FactorsLogo</servlet-class>

                </servlet>

               

                <servlet-mapping>

                                <servlet-name>FactorsLogo</servlet-name>

                                <url-pattern>/servlet/FactorsLogo</url-pattern>

                </servlet-mapping>

               

                <servlet-mapping>

                                <servlet-name>document</servlet-name>

                                <url-pattern>/servlet/document</url-pattern>

                </servlet-mapping>

                <session-config>

                                <session-timeout>30</session-timeout>

                </session-config>

               

                <welcome-file-list>

                                <welcome-file>/tangible/index.jsp</welcome-file>

                </welcome-file-list>

               

                <listener>

                                <listener-class>com.common.util.applistener.AppListener</listener-class> 

                </listener>

</web-app>

Thanks in advance for your advice / suggestions.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 18, 2012 at 08:20 PM

    Am I right in guessing that you were previously using the ActiveX viewer?

    Currently your code is closing the document and logging off Enterprise.  Pretty much any action that is done in the DHTML viewer will cause a postback to the server which will no longer have the document or session available with your current code which will cause all sorts of problems.  You need to persist these objects, and only clean them up once you are completely finished with them.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 10, 2013 at 09:47 AM

    Hi! Nilesh More, I also encountered the same problem, did you solved the problem, this is caused by what, can you tell me about your solution, thank you very much!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 22, 2015 at 01:28 PM

    Hello All,

    I am also facing same pagination exception. Could someone help me on it to get it resolve.

    Thanks

    Add comment
    10|10000 characters needed characters exceeded