Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

BO相关的报表开发项目中,一般使用BusinessObject Enterprise SDK来进行开发,这样可以更方便、快捷、高效。    BusinessObject Enterprise SDK(SDK.NETJAVA两个版本,本文介绍JAVA版本)SAP公司提供的一套用来开发BO相关项目的一套API,可以实现与InfoView相似功能的开发。可以实现认证、用户和对象安全、计划、发布、服务器的管理和审计(Audit)、管理报表文档及各种对象的功能,还可以实现多个BO Server之间的协作,具有丰富的本地化语言包。本文主要讲述,如何使用BusinessObject Enterprise SDK进行开发,可以使用这种方式集成到WEB项目中。如果想实现其它更丰富的功能,请使用相关的SDK

    •Enterprise SDK – With the Enterprise SDK, you can create Java, .NET, or ASP web portal applications, view all report types, use report creation and modification APIs, manage users, instances, groups, custom programs and events, and access security and scalability features.


    •Report Application Server (RAS) SDK – Use when you want to create and modify Crystal reports at runtime, push data into reports with ResultSets, RecordSets, DataSets, POJOs, or Object Collections, and/or change your database at runtime (for example, from a development to production database). NOTE that if you do not need to modify reports at runtime, then it is recommended that you use the Page Server for optimal performance when viewing reports.


    •Universe Designer SDK– Use this SDK to create and modify Universes using COM components.


    •Desktop Intelligence SDK – Use this SDK to automate Desktop Intelligence documents. You can create VBA macros that encapsulate common commands and functions to run inside Desktop Intelligence applications, create plug-ins to add optional commands, features, and data sources, and implement custom events that run when runtime events are triggered.


     • Report Engine SDK – The Report Engine SDK is available in .NET (RENET) and Java (REBEAN) and is used to view Desktop Intelligence and Web Intelligence documents. Use the Interactive Editor Integration sample for easier integration into custom viewing applications. For user authentication and security, use the Enterprise SDK.


     •Viewers SDK – Use when you want to view Crystal reports instances or templates. The Viewers SDK is available in Java, .NET, and COM APIs and handles common viewing scenarios such as paging, exporting, searching, drilling-down, and printing, and common exporting scenarious such as PDF and Microsoft Office. This SDK also handles prompting and filtering – you can either allow the viewer to prompt users or you can set the values yourself in your application.

       配置WEB项目中BusinessObject Enterprise SDK的开发使用环境:

       1、将BusinessObject Enterprise SDK所需的Lib (jar)文件拷贝至web项目的lib(一般在WEB-INF\lib)中,包括两部分:

         (1)进行BusinessObject Enterprise SDK开发所必须的包位于BusinessObject的安装文件夹下Business Objects\common\4.0\java\lib(:C:\Program Files\Business Objects\common\4.0\java\lib)位置,所需的JAR包为:

·         biarengine.jar

·         biplugins.jar

·         cecore.jar

·         celib.jar

·         ceplugins_client.jar

·         ceplugins_core.jar

·         ceplugins_cr.jar

·         cereports.jar

·         cesession.jar

·         ceutils.jar

·         corbaidl.jar

·         ebus405.jar

·         flash.jar

·         SL_plugins.jar

·         logging.jar

·         pluginhelper.jar

·         xcelsius.jar

    (2)以上核心Lib所需的依赖库文件,位于Business Objects\common\4.0\java\lib\external中,具体文件为:

     

   如需实现BusinessObject Enterprise SDK之外其它的功能,如RAS或者VIEWER请拷贝相关的LIB到指定位置

   如需要登录cmssap的方式,请在cms下的应用中找到secSAPR3.jar,加到项目的LIB中,否则将会报plugin secSAPR3 not exist错误。

在上篇文章中对BusinessObject Enterprise SDK及相关的SDK进行了简单的介绍及环境配置中的LIB配置,在本文中主要讲述web.xml文件的配置:

     2Web项目中的web.xml文件配置:

     web.xml中可以配置的参数及其功能描述为(如想直接操作,可以跳至本文最后示例部分😞

        

crystal_document_view

Sets the view type of the report view pane.

crystal_exception_info

Allows you to display exception information

crystal_exception_log_file

Allows you to log exception information

crystal_image_uri

Sets the location of the crystalreportsviewers directory in your web application

crystal_image_use_relative

Sets the interpretation of the crystal_image_uri to be relative to the web page, application, or server

crystal_max_number_parameter_default_values

Sets the default number of values that will be returned in a list.

crystal_processing_indicator_delay

Enables the Report Processing Indicator

crystal_processing_indicator_text

Modifies the text displayed by the Report Processing Indicator

crystal_use_asynchronous_requests

Enables asynchronous requests.

CrystalReportViewerServlet

Allows you to view the parameter panel in your web application, handles report exporting, interactive parameters, images, and charts

Faces Servlet

Enables the use of JavaServer Faces (JSF) components in your web application

  

crystal_document_view

Sets the view type of the report view pane. The crystal_document_view parameter value can be set to one of the following values:

·         printlayout - Displays a grey background behind the report with a dropdown shadow cast by the report page. Shows the page layout of the report when printed.

·         weblayout - Fills the entire report view pane with the report. There is no grey background.

Note: If the crystal_document_view parameter is not specified, it is set to printlayout by default.

<context-param>

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

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

</context-param>

crystal_exception_info

Allows you to display exception information. If you do not display exception information you can still log the exception information if you use the crystal_exception_log_file setting. The crystal_exception_info parameter value can be set to one of the following values:

·         short - Displays the exception information without the accompanying stack trace.

·         long - Displays the exception information with the accompanying stack trace.

·         disable - Exception information is not displayed. The user must handle the exception.

Note: If the crystal_exception_info parameter is not specified, it is set to short by default.

<context-param>

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

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

</context-param>

crystal_exception_log_file

Allows you to log exception information. The parameter value specifies the location of the log file. Regardless of the setting of the crystal_exception_info parameter, the exception information output to the log file will be in the long format.

Note: By default, exceptions are not logged.

<context-param>

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

        <param-value>c:\temp\webreportingexception.log</param-value>

</context-param>

crystal_image_uri

Sets the location of the crystalreportsviewers directory in your web application. This setting must be included in the web.xml file if you are using a report viewer in your web application. The crystalreportviewers directory contains all files required by the viewer.

<context-param>

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

         <param-value>/web_application_name/crystalreportviewers</param-value>

</context-param>

crystal_image_use_relative

Sets the interpretation of the crystal_image_uri to be relative to the web page, application, or server. The parameter value can be set to one of the following values:

·         webapp - Sets the uri as relative to the web application directory.

·         server - Sets the uri as relative to the server root.

·         Page - Sets the uri is relative to the page from which the resources in the crystalreportviewers directory are requested.

<context-param>

        <param-name>crystal_image_use_relative</param_name>

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

</context-param>

crystal_max_number_parameter_default_values

By default, the Java DHTML viewers return a maximum of 200 values per list at a time. The crystal_max_number_parameter_default_values parameter value overrides this default size. If a list exceeds the default size of 200, or the number set by this parameter, a link to the remaining values is displayed.

<context-param>

         <param-name>crystal_max_number_parameter_default_values</param-name>

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

</context-param>

crystal_processing_indicator_delay

The Report Processing Indicator will present specific feedback regarding both general processing status and print processing status. By default, the Report Processing Indicator will display for any postback action longer than 500 ms. The crystal_processing_indicator_delay parameter value overwrites the default delay of 500 ms. You can specify any non-negative number in milliseconds. When the parameter value is set to 0, the report processing indicator is disabled.

Note: This feature works only when using a Java DHTML viewer. This feature is currently implemented only for Internet Explorer browsers.

<context-param>

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

        <param-value>0</param-value>

</context-param>

<context-param>

        <param-name>crystal_processing_indicator_text</param-name>

               <param-value>some text</param-value>

</context-param>

crystal_processing_indicator_text

The Report Processing Indicator will present specific feedback regarding both general processing status and print processing status. The crystal_processing_indicator_text parameter value modifies the text displayed by the Report Processing Indicator.

Note: This feature works only when using a Java DHTML viewer. This feature is currently implemented only for Internet Explorer browsers.

<context-param>

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

        <param-value>0</param-value>

</context-param>

<context-param>

        <param-name>crystal_processing_indicator_text</param-name>

              <param-value>some text</param-value>

</context-param>

crystal_use_asynchronous_requests

By default, asynchronous requests are permitted within the DHTML viewer. If you wish to enable the Back button in the user's browser to work with the DHTML viewer, you must disable asynchronous requests by setting this parameter to false.

Note: It is recommended that you do not set the crystal_use_asynchronous_requests parameter to false. Doing so will disable some viewer performance enhancemenets and enhanced appearance features.

<context-param>

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

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

</context-param>

CrystalReportViewerServlet

The CrystalReportViewerServlet allows you to view the parameter panel in your web application. The servlet allows the Java DHTML viewers to export and print when the viewers are embedded in other content. The servlet also handles interactive parameters, images, and charts. This setting must be included in the web.xml file if you are using a report viewer in your web application.

<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>/CrystalReportViewerHandler</url-pattern>

</servlet-mapping>

Faces Servlet

Enables the use of JavaServer Faces (JSF) components in your web application. This setting must be included in the web.xml file if you are using JSF components or beans in your web application.

·         load-on-startup - When the value is set to 0, the servlet does not load on startup. When the value is set to 1, the servlet loads on startup.

·         url-pattern – Sets the path to the Faces Servlet.

·         javax.faces.application.CONFIG_FILES parameter value – Sets the location of the faces-config.xml file. You must create this file when setting up a JSF project. For more information see:

<listener>

     <listener-class>com.sun.faces.config.ConfigureListener</listener-class>

</listener>

<servlet>

        <servlet-name>Faces Servlet</servlet-name>

        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

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

</servlet>

<servlet-mapping>

        <servlet-name>Faces Servlet</servlet-name>

        <url-pattern>*.faces</url-pattern>

</servlet-mapping> 

<context-param>

        <param-name>javax.faces.application.CONFIG_FILES</param-name>

<param-value>/WEB-INF/faces-config.xml</param-value>

</context-param>

     一般项目中只需简单作如下配置即可,(如果使用BusinessObject Enterprise SDK,可以不进行任何配置😞

     <?xml version="1.0" encoding="ISO-8859-1"?>
<!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>
<display-name>web_application_name</display-name>
        <context-param>
                   <param-name>crystal_image_uri</param-name><!--viewer
中图片位置
-->
                   <param-value>/web_application_name/crystalreportviewers</param-value>
       </context-param>
        <context-param>
                <param-name>crystal_servlet_uri</param-name>
                <param-value>/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>/CrystalReportViewerHandler</url-pattern>
        </servlet-mapping>
</web-app>

     如使用RASViewer其它的功能,请参见相关配置。

在一般的BO项目开发中,为了更快速的进行项目的周期性的开发,通常使用这样的开发方式:

          登录CMS认证,认证完毕,获得TOKEN(所谓的TOKEN就是一个凭证,类似唐僧的通关文碟,有了这个东西,只要带着它,可以畅行无阻),在后面的开发中,都是通过OpenDocument的方式来直接使用InfoView中的功能,在打开报表时,带着这个TOKEN,就不需要在Cms中再次认证(报表文件的数据源的证证,可以在CMS中设置)

   

     本文主要讲述认证的过程,先介绍这个过程中使用的几个类:

       com.crystaldecisions.sdk.framework.CrystalEnterprise  用于获取很多可用对象,包括本文中的ISessionMgr

       com.crystaldecisions.sdk.framework.ISessionMgr          会话管理器

       com.crystaldecisions.sdk.framework.IEnterpriseSession企业级会话

      登录使用的安全协议(Security protocols): 

        com.crystaldecisions.sdk.plugin.authentication.enterprise.IsecEnterprise 企业级

        com.crystaldecisions.sdk.plugin.authentication.ldap.IsecLDAP                   LDAP方式

        com.crystaldecisions.sdk.plugin.authentication.secwinnt.IsecWinNT          window系统登录

        com.crystaldecisions.sdk.plugin.authentication.secwinad.IsecWinAD         window动态目录

     

     下面的例子展示如何认证:

        <%@ page contentType="text/html; charset=GBK" language="java"%>
        <%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr"%>
        <%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise"%>
        <%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession"%>
        <%@ page import="com.crystaldecisions.sdk.occa.security.ILogonTokenMgr"%>
            try {

                  //CMS服务器名,也可以是IP地址
                 String cms = "10.16.11.83:6400";

                  //认证的安全类型,类型是以上几种,如果是SAP,则类型字符为secSAPR3

                 String authentication = "secEnterprise";

                  //用户名,如果是SAP系统方式登录,格式为bwp~888/eiacext1
                 String username ="username";


                 String password = "password";//
密码
                

               //登录并获得TOKEN,并命名用OpenDocument方式打开一个文件

                ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
                IEnterpriseSession enterpriseSession = sessionMgr.logon(  username, password, cms + ":6400", authentication);
                ILogonTokenMgr mgr = enterpriseSession.getLogonTokenMgr();
                String defaultToken = mgr.getDefaultToken();

                session.setAttribute("token",defaultToken);
                String url = "
http://10.16.11.83:8080/OpenDocument/opendoc/openDocument.jsp?iDocID=8797&sType=rpt&token="+defaultT...
;
                response.sendRedirect(url);
              }catch(SDKException ex){
                      throw new Error("A error has occured :"+ex.getLocalizedMessage());
              }

         

         其中winNT的方式WEB中不支持,可以通过ISessionMgr.getInstalledAuthIDs的方法或者登录安全方式字符串,分别为:

              secEnterprise

              secWinAD

              secLDAP

              secSAPR3

1 Comment
Labels in this area