Completing an Oracle RDF report in Warning status using SET_COMPLETION_STATUS

There was a requirement in one of the RDF report that I worked on. We have to end the report concurrent program in warning status with appropriate message if there is no output for the provided input.

So here is how I have achieved it. I have used the function – SET_COMPLETION_STATUS in FND_CONCURRENT in after report trigger to stop the bursting program from triggering. Here are the details of the function:

FND_CONCURRENT.SET_COMPLETION_STATUS (Server)
Variable
Description
Summary
function FND_CONCURRENT.SET_COMPLETION_STATUS 

(status               IN varchar2,
 message            IN varchar2) return boolean;
Description
Call SET_COMPLETION_STATUS from a concurrent program to set its completion status. The function returns TRUE on success, otherwise FALSE.


Variable
Description
status
The status to set the concurrent program to. Either NORMAL, WARNING, or ERROR.
message
An optional message.

Here is the sample piece of code from the after report trigger:

IF :CS_RECS <= 0 --– WE WILL CHECK IF THERE ARE ANY RECORD FOR THE I/P PARAMS
   THEN
      srw.MESSAGE (20000, '######################################');
      srw.MESSAGE (20001, 'No Data Found - For the given Input');
      srw.MESSAGE (20002, 'Bursting Program will not be submitted');
      srw.MESSAGE (20003, '######################################');

      lv_return :=
         fnd_concurrent.set_completion_status (
            'WARNING',
            'WARNING: No Data Found for the given input - Bursting Program will not be Submitted');

END IF;