Link to home
Start Free TrialLog in
Avatar of chandrasekhar_m
chandrasekhar_m

asked on

How to run repots using run_report_object replacing run_product, web_show.document from forms 6i to oracle forms10

Thanks for you time, Currently i am working on oracle forms6i to 10g migration project.they have used RUN_PRODUCT and in 10g it's has to be RUN_REPORT_OBJECT and WEB_SHOW.DOCUMENT.i have used web_show.document and i am comfortable with it, the problem is because of the version enhancements and weak in functions,procedures i am struggling. i have looked into sites but not like mine, my situation is completely  different they thrown me with multiple procedures and one function, being kind of intermediate in this area.finding difficult to fix it

below i am pasting the code.please help. i know this might be surprise to you, because of time constraints i am forced to post this..Thanks a million

There are 2procedure and 1function NAMES(DO_PRINT,FIND_REPORT_NAME,PRINT_REPORT)

function find_report_name - this procedure finds  the right report depending on the condition. don't think we  have to do anything.

procedure print_report is printing the report, this procedure calls and assign the report where you have to do the changes since run_product is no more supported

finally procedure do_print is called on print ..i hope i given clear picture

-------------------------------------------------this is main procedure which prints report----------
PROCEDURE do_print IS
   v_report     varchar2(30);
   v_param_form varchar2(3);
begin
   if :system.record_status in ('INSERT','CHANGED') then
      errmsg_proc('Please save the current record');
   elsif :system.record_status = 'NEW' then
      errmsg_proc('Please define the PDN Trasaction first');
   else
      if :parameter.upd_flag = 'N' then
         if has_ams_access('SAL111') or has_ams_access('SAL112') then
             null;
         else
             errmsg_proc('This PDN is shown in query mode. You need Reverse PDN ' ||
                         'access to print right now.');
         end if;
      end if;

      if :b1.doc_printed in ('P','S') then
         null;
      else
         errmsg_proc('This PDN has already been printed before. Reset print ' ||
                     'flag to re-print it.');
      end if;

      -- Find the report to be printed and print it..this is one which is printing the report
      v_report := find_report_name(v_param_form);
      print_report(v_report,v_param_form);

      -- Set the doc printed flag
      if :b1.doc_printed = 'P' then
         :b1.doc_printed := 'E';
      elsif :b1.doc_printed = 'S' then
         :b1.doc_printed := 'R';
      end if;
      :system.message_level := '5';
      commit;
      :system.message_level := '0';
   end if;
end;


----------------------------------below function basically does is to find differnt reports out 6 or 7 reports as you cab this function is to choose the report, i mean whic needs to be printed

function find_report_name (o_param_form out varchar2) return varchar2 is
   v_report varchar2(30);
   v_param_form varchar2(3);
begin
   -- By default Parameter form is not shown
   v_param_form := 'NO';

   if :b1.despatch_mode in ('D','O') then    -- Logic for PDNs
      if :b1.product_group in ('M','A') then
          if:b2.product_id = 10800 then        -- l PDN
           v_report := 'saw770'; --report names
          else
         v_report := 'saw523'; --report names
        end if;
      elsif :b1.product_group in ('L','C') then
         v_report := 'saw524'; --report names
      elsif :b1.product_group = 'G' then
         if :b2.product_id in (31020,31011) then
          v_param_form := 'YES';
         end if;
         v_report := 'saw156'; --report names
      end if;
   elsif :b1.despatch_mode = 'T' then        -- Logic for PTNs
      if :b1.product_group = 'M' then
        if:b2.product_id = 10800 then        --  PDN
           v_report := 'saw770';
          else
         v_report := 'saw523'; --report names
        end if;
      elsif :b1.product_group in ('L','C') then
         v_report := 'saw524';
      elsif :b1.product_group = 'G' then
         v_report := 'saw155';
      end if;
   else                          
            -- Logic for PINs
      if :b1.product_group = 'M' then
         if:b2.product_id = 10800 then        -- PDN
           v_report := 'saw770';
          else
         v_report := 'saw523';
        end if;
      elsif :b1.product_group in ('L','C') then
         v_report := 'saw023';
      elsif :b1.product_group = 'G' then
         v_report := 'saw522';
      end if;
   end if;

   o_param_form := v_param_form;
   return (v_report);
end;


-----------------------even though it say print report it prints from DO_PRINT other procedure. I understand here we have to do the changes,but don't know where to start

PROCEDURE print_report (i_report in varchar2, i_param_form in varchar2) is
   pl_id ParamList;
begin
   pl_id := get_parameter_list('repdata');
   if not id_null(pl_id) then
      destroy_parameter_list(pl_id);
   end if;
   pl_id := create_parameter_list('repdata');

   add_parameter(pl_id,'pdn_number',TEXT_PARAMETER,:b1.despatch_id);
 
   if i_param_form = 'YES' then
      add_parameter(pl_id,'PARAMFORM',TEXT_PARAMETER,'YES');
      add_parameter(pl_id,'destype',TEXT_PARAMETER,'PRINTER');--oracle migration assistant has made this as comment
      run_product(REPORTS, i_report, SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
   else
      add_parameter(pl_id,'destype',TEXT_PARAMETER,'PRINTER');--oracle migration assitant has made this as comment
      run_product(REPORTS, i_report, SYNCHRONOUS, BATCH, FILESYSTEM, pl_id, NULL);
   end if;
END;


cheers
ASKER CERTIFIED SOLUTION
Avatar of Dr_Billy
Dr_Billy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is an example of calling a single report based on a user input

     IF :index_7 = 'Y' and :pages_index7 <> '0' THEN
         rpt_type := 'ar50128';
         p_call_reports(rpt_type);
     END IF;  
Avatar of chandrasekhar_m
chandrasekhar_m

ASKER

Thanks Billy, you been heavenly to me.as you know i working on migration project.by using libraries you want me to execute just wondering..is it going to be compatible. as it's in libraries.thanks for the help.is there any other way please

cheers
Yes it will , I have just wrapped a migration project from 6i to 10GR2 too :-) This will be the best practice you should adopt , since ORACLE migration tool is following the same path too ... try it and see if that helps or not.
Thanks Billy, let me execute..will update you

Cheers
Sekhar

/*******************************************
   Last Code modified by the Sekhar
   31-Aug-2008 12:48 PM
 *******************************************/
PROCEDURE print_report (i_report in varchar2, i_param_form in varchar2) is
  pl_id ParamList;
  a varchar2(40);
  begin
  pl_id := get_parameter_list('repdata');
  if not id_null(pl_id) then
  destroy_parameter_list(pl_id);
  end if;
  pl_id := create_parameter_list('repdata');
 add_parameter(pl_id,'pdn_number',TEXT_PARAMETER,:b1.despatch_id);

if i_param_form = 'YES' then
add_parameter(pl_id,'PARAMFORM',TEXT_PARAMETER,'YES');
web.show_document('http://it-cons.adnoc-dist.co.ae:8889/reports/rwservlet?userid=sales/sale@addev&desformat=PDF&destype=printer&printjob=yes¶mform=yes&desname=\\w2kprnsrv\KONICA-F13&report=\\it-cons.adnoc-dist.co.ae\c$\Chandra\Forms\'||i_report||'.rdf'||'&pdn_number='||:b1.despatch_id,'_BLANK');
else
web.show_document('http://it-cons.adnoc-dist.co.ae:8889/reports/rwservlet?userid=sales/sale@addev&desformat=PDF&destype=printer&desname=\\w2kprnsrv\KONICA-F13&report=\\it-cons.adnoc-dist.co.ae\c$\Chandra\Forms\'||i_report||'.rdf'||'&pdn_number='||:b1.despatch_id,'_BLANK');
end if;
END;

 
I have provided the exact code that can be used to resolve the issue the requester requested ? why he is posting something and then accepting his solution ?? I request a Moderator Review for this please.
my apologies...i am kind of new to the site,sorry

thanks
sekhar