SAP Knowledge Base Article - Preview

3802932 - How to create a UFL using Crystal Reports for Eclipse

Symptom

Download the latest "All in One" version of Crystal Reports for Eclipse from the following location:  https://origin.softwaredownloads.sap.com/public/site/index.html

Using the provided Eclipse IDE, you can now create a User Function Library (UFL) and add a User Function using the new Wizard.

UFL Wizard

Choose to create a new User Function as well:

In the generated “MyUFC.java”, set return value as:
String returnVal = s1+s2; // TODO Change this
The close and save.

Export “MyUFLPj” as “MyUFLlib.jar” file into file system under
“C:\workspace\4\My1stCRWebPj\WebContent\WEB-INF\lib”

Then update “Crystal Reports Engine” setting in the Eclipse "Preferences" dialog as the following

Add the User Defined Function to any report open in the IDE by pressing "Ctrl + Space"

For example, add the “dbo.Employee” table from the Extreme sample database into report as database table and input the following as “MyFormula”:
myfunction({Employee.First Name},{Employee.Last Name})


To render above report with the UFL using the Crystal Report Viewer JSP at runtime, add the following in CRConfig.xml File in the application Web project.

Right-click and run the report viewer Jsp on a Web application server and the UFL will show up correctly in the viewer, 

for example:


Read more...

Environment

Crystal Reports for Eclipse

Keywords

KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , How To

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.