SAP Knowledge Base Article - Public

1803967 - How to make a Java UFL available in Crystal Reports Designer?

Symptom

  • Java UFLs functions are not visible in the Crystal Reports Designer Formula Editor.
  • How to make a Java UFL available in Crystal Reports Designer?

Environment

  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020

Reproducing the Issue

  1. Start Crystal Reports Designer
  2. Create a new blank Report
  3. Create a new Formula
  4. Could not find Custom Java UFL in Formula Editor 

Cause

Crystal Reports Designer is not configured for Java UFL

Resolution

Important steps to follow:

  1. Copy Java UFL jar to “C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\”
  2. Create a System Environment Variable "JAVA_HOME"
            Variable: JAVA_HOME
            Value: C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\jdk
  3.  Create the System Environment Variable "CLASSPATH"
    Both the java runtime classes and u211java.jar as well as any UFL classes used need to be on the classpath. 
  4. All jar file need to be included in CLASSPATH below:
           C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\external\
               commons-collections-3.1.jar 
               commons-configuration-1.2.jar 
               commons-lang-2.1.jar 
               commons-logging.jar
               icu4j.jar
           C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib\external
               log4j.jar
           C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib
              CrystalFormulas.jar
              CrystalReportsSDK.jar
              CrystalReportingCommon.jar
              u211java.jar 
           <jufl_dir>\
                <your_jufl>.jar

eg. set classpath=C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\external\commons-collections-3.1.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\external\commons-configuration-1.2.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\external\commons-lang-2.1.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\external\commons-logging.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\external\icu4j.jar;C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib\external\log4j.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\CrystalFormulas.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\CrystalReportingCommon.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\u211java.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\regressionUFL.jar;C:\Program Files\SAP BusinessObjects\Crystal Reports 2011\java\lib\CrystalReportsSDK.jar

  1. Add the following String Value at HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\Crystal Reports
    Value name: JREPath
    Value data: JREPath needs to point to a 32 bit JDK. e.g. C:\Program Files (x86)\Java\jdk1.8.0_121\jre\bin\client\jvm.dll
    Value name: JavaUFLLogging
    Value data: <your_jufllog_dir>
    Note that for Crystal report 2020 it is 64bit application, it require the 64 bit JDK or JRE.
  2. Edit CRConfig.xml
    The CRConfig.xml is located in <install_dir>\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java. To configure your very own Java UFLs, simply place the fully qualified java class names of your libraries between the <classname> tags under the <ExternalFunctionLibraryClassNames> tag, one class name per tag.
    For Example,
    <ExternalFunctionLibraryClassNames>
                       <classname>testing.ufl.regression.AnotherFunctionLibrary</classname>
    </ExternalFunctionLibraryClassNames>
  3. Start CR Designer. Change the UFL Support to “Java UFL's Only” by “File->Options->Formula Editor”
  4. Restart CR Designer. Now you can see your own functions in Formula Workshop.

Keywords

KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016

Attachments

Crystal Reports XI - Java User-Defined Function Libraries (UFL)_0_.pdf