cancel
Showing results for 
Search instead for 
Did you mean: 

By pass parameter confirmation Crystal Reports Viewer with JSP

Former Member
0 Kudos

Hi all, I have a problem with load the RPT Crystal Reports with JSP. I had successed for send parameter from SAPUI5 to JSP Crystal Reports Viewer, but when I send the parameter with clicking the button in SAPUI5, not directly open the crystal reports viewer. when I clicking the button, show the confirmation for parameter like picture below.

How to by pass the confirmation parameter? I had search the function which related with this case, but I not find. is it posibble? I want process without the confirmation parameter. Thanks advanced.

Regards,

Bobby

CrystalReportParameter.jsp

<%
try {
CrystalReportViewer viewer = new CrystalReportViewer();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

String name = request.getParameter("name");
String value = request.getParameter("value");
String [] result_value = value.split("~");

ConnectionInfos oConnectionInfos = new ConnectionInfos();
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(name, 0); // OpenReportOptions._openAsReadOnly

ParameterFieldController paramFieldController = reportClientDoc
.getDataDefController().getParameterFieldController();
for (int i=0;i<result_value.length;i+=3){
if (result_value[i+2].equals("1")){
paramFieldController.setCurrentValue("", result_value[i], new String(result_value[i+1]));
}else if (result_value[i+2].equals("2")){
paramFieldController.setCurrentValue("", result_value[i], Integer.parseInt(result_value[i+1]));
}else if (result_value[i+2].equals("3")){
paramFieldController.setCurrentValue("", result_value[i], formatter.parse(result_value[i+1]));
}
}

//Store the report source in session, will be used by the CrystalReportViewer.
session.setAttribute("reportSource", reportClientDoc.getReportSource());
response.sendRedirect("/NCB-Taspen-Report/CrystalReportViewer.jsp");
}
catch(ReportSDKException ex) {
out.println("ReportSDKException: "+ex);
}
catch(Exception ex) {
out.println("Exception: "+ex);
}
%>

CrystalReportViewer.jsp

<%
try {
CrystalReportViewer viewer = new CrystalReportViewer();
ReportServerControl rsc = new ReportServerControl();
ReportClientDocument reportClientDoc = new ReportClientDocument();

viewer.setOwnPage(true);
viewer.setPrintMode(CrPrintMode.PDF);
//Get the report source object that this viewer will be displaying.
Object reportSource = session.getAttribute("reportSource");

//viewer.setParameterFields(parameterFields); 
viewer.setReportSource(reportSource);
viewer.setEnableLogonPrompt(false);

ConnectionInfos connInfos = new ConnectionInfos();
    IConnectionInfo connInfo1 = new ConnectionInfo();
    connInfo1.setUserName("myusername");            // We use the right user
    connInfo1.setPassword("mypassword");  // And the right password
    connInfos.add(connInfo1);

    viewer.setDatabaseLogonInfos(connInfos);
    viewer.refresh();

//Render the report.
viewer.processHttpRequest(request, response, application, null);
} catch (Exception e) {
System.out.println("ReportSDKException: "+e);
}
%>

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

What version and SDK are you using?

Answers (0)