Monday, June 15, 2020

create or get URL of concurrent program request output or log file by fnd_webfile

--SET SERVEROUTPUT ON
--It will work for Paper Layout RDF report for Sure
DECLARE
   l_request_id   NUMBER := 60277934;--:P_REQ_ID;                       -- The request id
   l_two_task     VARCHAR2 (256);
   l_gwyuid       VARCHAR2 (256);
   l_url          VARCHAR2 (1024);
BEGIN
   -- Get the value of the profile option named, Gateway User ID (GWYUID)
   --- l_gwyuid := fnd_profile.VALUE ('APPLSYSPUB/PUB');

   SELECT   profile_option_value
     INTO   l_gwyuid
     FROM   fnd_profile_options o, fnd_profile_option_values ov
    WHERE       profile_option_name = 'GWYUID'
            AND o.application_id = ov.application_id
            AND o.profile_option_id = ov.profile_option_id;


   -- Get the value of the profile option named, Two Task(TWO_TASK)

   SELECT   profile_option_value
     INTO   l_two_task
     FROM   fnd_profile_options o, fnd_profile_option_values ov
    WHERE       profile_option_name = 'TWO_TASK'
            AND o.application_id = ov.application_id
            AND o.profile_option_id = ov.profile_option_id;


   l_url :=
      fnd_webfile.get_url (file_type     => fnd_webfile.request_out, -- for out file
                           ID            => l_request_id,
                           gwyuid        => l_gwyuid,
                           two_task      => l_two_task,
                           expire_time   => 500-- minutes, security!.
                           );

   DBMS_OUTPUT.put_line (l_url);
END;
=========================================================================

--It will work for  RDF-XML-RTF Report for Sure
DECLARE
   l_outfile_name        fnd_conc_req_outputs.file_name%TYPE;
   l_outfile_node_name   fnd_conc_req_outputs.file_node_name%TYPE;
   l_mime_type           fnd_mime_types_vl.mime_type%TYPE;
   l_svc                 VARCHAR2 (100);
   l_id                  VARCHAR2 (100);
   l_base                VARCHAR2 (100);
   l_pos                 VARCHAR2 (100);
   url                   VARCHAR2 (100);
   l_request_id   NUMBER;
BEGIN
    xx_ff_calculation.xx_salary_slip_creation (:xx_payroll_header.month_year,
                                              :xx_payroll_header.person_id
                                               ,l_request_id
                                             );
   
   SELECT file_name, file_node_name
     INTO l_outfile_name, l_outfile_node_name
     FROM fnd_conc_req_outputs
    WHERE concurrent_request_id = l_request_id;

   SELECT mime_type
     INTO l_mime_type
     FROM fnd_mime_types_vl
    WHERE file_format_code = 'PDF';

   l_svc := fnd_conc_private_utils.get_fs_svc_name (l_outfile_node_name);
   l_id :=
      fnd_webfile.create_id (l_outfile_name,
                             l_svc,
                             10,
                             l_mime_type,
                             l_request_id,
                             'BINARY',
                             'Y'
                            );

   IF (l_id IS NULL)
   THEN
      fnd_message.retrieve;
      fnd_message.error;
   END IF;

   fnd_profile.get ('APPS_WEB_AGENT', l_base);
   l_pos := INSTR (l_base, '/', 1, 3);

   IF (l_pos > 0)
   THEN
      l_base := SUBSTR (l_base, 1, l_pos - 1);
   END IF;

   url := l_base || '/OA_CGI/FNDWRR.exe?' || 'temp_id=' || l_id;
   fnd_utilities.open_url (url);
END;

Monday, June 8, 2020

Oracle Workflow All Function Modes (funcmode)

/*Oracle Workflow All Function Modes (funcmode) */
   begin
---1
      if ( funcmode = 'RUN' ) then

           <your RUN executable statements>

           resultout := 'COMPLETE:<result>';

           return;

      end if;
---2
  if ( funcmode = 'CANCEL' ) then

           <your CANCEL executable statements>

           resultout := 'COMPLETE';

           return;

      end if;
---3
  if ( funcmode = 'SKIP' ) then

           <your SKIP executable statements>

           resultout := 'COMPLETE:<result>';

           return;

      end if;
---4
  if ( funcmode = 'RETRY' ) then

           <your RETRY executable statements>

           resultout := 'COMPLETE:<result>';

           return;

      end if;
---5
   if ( funcmode = 'VALIDATE' ) then

           <your VALIDATE executable statements>

           resultout := 'COMPLETE';

           return;

      end if;
---6
  if ( funcmode = 'RESPOND' ) then

           <your RESPOND executable statements>

           resultout := 'COMPLETE';

           return;

      end if;
---7
  if ( funcmode = 'FORWARD' ) then

           <your FORWARD executable statements>

           resultout := 'COMPLETE';

           return;

      end if;
---8
  if ( funcmode = 'TRANSFER' ) then

           <your TRANSFER executable statements>

           resultout := 'COMPLETE';

           return;

      end if;
---9
  if ( funcmode = 'QUESTION' ) then

           <your QUESTION executable statements>

           resultout := 'COMPLETE';

           return;

      end if;
--10
 if ( funcmode = 'ANSWER' ) then

           <your ANSWER executable statements>

           resultout := 'COMPLETE';

           return;

      end if;

---11
  if ( funcmode = 'TIMEOUT' ) then

           <your TIMEOUT executable statements>

           if (<condition_ok_to_proceed>) then

              resultout := 'COMPLETE';

           else

              resultout := wf_engine.eng_timedout;

           end if;

           return;

      end if;
--12 Other Developer Defined
  if ( funcmode = '<other funcmode>' ) then

           resultout := ' ';

           return;

      end if;
--Main exception
  exception

           when others then

            WF_CORE.CONTEXT ('<package name>', '<procedure name>', <itemtype>,

                            <itemkey>, to_char(<actid>), <funcmode>);

           raise;

  end <procedure name>;

Sunday, June 7, 2020

Migrating Oracle e-business Business Events through WFXLoad


//Migrating Oracle e-business Business Events through WFXLoad
To download Business Event System object definitions from a database in Oracle e-ebusiness to a flat XML file, you can either run the Workflow XML Loader manually, or, if you are using the standalone version of Oracle Workflow, you an use a script to run the loader.

To run the Workflow XML Loader manually, run java / jre against oracle.apps.fnd.wf.WFXLoad.

You must specify your CLASSPATH pointing to the Java Runtime Environment, the directory containing the Workflow JAR files, the Oracle JDBC implementation, and the following Workflow JAR files:
• wfjava.jar - Workflow Java utilities
• wfapi.jar - Workflow Java APIs

java -classpath "$/rt.jar:$:$/wfjava.jar:$/wfapi.jar:$/jdbc/lib/classes111.zip:" oracle.apps.fnd.wf.WFXLoad [-d|-u]   <apps_username> <apps_pwd> <server:server_port:sid> thin US <filename> [EVENTS|SUBSCRIPTIONS] <event_name>

    Specify whether you want to upload(-u) or download(-d)
    Specify the apps user name and password
    Provide the server details i.e the servername/port/sid
    Provide the name of the file to which you want to download or from which you want to upload
    Specify whether you want to download subscriptions/events
    Specify the name of the event for download

Sample for downloading events:
adjava oracle.apps.fnd.wf.WFXLoad -d aapps **** myserver:1541:sid thin US ./xx_oracle_apps_po_rfq_event_RFQActiveEvent.wfx EVENTS xx.oracle.apps.po.rfq.event.RFQActiveEvent
Sample for downloading subscriptions:
adjava oracle.apps.fnd.wf.WFXLoad -d apps **** myserver:1541:sid thin US ./xx_oracle_apps_po_rfq_event_RFQActiveEventSubscription.wfx SUBSCRIPTIONS xx.oracle.apps.po.rfq.event.RFQActiveEvent
Sample for uploading events

adjava oracle.apps.fnd.wf.WFXLoad -u apps **** myserver:1554:sid thin US  xx_oracle_apps_po_rfq_event_RFQActiveEvent.wfx
Sample for uploading subscriptions
adjava oracle.apps.fnd.wf.WFXLoad -u apps **** myserver:1554: sid thin US  xx_oracle_apps_po_rfq_event_RFQActiveEventSubscription.wfx