calling report 10g from form 10g
I am trying to run a report in 10g using form 10g but i am getting the error as "REPORT_OBJECT_STATUS can not be null" can any one help me i am giving my procedure below...
----****
PROCEDURE run_report IS
report_id report_object;
report_job_id varchar2(200);
rep_status varchar2(200);
JOB_NUMBER number;
v_repserver varchar2(200):= 'Report_Server_Name';
v_server varchar2(500):= 'Server_Name';
v_report varchar2(50):= 'testrep';
v_port number := 80;
v_desformat varchar2(30):='pdf';
v_pl_id PARAMLIST;
v_pl_name VARCHAR2(20) := 'REPORT_PARAM_LIST';
al_id ALERT;
v_dummy NUMBER;
BEGIN
IF Set_Up_Parameter_List = 0 THEN
report_id := FIND_REPORT_OBJECT(v_report);
IF id_null(report_id) then
SET_ALERT_PROPERTY('CFG_ERROR', TITLE, 'Failed to run report!');
SET_ALERT_PROPERTY('CFG_ERROR', ALERT_MESSAGE_TEXT,'Can not find Report...');
v_dummy := SHOW_ALERT('CFG_ERROR');
END IF ;
IF get_application_property(USER_INTERFACE) = 'WEB' THEN
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE, RUNTIME);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, FILE);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,'pdf');
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME, 'PR_RO_PRINTB_NL');
--SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,'J0B_NO ='||PARAMS.JB_NO||'PARAMFORM = NO');
-- message('J0B_NO ='||PARAMS.JB_NO);
--SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,v_repserver);
/*SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE, RUNTIME);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE, ASYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, cache);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,v_desformat);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,v_repserver);*/
ELSE
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE, RUNTIME);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, FILE);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,'pdf');
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME, 'PR_RO_PRINTB_NL');
--SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,'J0B_NO ='||PARAMS.JB_NO||'PARAMFORM = NO');
-- message('J0B_NO ='||PARAMS.JB_NO);
--SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,v_repserver);
/*SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE, RUNTIME);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE, ASYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, SCREEN);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,v_desformat);
SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,'');*/
END IF;
v_pl_id := get_parameter_list(v_pl_name);
IF id_null(v_pl_id) then
SET_ALERT_PROPERTY('CFG_ERROR', TITLE, 'Failed to run report!');
SET_ALERT_PROPERTY('CFG_ERROR', ALERT_MESSAGE_TEXT,'Can not find Parameter list...');
v_dummy := SHOW_ALERT('CFG_ERROR');
END IF ;
--Find the report and then run it,passing the new parameter list to it.
IF get_application_property(USER_INTERFACE) = 'WEB' THEN
MESSAGE('WEB');
report_job_id := RUN_REPORT_OBJECT(report_id, v_pl_id);
IF report_job_id IS NULL THEN
MESSAGE('report_job_id IS NULL...');
MESSAGE('report_job_id IS NULL...');
END IF;
--debug_message('Report_job_id is'||report_job_id);
ELSE
Run_Product(REPORTS, --product name
v_report, --module name
ASYNCHRONOUS, --communication mode
RUNTIME, --execution mode
FILESYSTEM, --location
v_pl_id, --parameter list
null);
END IF;
-- Check to see if the report is going to be run against the web
IF get_application_property(USER_INTERFACE)='WEB' THEN
MESSAGE('status WEB '||report_job_id);
MESSAGE('status WEB '||report_job_id);
rep_status:=REPORT_OBJECT_STATUS(report_job_id);
--debug_message('Rep_status is '||rep_status);
-- Dynamically Set the Job Number
JOB_NUMBER := length(v_repserver) + 2;
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED', null)
LOOP
rep_status:=REPORT_OBJECT_STATUS(report_job_id);
END LOOP;
IF rep_status='FINISHED' THEN
Web.Show_Document('http://' || v_server || ':' || v_port ||'/dev60cgi/rwcgi60.exe/getjobid=' ||substr (report_job_id,JOB_NUMBER)||'?server='||v_repserver,'_blank');
ELSE
message('Report failed with error message '||rep_status);
END IF; -- end of checking report status
END IF; -- end of checking to see if report is running on web.
END IF; -- end of checking parameter list set up ok
EXCEPTION
WHEN OTHERS THEN
--al_id := FIND_ALERT('REPORT_PROBLEM');
SET_ALERT_PROPERTY('CFG_ERROR', TITLE, 'Failed to run report!');
SET_ALERT_PROPERTY('CFG_ERROR', ALERT_MESSAGE_TEXT,
ERROR_TYPE||'-'||TO_CHAR(ERROR_CODE)||': '||ERROR_TEXT);
v_dummy := SHOW_ALERT('CFG_ERROR');
-- shows error dialog box
DISPLAY_ERROR;
RAISE FORM_TRIGGER_FAILURE;
END;
----****