SAP Knowledge Base Article - Public

2666742 - In CR4Eclipse, when we run a report that has a column defined as Numeric (5, 0) or Decimal (5, 0), not all the values are displayed correctly

Symptom

  • In CR4E v2 SP 19, 20 and 21 when we run a report that has a column defined as Numeric (5, 0) or Decimal (5, 0) not all the values are displayed correctly. For example the value 32768 get displayed as -32768. Value 32769 gets displayed as -32767. Basically any number > 32767 has this issue. We run the reports against a DB2 database running on an IBM iSeries server.
  • Create a very simple table and loaded it with data. Here is an example table:
  • CREATE TABLE MYTEST
    (
    TEST01 NUMERIC ( 5, 0) NOT NULL WITH DEFAULT,
    TEST02 NUMERIC ( 6, 0) NOT NULL WITH DEFAULT,
    TEST03 INTEGER NOT NULL WITH DEFAULT,
    TEST04 DECIMAL (5 , 0) NOT NULL WITH DEFAULT
    )
  • Below are the results. Notice how column TEST01 and TEST04 are displayed incorrectly. Compare columns TEST01 to TEST02. The data in TEST02 are correct, but the data in TEST01 with the exact same data is incorrect.

Environment

  • SAP Crystal Reports, version for Eclipse SP22
  • SAP Crystal Reports runtime engine to Java application, version 12.2.223

Reproducing the Issue

  1.  In SAP Crystal Reports, version for Eclipse SP 22, when we run a report that has a column defined as Numeric (5, 0) or Decimal (5, 0) not all the values are displayed correctly. For example the value 32768 get displayed as -32768. Value 32769 gets displayed as -32767. Basically any number > 32767 has this issue. We run the reports against a DB2 database running on an IBM iSeries server.
  2. Create a very simple table and loaded it with data. Here is an example table:
  3. CREATE TABLE MYTEST
    (
    TEST01 NUMERIC ( 5, 0) NOT NULL WITH DEFAULT,
    TEST02 NUMERIC ( 6, 0) NOT NULL WITH DEFAULT,
    TEST03 INTEGER NOT NULL WITH DEFAULT,
    TEST04 DECIMAL (5 , 0) NOT NULL WITH DEFAULT
    )
  4. Below are the results. Notice how column TEST01 and TEST04 are displayed incorrectly. Compare columns TEST01 to TEST02. The data in TEST02 are correct, but the data in TEST01 with the exact same data is incorrect.

Cause

When creating the report, the designer used wrong variable type to load NUMERIC ( 5, 0)/DECIMAL (5 , 0) and the wrong variable type was stored in the report.

Resolution

This issue is fixed in SAP Crystal Reports, version for Eclipse SP23.

IMPORTANT:

For a new report created in SAP Crystal Reports, version for Eclipse SP23, the data can be displayed correctly.

For the existing reports you have to do one of the following modifications:

  1. Open the report in SAP Crystal Reports 2016 SP6 or the embedded designer of SAP Crystal Reports, version for Eclipse SP23.
  2. In Field Explorer, right click the associated table and select "Set Datasource Location..." to reset the database fields. 
  3. Save the report.

OR

    Refer to the SDK methods below to display the data correctly in runtime.

      String connectString = "dbconnectstring"; // TODO: Fill in database connect string
      String driverName = "dbdrivername"; // TODO: Fill in driver name
      String JNDIName = "";
      String userName = "dbuser"; // TODO: Fill in database user
      String password = "dbpassword"; // TODO: Fill in password

      CRJavaHelper.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);

      CRJavaHelper.logonDataSource(clientDoc, userName, password);

To download the latest Support Packages of SAP Crystal Reports, version for Eclipse:

https://wiki.scn.sap.com/wiki/display/BOBJ/SAP+Crystal+Reports+version+for+Eclipse+-+Downloads

Keywords

cr4e, Numeric (5, 0), Decimal (5, 0), field definition , KBA , BI-RA-CR-ECL , Crystal Reports for Eclipse , Problem

Product

Crystal Reports, version for Eclipse 2.0