How to Implement Error with Text Substitution

Purpose of Document

This document is to explain how to implement below business functions in interactive application or in other business function to describe meaningful error/warning/information for users additionally this document explains example of callmap.

Table of Contents:

 

B0800366 - TextSubstitutionError (Text Substitution Error)

This function sets error on the form (form level error) and error remains until the form is closed. Therefore this function cannot be used if error needs to be cleared on the form after error has been corrected on the form.
Instead design custom business function described in :
<Document 626614.1> E1: DD: Creating a Text Substitution Error Message
<Document 1342870.1> E1: FDA: How to Use a Text Substitution Error Message in Form Design Aid?
Parameter NameData ItemData TypeI/OReqPurpose
szErrorMesssageID[11] DTAI JCHAR I/O Y  Choose Error Code with &1
mnErrorCode MATH06 MATH_NUMERIC O    
szSustituionText1[41] DSCA JCHAR I    Any value which is shorter than 40 characters
szSustituionText2[41] DSCA JCHAR I    
szSustituionText3[41] DSCA JCHAR I    
szSustituionText4[41] DSCA JCHAR I    
szSustituionText5[41] DSCA JCHAR I    

 

Example (Interactive Application - P4824 Burden Information)

  
       F00095 Reserve Object
              VA frm_szRcdResObjectID_PID -> BF szNameObject
              SL UserID -> BF szUserId
              "1" -> BF cSuppressErrorMessage
              VA frm_szRecordReserveErrMsg_DTAI <- BF szErrorMessageID
              VA frm_szReserversNameAlpha_ALPH <- BF szReserversNameAlpha
              VA frm_szRecordResKey_GENKEY -> BF szGenericKey
              VA frm_szUniqueIDRRString_GENKEY -> BF szApplication

       Text Substitution Error
              "189E" -> BF szErrorMessageID
              VA frm_szReserversNameAlpha_ALPH -> BF szSubstitutionText1
              VA frm_szRecordResKey_GENKEY -> BF szSubstitutionText2
 

 

Note:

Back To Top



B4207010 - TextSubstitutionErrorForMultLine (Text Substitution Error with Error Mapping)

Parameter NameData ItemData TypeI/OReqPurpose
szErrorMessageID[11] DTAI JCHAR I Y  42B6
mnErrorCode MATH06 MATH_NUMERIC O    N/A
szSubstitutionText1[41] DSCA JCHAR I    &1
szSubstitutionText2[41] DSCA JCHAR I    &2
szSubstitutionText3[41] DSCA JCHAR I    &3
szSubstitutionText4[41] DSCA JCHAR I    &4
szSubstitutionText5[41] DSCA JCHAR I    &5
szItemNumber UITM JCHAR I   To indicate specific cell value for error
szGenericText1[31] DESC JCHAR     N/A
szGenericText2[31] DESC JCHAR     N/A
szGenericCharacter1 EV01 JCHAR     N/A
szGenericCharacter2 EV01 JCHAR     N/A
szGenericMath1 MATH01 MATH_NUMERIC     N/A
szGenericMath2 MATH01 MATH_NUMERIC     N/A

 

                      Item &1 has been replaced by item &2.
                      Item &2 is a promotional item for item &1.

Example 1 (Interactive Application - P4210 - Sales Order Entry)

  
                   Text Substitution Error For Multiple Lines
                          "42B6" -> BF szErrorMessageID
                          GC Item Number -> BF szSubstitutionText1
                          GB Item Number -> BF szSubstitutionText2
                          GC Item Number -> BF szItemNo
 


Example 2 (Business Function - b4210030):

  
         lpdsSalesOrderLine->dsMetadata.szSalesOrderFlags[36] = _J('1');

         jdeStrcpy(dsTextSubsError.szErrorMessageID, _J("42B6"));
         jdeStrcpy(dsTextSubsError.szSubstitutionText1, lpdsSalesOrderLine->dsBusinessData.szItemNo);
         jdeStrcpy(dsTextSubsError.szSubstitutionText2, lpdsSalesOrderLine->dsMetadata.lpdsPromotionalMetaData->szItemNumber);

         idReturn = jdeCallObject(_J("TextSubstitutionErrorForMultLine"),
                                  NULL,lpBhvrCom,lpVoid,(LPVOID)&dsTextSubsError,
                                  (CALLMAP *)lpCallMap,(int)nNumCallMap,(JCHAR *)NULL,
                                  (JCHAR *)NULL,(int)0);
 

 

Note:

Back To Top


Below section is to describe possible way to implement callmap based on existing routines in EnterpriseOne. Note that proficient programming knowledge may be required to implement this properly.


Example of CALLMAP:
Business Scenario: When the flag F03012.porq (Customer PO Required (Y/N)) flag is on in Billing Information Customer PO (F4201.vr01) has to be populated and Customer's PO Number has to be unique otherwise error code '2597 - WARNING: Duplicate Customer Order Number) to show warning message is to be issued on screen of P4210.

For this scenario,
P4210 - Sales Order Entry
       | ---- F4211FSBeginDoc (B4200310 - F4211 Begin Document)
                   | --- VerifyCustomerPONumberIsUnique (B4200130 - Customer PO Number, Verify for Uniqueness)
For this example, error determined by 2nd Level Business Function (B4200130) has to return value to the 1st level calling business function B4200310 which in return error code '2597' on the screen. This is a typical needs for ErrorMap (or CallMap).

Definition:
A. B4200310.h

typedef struct tagDSD4200310H
{
...
  JCHAR             szReference[26];                    
...
} DSD4200310H, *LPDSD4200310H;
 
...
#define IDERRszReference_23                       23L (Ref #1)
...


B. B4200130.h

typedef struct tagDSD4200130
{
  JCHAR              szCustomerPONumber[26];                /* Reference */
...
} DSD4200130, FAR *LPDSD4200130;

#define                   IDERRszCustomerPONumber_1                               1L (Ref #2)
...


C. Implemenation:
*** Break In Code in B4200310 - F4211FSBeginDoc ***

ID I4200310_ValidateCustPO(LPBHVRCOM lpBhvrCom, LPVOID lpVoid,LPDSD4200310H lpDS, LPDS4200310A lpds4200310A) (#Ref 3)
{
    CALLMAP     clmp[1]        = {{IDERRszReference_23, IDERRszCustomerPONumber_1}}; (Ref #4)
    DSD4200130  dsD4200130;      /* VerifyCustomerPONumberIsUnique */ (Ref #5)

   if (!IsStringBlank(lpDS->szReference)) (Ref #6)
   {
         memset((void *)(&dsD4200130),(int)(_J('\0')),sizeof(dsD4200130));
         jdeStrcpy((JCHAR *)(dsD4200130.szCustomerPONumber),(const JCHAR *)(lpDS->szReference));
         MathCopy(&dsD4200130.mnCustomerNumber,&lpDS->mnAddressNumber);
         idReturnValue = jdeCallObject(_J("VerifyCustomerPONumberIsUnique"), NULL, lpBhvrCom, lpVoid,
                                       (LPVOID)&dsD4200130, (Ref #7)
                                       (LPCALLMAP)&clmp, (Ref #8)
                                       (int)1, (Ref #9)
                                       (JCHAR *)NULL, (JCHAR *)NULL, (int)0);
         if ((idReturnValue != ER_SUCCESS)|| (dsD4200130.cErrorCode == _J('1')))
         {
            idErrorFlag = 1;  (Ref #10)
         }
      }
   }
   return idErrorFlag;
}

*** Break In Code in B4200310 - F4211FSBeginDoc ***

D. Explanation

  1. The 23rd parameter of B4200310.h is IDERRszReference_23 is a pointer to szReference[26] in B4200310 - F4211FSBeginDoc routine
  2. The 1st parameter of B4200130.h is IDERRszCustomerPONumber_1 a pointer to szCustomerPONumber [26]
  3. Data Structure of F4211FSBeginDoc is DSD4200310H
  4. For CALLMAP array, the 1st parameter of called BSFN B4200130 is assigned to the 23rd parameter of B4200310
  5. Data Structure of B4200130 is defined as DSD4200130
  6. If input from application P4210 szReference (as FC Reference value is assigned to F4211FSBeginDoc)
  7. In calling jdeCallObject() API data structure pointer &dsD4200130 is used
  8. (LPCALLMAP) is used as defined at 4 (&clmp)
  9. Since Error Map is defined in 7, the integer value for nNumMap (or nErrorMap) is defined as 1
  10. Based on cErrorCode in called routine B4200130 which repeats in calling routine B4200130. idErrorFlag value 1 is to indicate the error level is warning not error (which is value 2)

Note: This routine is simplified routine to explain Error Map or Call Map so actual code can be different from this example

Back To Top