2 Replies Latest reply: Dec 4, 2013 10:47 PM by 1058354 RSS

    Developer Report 10g - How to generate directly a file ( pdf, html, text etc. )

    1058354

      hi all gurus,

       

      this is my first ever post, I am new in the development area and facing a problem.

      I am using Developer 10g, calling report through a Form Module and want to Directly save in file name specified but failed. My code to call report mentioned below for your ready reference. NO Parameter using in Report Module.

       

      This showing report on Screen instead of giving output file, user have to use Save As command and also there is no file name which I sent to Report Module.

       

      ---------------------------------- START of CODE -----------------------------

      Declare

        rep_obj         REPORT_OBJECT;   

        v_rep           VARCHAR2(100); 

        rep_status      VARCHAR2(20); 

        v_rep_server    app_server_objects_detail.OBJECT_VALUE%type;

        v_p_action      app_server_objects_detail.OBJECT_VALUE%type;

        v_rep_getjobid  app_server_objects_detail.OBJECT_VALUE%type;

        v_rep_killjobid app_server_objects_detail.OBJECT_VALUE%type;

        v_rep_obj_path  app_server_objects_detail.OBJECT_VALUE%type; 

      BEGIN 

        --------------------------------- setting app server object properties ---------------------------------

        for rec in ( select object_code,object_value

                       from   itmis.app_server_objects_detail

                   )

        loop 

           if rec.object_code=1 then

              v_rep_server:=rec.OBJECT_VALUE;

           end if;

       

           if rec.object_code=11 then

              v_rep_obj_path:=rec.OBJECT_VALUE;

           end if;

       

           if rec.object_code=19 then

              v_rep_getjobid:=rec.OBJECT_VALUE;

           end if;

       

           if rec.object_code=20 then

              v_rep_killjobid:=rec.OBJECT_VALUE;

           end if;

       

           if rec.object_code=21 then

              v_p_action:=rec.OBJECT_VALUE;

           end if;

        end loop;    

        --------------------------------- -------------------------------------- ---------------------------------

       

        rep_obj := find_report_object('SHORT');  --- report name

       

        SET_REPORT_OBJECT_PROPERTY(rep_obj,REPORT_EXECUTION_MODE,BATCH); 

        SET_REPORT_OBJECT_PROPERTY(rep_obj,REPORT_COMM_MODE,SYNCHRONOUS);

        SET_REPORT_OBJECT_PROPERTY(rep_obj,REPORT_DESTYPE,FILE);

        SET_REPORT_OBJECT_PROPERTY(rep_obj,REPORT_DESFORMAT,:TEXT_BLOCK.REP_FORMAT); -- Form's Text Field

        SET_REPORT_OBJECT_PROPERTY(rep_obj,REPORT_SERVER,v_rep_server);

        SET_REPORT_OBJECT_PROPERTY(rep_obj,REPORT_DESNAME,:TEXT_BLOCK.FILE_NAME);  -- Form's Text Field

        SET_REPORT_OBJECT_PROPERTY(rep_obj,REPORT_OTHER,'paramform=no'||

                                                        ' P_SERVERNAME='||v_rep_server||

                                                        ' P_ACTION='||v_p_action);

       

        set_report_object_property(rep_obj,REPORT_FILENAME,v_rep_obj_path||lower('short.rdf'));

       

        v_rep := RUN_REPORT_OBJECT(rep_obj);

        rep_status := REPORT_OBJECT_STATUS(v_rep);

       

        WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')

          LOOP

            rep_status := report_object_status(v_rep);

          END LOOP;

       

        IF rep_status = 'FINISHED' THEN

            WEB.SHOW_DOCUMENT(v_rep_getjobid||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_server,'_blank');

            WEB.SHOW_DOCUMENT(v_rep_killjobid||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_server,'_blank');

        ELSE 

          message('Error when running report', Acknowledge);  

        END IF; 

       

      EXCEPTION

         WHEN OTHERS THEN

              show_err_msg;

      END;

      ---------------------------------- END of CODE -----------------------------

       

      Please help where I made mistake.

       

      Regards.