8 Implementing Error Messages

This chapter contains the following topics:

8.1 Understanding Error Messages

Messages provide an effective and usable method of communicating information to end-users. You can use simple messages or text substitution messages.

Text substitution messages provide specific information to the user. At runtime, the system replaces variables in the message with substitution values. Two types of text substitution messages exist:

  • Error messages (glossary group E)

  • Workflow messages (glossary group Y)

The return code from all JDB and JDE Cache APIs must be checked and an appropriate error message set, returned, or both to the calling function. The standard error messages for JDB and JDE Cache errors are shown in these tables.

The JDB errors are:

Error ID Description
078D Open Table Failed
078E Close Table Failed
078F Insert to Table Failed
078G Delete from Table Failed
078H Update to Table Failed
078I Fetch from Table Failed
078J Select from Table Failed
078K Set Sequence of Table Failed
078S * Initialization of Behavior Failed

* 078S does not use text substitution

The JDE Cache errors are:

Error ID Description
078L Initialization of Cache Failed
078M Open Cursor Failed
078N Fetch from Cache Failed
078O Add to Cache Failed
078P Update to Cache Failed
078Q Delete from Cache Failed
078R Terminate of Cache Failed

8.2 Inserting Parameters for Error Messages in lpDS

Include the parameters cSuppressErrorMessage and szErrorMessageID in lpDS for error message processing. The functionality for each is as follows:

  • cSuppressErrorMessage (SUPPS)

    Valid data is either 1 or 0. This parameter is required if jdeErrorSet(...) is used in the business function. When cSuppressErrorMessage is set to 1, do not set an error because jdeErrorSet will automatically display an error message.

  • szErrorMessageID (DTAI)

    This 4–character string contains the error message ID value that is passed back by the business function. If an error occurs in the business function, szErrorMessageID contains that error number ID.


    You must initialize szErrorMessageID to 4 spaces at the beginning of the function. Failure to initialize can cause memory errors.

8.2.1 Example: Parameters in lpDS for an Error Message

This example includes the lpDS parameters, cSuppressErrorMessage, and szErrorMessageID:

   if ((!IsStringBlank(lpDS->szErrorMessageID)) &&
       (lpDS->cSuppressErrorMessage != _J('1')))
      jdeStrcpy ((JCHAR*) (lpDS->szErrorMessageID),
                 (const JCHAR*) (_J("0653")));
      jdeErrorSet (lpBhvrCom, lpVoid, (ID) IDERRcMethodofComputation_1,
                   lpDS->szErrorMessageID, (LPVOID) NULL);
      idReturnValue = ER_ERROR;

 * Function Clean Up
   return idReturnValue;

8.3 Initializing Behavior Errors

Business functions that use the JD Edwards EnterpriseOne database API are required to call the Initialize Behavior function before calling any of the database functions. Set error 078S if the Initialize Behavior function does not complete successfully.

8.3.1 Example: Initialize Behavior Error

This example illustrates an initialize behavior error:

 * Initialize Behavior
idJDBReturn = JDB_InitBhvr(lpBhvrCom,
                           (JCHAR *) NULL,
if (idJDBReturn != JDEDB_PASSED)
   jdeStrcpy (lpDS->szErrorMessageID, _J("078S"));
   if (lpDS->cSuppressErrorMessage != _J('1'))
      jdeErrorSet(lpBhvrCom, lpVoid, (ID)0, _J(078S), (LPVOID) NULL);
   return ER_ERROR;

8.4 Using Text Substitution to Display Specific Error Messages

You can use the JD Edwards EnterpriseOne text substitution APIs for returning error messages within a business function. Text substitution is a flexible method for displaying a specific error message.

Text substitution is accomplished through the data dictionary. To use text substitution, you first must set up a data dictionary item that defines text substitution for the specific error message. A selection of error messages for JDB and JDE Cache have already been created and are listed in this chapter.

Error messages for cache and tables are critical in a configurable network computing (CNC) architecture. C programmers must set the appropriate error message when working with tables or cache APIs.

JDB API errors should substitute the name of the file against which the API failed. JDE cache API errors should substitute the name of the cache for which the API failed.

When calling errors that use text substitution, you must:

  • Load a data structure with the information you want to substitute in the error message.

  • Call jdeErrorSet to set the error.

8.4.1 Example: Text Substitution in an Error Message

This example uses text substitution in JDB_OpenTable:

 * Open the General Ledger Table F0911
eJDBReturn = JDB_OpenTable( hUser,
                            (JCHAR *)NULL,

if (eJDBReturn != JDEDB_PASSED)
   memset((void *)(&dsDE0022), 0x00, sizeof(dsDE0022));
   jdeStrncpy((JCHAR *)dsDE0022.szDescription,
              (const JCHAR *)(_J("F0911")),
   jdeErrorSet (lpBhvrCom, lpVoid,(ID)0, _J("078D"), &dsDE0022);

8.5 Mapping Data Structure Errors with jdeCallObject

Any Business Function calling an external Business Function must use jdeCallObject. When using jdeCallObject, be sure to match the Error IDs correctly.

You need to match the Ids from the original Business Function with the Error Ids of the Business Function in jdeCallObject. A data structure is used in the jdeCallObject to accomplish this task.

 * Variable declarations
CALLMAP   cm_D0000026[2]  = {{IDERRmnDisplayExchgRate_62,
ID        idReturnCode    = ER_SUCCESS;  /* Return Code */
* Business Function structures
DSD0000026  dsD0000026    = {0};    /* Edit Tolerance */ 

 idReturnCode = jdeCallObject(_J("EditExchanbeRateTolerance"),
                              (void *)&dsD0000026,
                              (CALLMAP *)&cm_D0000026,
                              (JCHAR *)NULL,
                              (JCHAR *)NULL,