简体   繁体   中英

srw.message not displaying the message in log file

I am using Report Builder for an rdf report. The requirement is that for 2 parameters which are not mandatory, if no value is passed then the report should exit with error and the log file should display the message that at least either of the parameter should be passed.

I used the below code snippet and tried in the before parameter form, after parameter form, before report and after report form, but neither the program aborts nor the message is displayed in the log file.

    BEGIN
    IF (:P_PROJECT IS NULL AND :p_batch IS NULL) THEN
          srw.message(1000,'Both Project and Batch value is NULL, either pass Project or Batch 
                            Name.');
          raise srw.program_abort;
    END IF;     
    
    EXCEPTION
    WHEN SRW.USER_EXIT_FAILURE THEN
        srw.message(1999,'Failed in AFTERPFORM trigger while validating Project or Batch value 
                          being passed');   
    END;    

I am using Report Builder 10.1.2.0.2 and EBS 12.1.3

I don't have your tables so I created a simple sample report using Scott's EMP table:

select *
from emp
where deptno = :par_deptno
  and (job = :par_job or :par_job is null)
  and (sal > :par_sal or :par_sal is null)

PAR_JOB and PAR_SAL are those two non-mandatory parameters, but at least one of them should exist.

After parameter form trigger:

function AfterPForm return boolean is
begin
    IF (:par_job IS NULL AND :par_sal IS NULL) THEN
          srw.message(1000,'Both Project and Batch value is NULL, either pass Project or Batch Name.');
          raise srw.program_abort;
    END IF;     

    return true;
    
EXCEPTION
    WHEN SRW.USER_EXIT_FAILURE THEN
        srw.message(1999,'Failed in AFTERPFORM trigger while validating Project or Batch value 
                          being passed');    
        return (TRUE);
end;

Run the report; leave parameters empty ; the result: alert is here (as well as the one from the exception section; I omitted it from the screenshot):

在此处输入图像描述

I don't have your Reports version; mine is 9.0.4 (the first 10g , actually), but I believe that it should work OK for you as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM