Home » Developer & Programmer » Forms » run_report_object with parameter form (DS10 g, DB 10g)
run_report_object with parameter form [message #435051] Mon, 14 December 2009 00:46 Go to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

Hello,

I have written code for calling reports from the form when parameter is specified. It opens report parameter form when no parameter is supplied on the form.

DECLARE
        L_PATH VARCHAR2(100);
        PL_ID   PARAMLIST; 
        PL_NAME VARCHAR2(10) := 'JUST8';
        L_REPNAME VARCHAR2(30);
        VC_REPORTOBJ VARCHAR2(100);
        V_REPORT_ID REPORT_OBJECT;
        VC_REPORTSERVER VARCHAR2(100);
        VC_RUNFORMAT VARCHAR2(100);
        VC_DESNAME VARCHAR2(100);
        STR_REPORT_JOBID VARCHAR2(100);
        STRSERVER VARCHAR2(100);
        HIDDEN_ACTION VARCHAR2(2000):='';
BEGIN
        L_REPNAME:=:PARAMETER.REPNME;
        SELECT REPORTPATH, APPSERVER,REP_SERVER_NAME INTO L_PATH,STRSERVER,     VC_REPORTSERVER FROM PRMAUSER;
        PL_ID := GET_PARAMETER_LIST(PL_NAME);
        IF ID_NULL(PL_ID) = FALSE THEN
                DESTROY_PARAMETER_LIST(PL_ID); 
                PL_ID := CREATE_PARAMETER_LIST(PL_NAME); 
                IF ID_NULL(PL_ID) THEN 
                        MESSAGE('ERROR CREATING PARAMETER LIST '||PL_NAME); 
                        RAISE FORM_TRIGGER_FAILURE; 
                END IF; 
        ELSE 
                PL_ID := CREATE_PARAMETER_LIST(PL_NAME); 
        END IF;
        ADD_PARAMETER(PL_ID, 'MODE',    TEXT_PARAMETER, 'BITMAP');
        ADD_PARAMETER(PL_ID, 'DESTYPE',         TEXT_PARAMETER, 'CACHE');
        ADD_PARAMETER(PL_ID, 'DESFORMAT',       TEXT_PARAMETER, 'PDF');
        ADD_PARAMETER(PL_ID, 'PARAMFORM',       TEXT_PARAMETER, 'NO');
        ADD_PARAMETER(PL_ID, 'P_GROUPUNIT',     TEXT_PARAMETER, :P_GROUPUNIT);

        VC_REPORTOBJ:=L_PATH||L_REPNAME;
        V_REPORT_ID:= FIND_REPORT_OBJECT('REPORT18');
        SET_REPORT_OBJECT_PROPERTY(V_REPORT_ID, REPORT_FILENAME, VC_REPORTOBJ);
        SET_REPORT_OBJECT_PROPERTY(V_REPORT_ID,REPORT_EXECUTION_MODE,BATCH);
        SET_REPORT_OBJECT_PROPERTY(V_REPORT_ID,REPORT_COMM_MODE,ASYNCHRONOUS);
        SET_REPORT_OBJECT_PROPERTY(V_REPORT_ID,REPORT_SERVER,VC_REPORTSERVER);
        
        IF :P_GROUPUNIT IS NULL THEN
                SET_REPORT_OBJECT_PROPERTY(V_REPORT_ID,REPORT_OTHER ,'PARAMFORM=YES');
                HIDDEN_ACTION := (HIDDEN_ACTION || '&REPORT='||GET_REPORT_OBJECT_PROPERTY(V_REPORT_ID,REPORT_FILENAME));
                HIDDEN_ACTION := HIDDEN_ACTION||'&DESTYPE=CACHE';
                HIDDEN_ACTION := HIDDEN_ACTION||'&DESFORMAT=PDF';
                HIDDEN_ACTION := HIDDEN_ACTION ||'&MODE=BITMAP&USERID='||GET_APPLICATION_PROPERTY(USERNAME)
||'/'||GET_APPLICATION_PROPERTY(PASSWORD)
||'@'||GET_APPLICATION_PROPERTY(CONNECT_STRING);
        HIDDEN_ACTION := 'HTTP://'||STRSERVER||'/reports/rwservlet/'
||'?_HIDDEN_SERVER='||VC_REPORTSERVER||(HIDDEN_ACTION);
                SET_REPORT_OBJECT_PROPERTY(V_REPORT_ID,REPORT_OTHER,'PFACTION='||HIDDEN_ACTION||' PARAMFORM=YES');
        END IF;

        :GLOBAL.VC_REPORT_JOB_ID:=RUN_REPORT_OBJECT(V_REPORT_ID,PL_ID);
        :GLOBAL.VC_REP_STATUS :=REPORT_OBJECT_STATUS(:GLOBAL.VC_REPORT_JOB_ID);
        WHILE :GLOBAL.VC_REP_STATUS IN ('RUNNING','OPENING_REPORT','ENQUEUED') 
        LOOP
                :GLOBAL.VC_REP_STATUS :=REPORT_OBJECT_STATUS(:GLOBAL.VC_REPORT_JOB_ID);
        END LOOP;



        IF :GLOBAL.VC_REP_STATUS='FINISHED' THEN
                MESSAGE(:GLOBAL.VC_REP_STATUS);
                STR_REPORT_JOBID:=(SUBSTR(:GLOBAL.VC_REPORT_JOB_ID,
LENGTH(VC_REPORTSERVER)+2,LENGTH(:GLOBAL.VC_REPORT_JOB_ID)));
                WEB.SHOW_DOCUMENT ('HTTP://'||STRSERVER||'/reports/rwservlet/getjobid'
||STR_REPORT_JOBID||'?server='||VC_REPORTSERVER);
        ELSE
                MESSAGE ('REPORT FAILED WITH ERROR MESSAGE '||:GLOBAL.VC_REP_STATUS);
        END IF;
EXCEPTION
        WHEN NO_DATA_FOUND THEN
        NULL;
END;

[EDITED by DJM: cut overly long lines]

[Updated on: Thu, 18 March 2010 01:19] by Moderator

Report message to a moderator

Re: run_report_object with parameter form [message #437154 is a reply to message #435051] Thu, 31 December 2009 05:58 Go to previous messageGo to next message
Littlefoot
Messages: 21805
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is there a question hidden somewhere (and I'm being unable to detect it), or did you just want to share the code you wrote?

[Updated on: Thu, 31 December 2009 05:58]

Report message to a moderator

Re: run_report_object with parameter form [message #437477 is a reply to message #437154] Mon, 04 January 2010 11:39 Go to previous messageGo to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

Hello, I was just sharing my code.
regards
Re: run_report_object with parameter form [message #437480 is a reply to message #437477] Mon, 04 January 2010 12:19 Go to previous messageGo to next message
Littlefoot
Messages: 21805
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, that was very nice of you!
Re: run_report_object with parameter form [message #437773 is a reply to message #437480] Tue, 05 January 2010 23:44 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Pity that the code is crap. Just use the 'web.show_document' command and LOSE the totally useless and often non-functioning 'run_report_object' and 'loop'.

David
Re: run_report_object with parameter form [message #438237 is a reply to message #437773] Thu, 07 January 2010 11:44 Go to previous messageGo to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

Hello,

Ok code might be Crap. I shared my code only because this is one option available to the developers. I tried writing code under 'web.show.document' too. However i was not very confortable with Java Beans portion and also was not able to find good detailed tutorial, that is why i thought to share this one. Moreover in last 3 months there was no failure of 'run_report_object' as coded above on our system.

Regards
Re: run_report_object with parameter form [message #438718 is a reply to message #438237] Mon, 11 January 2010 23:37 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You are exceptionally lucky that you have not had to manually start or restart your report server. Nearly everyone else I have had contact with has had problems, and not using 'run_report_object' is the fastest way to avoid them.

I had a discussion six years ago with one of the Oracle developers and that person said that they would remove the examples using 'run_report_object' and only have those using 'web.show_document'. However, as I had a similar discussion a decade earlier with another Oracle developer about an error in the Forms 4.5 document, and as it has not yet been fixed (it is still there in the Forms 10g document) I am not holding my breath waiting for them to change the examples.

David
Re: run_report_object with parameter form [message #438912 is a reply to message #435051] Wed, 13 January 2010 00:34 Go to previous messageGo to next message
tamzidulamin
Messages: 132
Registered: October 2009
Location: Dhaka
Senior Member
Hello Dear,

First configure rep server & report key by the following way:
rep_server must install & start
01. rwserver -install server = rep_server
Rep_key is must be defined in the following location
'\\DevSuiteHome\report\conf\cgicmd.dat' as
02. Rep_key:rep_server userid=test/test@database[/email][/email] %*

   PROCEDURE run_report(p_rpt_name  varchar2,
                     p_dest      varchar2  default 'C'
                     )
    IS
    v_url                   varchar2(2000);
    v_cur_form_name         varchar2(100);
    v_length                number;
    vPath_Sep               char(1);
    v_rpt_name_with_path    varchar2(500);
    v_rpt_format            varchar2(50):='pdf'; -- Example: pdf,html,xml etc.
    v_rpt_key               varchar2(50):='Rep_key';
    v_para_form             varchar2(3) :='NO'; -- YES/NO
    v_dest                  varchar2(20);
    v_rpt_builder           varchar2(200);
    v_rpt_server            varchar2(50);

BEGIN
--------Report_Path -------------
    v_cur_form_name:=get_application_property(current_form);

    if get_application_property(operating_system) in ('MSWINDOWS', 'MSWINDOWS32', 'WIN32COMMON') then
        vPath_Sep := '\';
    else
        vPath_Sep := '/';
    end if;

  v_length:=instr(v_cur_form_name,vPath_Sep,-1);
   --Getting Current Report Name With Path.
  v_rpt_name_with_path:=substr(v_cur_form_name,1,v_length)||'Reports'||vPath_Sep||p_rpt_name;
  

------Report Destination-----

    v_dest:=upper(p_dest);
    if v_dest ='C' then
        v_dest:='cache';
    elsif v_dest='P' then
        v_dest:='printer';
    elsif v_dest='M' then
        v_dest:='mail';
    elsif v_dest='F' then
        v_dest:='file';
    end if;
    
-------Start Call Report----------
    v_url:=    '/reports/rwservlet?'||v_rpt_key
                                    ||'&desformat='   ||v_rpt_format
                                    ||'&destype='     ||v_dest
                                    ||'&paramform='   ||v_para_Form
                                    ||'&report='      ||v_rpt_name_with_path;



    web.show_document(v_url, '_blank');

--------End Call Report---------
    
exception
    when others then null;
end;


Now run the above procedure form Developer10g Form.

Regards
Tamzidul Amin
[EDITED by DJM: remove long blank line]

[Updated on: Thu, 18 March 2010 01:22] by Moderator

Report message to a moderator

Re: run_report_object with parameter form [message #441237 is a reply to message #435051] Fri, 29 January 2010 11:25 Go to previous messageGo to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

Hello,

I tried to work ot the method given by you, however there am not able to set rep_key in cgicmd.dat file. I am enclosing my file here kindly tell me what mistake i am making.

Another aspect about your code is that if we have reports in character mode originally then there is error REP-1920
REP-1920: Character mode runtime incompatible with DESFORMAT of PDF, HTML, HTMLCSS, SPREADSHEET or RTF.
This can be solved by adding &mode=bitmap in the v_url
    v_url:=    '/reports/rwservlet?'||v_rpt_key
		          ||'&mode=bitmap'                                                            
			  ||'&desformat='   ||v_rpt_format                    
			  ||'&destype='     ||v_dest 
			  ||'&paramform='   ||v_para_Form                               
			  ||'&report='      ||v_rpt_name_with_path;


And my next Question is about hidding a part of Report_Path, I mean if we can hide the part in the rep_key itself
i.e.

rep_key: userid=abc/[email]abc@abc report=d:\abc\reports\

can ther be 2 diffrent keys in the cgicmd file
rep_key1: userid=abc/abc@abc report=d:\abc\reports\
rep_key2: userid=xyz/xyz@xyz report=d:\xyz\reports\




with this reportname can be added under v_url
    v_url:=    '/reports/rwservlet?'||v_rpt_key
		          ||v_rpt_name
                          ||'&mode=bitmap'                                                
			  ||'&desformat='   ||v_rpt_format                    
			  ||'&destype='     ||v_dest 
			  ||'&paramform='   ||v_para_Form;                               
			  

Regards
  • Attachment: cgicmd.dat
    (Size: 4.39KB, Downloaded 1939 times)

[Updated on: Fri, 29 January 2010 11:38]

Report message to a moderator

Re: run_report_object with parameter form [message #446667 is a reply to message #441237] Tue, 09 March 2010 22:25 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Sorry that I have been so long in replying. Have you solved your problem?

David
Re: run_report_object with parameter form [message #447381 is a reply to message #435051] Sun, 14 March 2010 11:39 Go to previous messageGo to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

Hello,

Not yet
Regards
Re: run_report_object with parameter form [message #447804 is a reply to message #447381] Thu, 18 March 2010 01:30 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Can we go back a step please?

Can you get the report to run from a form without any entry in 'cgicmd.dat'?

David
Re: run_report_object with parameter form [message #450394 is a reply to message #447804] Tue, 06 April 2010 20:48 Go to previous messageGo to next message
rkgoyal98
Messages: 39
Registered: October 2009
Member

Hello,

Sorry for delayed resposnse
was busy in firefighting with user issues on a new project

Yes can run report without cgicmd.dat
regards
Re: run_report_object with parameter form [message #672167 is a reply to message #450394] Thu, 04 October 2018 23:51 Go to previous message
HasnainAli
Messages: 6
Registered: September 2018
Junior Member
Good Morning Every One.
I am new in Oracle 10g form and report.
I create a Report.It call from Oracle Form on button press trigger by using WEB.SHow_doc() function it Working fine and my report is called.
But when i Create desktop shortcut to run my application from desktop then application form runs but report is not runs.
I make package of my application using (ThinForm - For Oracle extension in google chrom and ThinApplet JAR.EXE to create the desktop icon to run my application from desktop).

Please tell me why my report is not call from package that i created ?

thanks in advanced
Previous Topic: ORA-01031: insufficient privileges in Forms
Next Topic: Form Builder 12c crash
Goto Forum:
  


Current Time: Tue Mar 19 04:12:54 CDT 2024