on 10-06-2017 8:45 AM - last edited on 02-04-2024 12:03 AM by postmig_api_4
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);
}
%>
What version and SDK are you using?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.