Showing Custom Error Message - Web ADI


Showing Custom Error Message - Web ADI


Standard Message like:-  but we don't understand that's why we required Custom message


Custom Message:- is so proper and easy to understand.

CREATE OR REPLACE PACKAGE APPS.XXSD_WEB_ADI_PROC  AS

  PROCEDURE INSERT_XXSD_WEB_ADI_TL (
 P_EMPLOYEE_NUMBER  VARCHAR2
,P_FIRST_NAME VARCHAR2
,P_LAST_NAME VARCHAR2
,P_DATE_OF_BIRTH DATE
,P_GRADE VARCHAR2
,P_REMARKS VARCHAR2
,P_ATTRIBUTE1 VARCHAR2
,P_ATTRIBUTE2 VARCHAR2
,P_ATTRIBUTE3 VARCHAR2
,P_ATTRIBUTE4 VARCHAR2
,P_ATTRIBUTE5 VARCHAR2
,P_ATTRIBUTE6 VARCHAR2
,P_ATTRIBUTE7 VARCHAR2
,P_ATTRIBUTE8 VARCHAR2
,P_ATTRIBUTE9 VARCHAR2
,P_ATTRIBUTE10 VARCHAR2
);    
END;

--==========================  TYPE – 1 ===============================



CREATE OR REPLACE PACKAGE BODY APPS.XXSD_WEB_ADI_PROC  AS

PROCEDURE INSERT_XXSD_WEB_ADI_TL (
 P_EMPLOYEE_NUMBER  VARCHAR2
,P_FIRST_NAME VARCHAR2
,P_LAST_NAME VARCHAR2
,P_DATE_OF_BIRTH DATE
,P_GRADE VARCHAR2
,P_REMARKS VARCHAR2
,P_ATTRIBUTE1 VARCHAR2
,P_ATTRIBUTE2 VARCHAR2
,P_ATTRIBUTE3 VARCHAR2
,P_ATTRIBUTE4 VARCHAR2    
,P_ATTRIBUTE5 VARCHAR2
,P_ATTRIBUTE6 VARCHAR2
,P_ATTRIBUTE7 VARCHAR2
,P_ATTRIBUTE8 VARCHAR2
,P_ATTRIBUTE9 VARCHAR2
,P_ATTRIBUTE10 VARCHAR2     
) IS         
      
      Web_Error_MSG              VARCHAR2 (2000);
     
      l_responsibility_id     NUMBER := apps.fnd_global.resp_id;
      l_resp_application_id   NUMBER := apps.fnd_global.resp_appl_id;
      l_org_id                NUMBER := apps.fnd_global.org_id;
      l_user_id               NUMBER := apps.fnd_global.user_id;
      V_VALID_EMP NUMBER;
     
     
    BEGIN
       
        BEGIN
           
        select COUNT(*)
        INTO V_VALID_EMP
        from per_all_people_f
        where EMPLOYEE_NUMBER = P_ATTRIBUTE9;
           
            IF  V_VALID_EMP = 0 THEN
               
                Web_Error_MSG := '**Employee number not Correct **';
                raise_application_error (-20001, 'ERROR |'||Web_Error_MSG);                       
            END IF;
           
        EXCEPTION WHEN OTHERS THEN
        Web_Error_MSG := SUBSTR(SQLERRM,1,1999);
        raise_application_error (-20001, 'Excption-(Validation-1) ' || Web_Error_MSG);
        END;
          
    INSERT INTO XXSD_WEB_ADI_TL (
    EMPLOYEE_NUMBER
    ,FIRST_NAME
    ,LAST_NAME
    ,DATE_OF_BIRTH
    ,GRADE
    ,REMARKS
    ,ATTRIBUTE1
    ,ATTRIBUTE2
    ,ATTRIBUTE3
    ,ATTRIBUTE4
    ,ATTRIBUTE5
    ,ATTRIBUTE6
    ,ATTRIBUTE7
    ,ATTRIBUTE8
    ,ATTRIBUTE9
    ,ATTRIBUTE10
     )
    VALUES (
    P_EMPLOYEE_NUMBER
    ,P_FIRST_NAME
    ,P_LAST_NAME
    ,P_DATE_OF_BIRTH
    ,P_GRADE
    ,P_REMARKS
    ,P_ATTRIBUTE1
    ,P_ATTRIBUTE2
    ,P_ATTRIBUTE3
    ,P_ATTRIBUTE4
    ,P_ATTRIBUTE5
    ,P_ATTRIBUTE6
    ,P_ATTRIBUTE7
    ,P_ATTRIBUTE8
    ,P_ATTRIBUTE9
    ,P_ATTRIBUTE10
         );

    COMMIT;
     
    EXCEPTION WHEN OTHERS THEN
    Web_Error_MSG := SUBSTR(SQLERRM,1,1999);

    raise_application_error (-20001, 'MAIN_OTHER_EXCEPTION - ' || Web_Error_MSG);
    END;
         
END;


--==========================  TYPE – 2 ===============================

CREATE OR REPLACE PACKAGE BODY APPS.XXSD_WEB_ADI_PROC  AS

PROCEDURE INSERT_XXSD_WEB_ADI_TL (
 P_EMPLOYEE_NUMBER  VARCHAR2
,P_FIRST_NAME VARCHAR2
,P_LAST_NAME VARCHAR2
,P_DATE_OF_BIRTH DATE
,P_GRADE VARCHAR2
,P_REMARKS VARCHAR2
,P_ATTRIBUTE1 VARCHAR2
,P_ATTRIBUTE2 VARCHAR2
,P_ATTRIBUTE3 VARCHAR2
,P_ATTRIBUTE4 VARCHAR2    
,P_ATTRIBUTE5 VARCHAR2
,P_ATTRIBUTE6 VARCHAR2
,P_ATTRIBUTE7 VARCHAR2
,P_ATTRIBUTE8 VARCHAR2
,P_ATTRIBUTE9 VARCHAR2
,P_ATTRIBUTE10 VARCHAR2     
) IS         
      
      Web_Error_MSG              VARCHAR2 (2000);
     
      l_responsibility_id     NUMBER := apps.fnd_global.resp_id;
      l_resp_application_id   NUMBER := apps.fnd_global.resp_appl_id;
      l_org_id                NUMBER := apps.fnd_global.org_id;
      l_user_id               NUMBER := apps.fnd_global.user_id;
      V_VALID_EMP NUMBER;
     
     
    BEGIN
       
        BEGIN
           
        select COUNT(*)
        INTO V_VALID_EMP
        from per_all_people_f
        where EMPLOYEE_NUMBER = P_ATTRIBUTE9;
           
            IF  V_VALID_EMP = 0 THEN
               
               FND_MESSAGE.CLEAR;
               FND_MESSAGE.SET_NAME('XXSD','!!! please select Correct and Right Empoyee - Ok !!');
                --Set the timestamp message token with the current database timestamp
                FND_MESSAGE.SET_TOKEN('TIME : ',to_char(SYSDATE,'DD-MM-YYYY HH:MI:SS'));
                --Set the username message token with the current applications user
                FND_MESSAGE.SET_TOKEN('USER : ',FND_GLOBAL.USER_NAME);
               
                --Retrieve the message 
                Web_Error_MSG := FND_MESSAGE.GET;
                raise_application_error (-20001, 'ERROR |'||Web_Error_MSG);                       
            END IF;
           
        EXCEPTION WHEN OTHERS THEN
        Web_Error_MSG := SUBSTR(SQLERRM,1,1999);
        raise_application_error (-20001, 'Excption-(Validation-1) ' || Web_Error_MSG);
        END;
          
    INSERT INTO XXSD_WEB_ADI_TL (
    EMPLOYEE_NUMBER
    ,FIRST_NAME
    ,LAST_NAME
    ,DATE_OF_BIRTH
    ,GRADE
    ,REMARKS
    ,ATTRIBUTE1
    ,ATTRIBUTE2
    ,ATTRIBUTE3
    ,ATTRIBUTE4
    ,ATTRIBUTE5
    ,ATTRIBUTE6
    ,ATTRIBUTE7
    ,ATTRIBUTE8
    ,ATTRIBUTE9
    ,ATTRIBUTE10
     )
    VALUES (
    P_EMPLOYEE_NUMBER
    ,P_FIRST_NAME
    ,P_LAST_NAME
    ,P_DATE_OF_BIRTH
    ,P_GRADE
    ,P_REMARKS
    ,P_ATTRIBUTE1
    ,P_ATTRIBUTE2
    ,P_ATTRIBUTE3
    ,P_ATTRIBUTE4
    ,P_ATTRIBUTE5
    ,P_ATTRIBUTE6
    ,P_ATTRIBUTE7
    ,P_ATTRIBUTE8
    ,P_ATTRIBUTE9
    ,P_ATTRIBUTE10
         );

    COMMIT;
     
    EXCEPTION WHEN OTHERS THEN
    Web_Error_MSG := SUBSTR(SQLERRM,1,1999);

    raise_application_error (-20001, 'MAIN_OTHER_EXCEPTION - ' || Web_Error_MSG);
    END;
         
END;
/


Acctual Messgae is:-  '!!! please select Correct and Right Empoyee - Ok !!'


Long Messgae  not Proper :- 

ORA-20001: MAIN_OTHER_EXCEPTION - ORA-20001: Excption-(Validation-1) ORA-20001: ERROR |!!! please select Correct and  (TIME : =17-11-2019 02:33:34) (USER : =DEVELOPER)


--==========================  TYPE – 3 ===============================

CREATE OR REPLACE PACKAGE BODY APPS.XXSD_WEB_ADI_PROC  AS

PROCEDURE INSERT_XXSD_WEB_ADI_TL (
 P_EMPLOYEE_NUMBER  VARCHAR2
,P_FIRST_NAME VARCHAR2
,P_LAST_NAME VARCHAR2
,P_DATE_OF_BIRTH DATE
,P_GRADE VARCHAR2
,P_REMARKS VARCHAR2
,P_ATTRIBUTE1 VARCHAR2
,P_ATTRIBUTE2 VARCHAR2
,P_ATTRIBUTE3 VARCHAR2
,P_ATTRIBUTE4 VARCHAR2    
,P_ATTRIBUTE5 VARCHAR2
,P_ATTRIBUTE6 VARCHAR2
,P_ATTRIBUTE7 VARCHAR2
,P_ATTRIBUTE8 VARCHAR2
,P_ATTRIBUTE9 VARCHAR2
,P_ATTRIBUTE10 VARCHAR2     
) IS         
      
      Web_Error_MSG              VARCHAR2 (2000);
     
      l_responsibility_id     NUMBER := apps.fnd_global.resp_id;
      l_resp_application_id   NUMBER := apps.fnd_global.resp_appl_id;
      l_org_id                NUMBER := apps.fnd_global.org_id;
      l_user_id               NUMBER := apps.fnd_global.user_id;
      V_VALID_EMP NUMBER;
     
     
    BEGIN
       
        BEGIN
           
        select COUNT(*)
        INTO V_VALID_EMP
        from per_all_people_f
        where EMPLOYEE_NUMBER = P_ATTRIBUTE9;
           
            IF  V_VALID_EMP = 0 THEN
               
                FND_MESSAGE.CLEAR;
                FND_MESSAGE.SET_NAME('XXSD','XXSD_ERROR_MESSAGE');
                --Set the timestamp message token with the current database timestamp
                FND_MESSAGE.SET_TOKEN('TIME : ',to_char(SYSDATE,'DD-MM-YYYY HH:MI:SS'));
                --Set the username message token with the current applications user
                FND_MESSAGE.SET_TOKEN('USER : ',FND_GLOBAL.USER_NAME);
               
                --Retrieve the message 
                Web_Error_MSG := FND_MESSAGE.GET;
                raise_application_error (-20001, 'ERROR |'||Web_Error_MSG);                       
            END IF;
           
        EXCEPTION WHEN OTHERS THEN
        Web_Error_MSG := SUBSTR(SQLERRM,1,1999);
        raise_application_error (-20001, 'Excption-(Validation-1) ' || Web_Error_MSG);
        END;
          
    INSERT INTO XXSD_WEB_ADI_TL (
    EMPLOYEE_NUMBER
    ,FIRST_NAME
    ,LAST_NAME
    ,DATE_OF_BIRTH
    ,GRADE
    ,REMARKS
    ,ATTRIBUTE1
    ,ATTRIBUTE2
    ,ATTRIBUTE3
    ,ATTRIBUTE4
    ,ATTRIBUTE5
    ,ATTRIBUTE6
    ,ATTRIBUTE7
    ,ATTRIBUTE8
    ,ATTRIBUTE9
    ,ATTRIBUTE10
     )
    VALUES (
    P_EMPLOYEE_NUMBER
    ,P_FIRST_NAME
    ,P_LAST_NAME
    ,P_DATE_OF_BIRTH
    ,P_GRADE
    ,P_REMARKS
    ,P_ATTRIBUTE1
    ,P_ATTRIBUTE2
    ,P_ATTRIBUTE3
    ,P_ATTRIBUTE4
    ,P_ATTRIBUTE5
    ,P_ATTRIBUTE6
    ,P_ATTRIBUTE7
    ,P_ATTRIBUTE8
    ,P_ATTRIBUTE9
    ,P_ATTRIBUTE10
         );

    COMMIT;
     
    EXCEPTION WHEN OTHERS THEN
    Web_Error_MSG := SUBSTR(SQLERRM,1,1999);

    raise_application_error (-20001, 'MAIN_OTHER_EXCEPTION - ' || Web_Error_MSG);
    END;
         
END;
/

ERROR Messgae:- 

ORA-20001: MAIN_OTHER_EXCEPTION - ORA-20001: Excption-(Validation-1) ORA-20001: ERROR |!! ************************  Error_Message:- Employee nmot correct please select proper or correct Emplyee which is alredy been creted into the system *********************!!! (TIME : =17-11-2019 02:26:49) (USER : =DEVELOPER)

--=======================Define this message (XXSD_ERROR_MESSAGE)  ======================




--=============================================================================

--=============================================================================




Comments

  1. Hi Sir,
    Is possible to showing Custom Success Message in WEB ADI ?

    ReplyDelete

Post a Comment

Popular posts from this blog

E-Text Report In Fusion | Types of E-Text reports

Supplier API's

How to pass default Parameter in cursor