Wednesday 6 November 2019

Submit a Concurrent Program/Request from PL/SQL

Oracle has provided the feasibility to submit a concurrent request from backend using "fnd_request.submit_request" API.

Before submitting the API we need to set the environment and this can be done using "fnd_global.apps_initialize"

Here is a sample code to submit a concurrent program from PL/SQL

Note:- This code is to submit a Concurrent Program, not the Request Set. To Submit the Request Set from the backend, We have a different API.

/*********************************************************
*PURPOSE: To Submit a Concurrent Request from backend    *
*AUTHOR: Ragul Halan                                     *
**********************************************************/
--
DECLARE
   l_responsibility_id     NUMBER;
   l_resp_application_id   NUMBER;
   l_security_group_id     NUMBER;
   l_user_id               NUMBER;
   l_request_id            NUMBER;
BEGIN
   --
   -- Get the apps environment variables --
   --
   SELECT user_id, responsibility_id, responsibility_application_id,
          security_group_id
     INTO l_user_id, l_responsibility_id, l_resp_application_id,
          l_security_group_id
     FROM fnd_user_resp_groups
    WHERE user_id = (SELECT user_id
                       FROM fnd_user
                      WHERE user_name = '&USER_NAME')
      AND responsibility_id =
             (SELECT responsibility_id
                FROM fnd_responsibility_vl
               WHERE responsibility_name = '&RESP_NAME');


   --
   --To set environment context.
   --
   apps.fnd_global.apps_initialize (l_user_id,
                                    l_responsibility_id,
                                    l_resp_application_id
                                   );
   --
   --Submitting Concurrent Request
   --
   l_request_id :=
      fnd_request.submit_request (application      => 'XXCUST',         -- Application Short Name
                                  program          => 'XX_DEPT_DTLS',   -- Program Short Name
                                  description      => 'XX_DESCRIPTION', -- Any Meaningful Description
                                  start_time       => SYSDATE,          -- Start Time
                                  sub_request      => FALSE,            -- Subrequest Default False
                                  argument1        => 'Accounting'      -- Parameters Starting
                                 );
   --
   COMMIT;

   --
   IF l_request_id = 0
   THEN
      DBMS_OUTPUT.put_line ('Concurrent request failed to submit');
   ELSE
      DBMS_OUTPUT.put_line ('Successfully Submitted the Concurrent Request: '||l_request_id);
   END IF;
   --
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (   'Error While Submitting Concurrent Request '
                            || TO_CHAR (SQLCODE)
                            || '-'
                            || SQLERRM
                           );
END;
/
For any suggestion or issues with the above code, please leave your comments. I will try to reply back as soon as possible.

Tuesday 5 November 2019

Retrieving Script Engines in Java

A script engine registers alias names with the scripting framework.
For example, the built-in Rhino scripting registers the following names with the scripting framework:
  1. js
  2. rhino
  3. JavaScript
  4. javascript
  5. ECMAScript
  6. ecmascript
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

public class GetEngineByName {
  public static void main(String[] args) {
    ScriptEngineManager manager = new ScriptEngineManager();
    /* Retrieve a ScriptEngine registered with the rhino name */
    ScriptEngine jsEngine = manager.getEngineByName("rhino");
    if (!(jsEngine == null)) {
      System.out.println(jsEngine);
    } else {
      System.out.println("\nNo supported script engine foundregistered as Rhino.");
    }
  }
}






Run JavaScript Method in Java / ADF & OAF

Run JavaScript Method in Java / ADF & OAF   

** it is not Oracle standard.
Example Code :
 try {
      ScriptEngineManager manager = new ScriptEngineManager();
      ScriptEngine engine = manager.getEngineByName("Js");
        engine.eval("function run() {alert(123);}");
        Invocable invokeEngine = (Invocable) engine;
        Runnable runner = (Runnable)invokeEngine.getInterface(Runnable.class);
        Thread t = new Thread(runner);
        t.start();
        t.join();
      }
    catch (ScriptException e)
    {
      // TODO
    }
    catch (InterruptedException e)
    {
      // TODO
    }


incase of any null pointer Exception
visit Get JavaScript Engine Name

Java Code Examples for javax.script.ScriptEngineManager.getEngineFactories()

The following are Jave code examples for showing how to use getEngineFactories() of the javax.script.ScriptEngineManager class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.



private boolean isJavaScriptAvailable() {
    if(isJSAvailableChecked) {
        return isJSAvailable;
    }
    ScriptEngineManager mgr = new ScriptEngineManager();
    List<ScriptEngineFactory> factories = mgr.getEngineFactories();
    for (ScriptEngineFactory factory: factories) {
        List<String> engNames = factory.getNames();
        for(String name: engNames) {
            if(name.equalsIgnoreCase("js") || name.equalsIgnoreCase("javascript")) { //NOI18N
                isJSAvailableChecked = true;
                isJSAvailable = true;
                return isJSAvailable;
            }
        }
    }
    isJSAvailableChecked = true;
    isJSAvailable = false;
    return isJSAvailable;
}



OAF:
Example
try { ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngineFactory[] factories = (ScriptEngineFactory[]) mgr.getEngineFactories(); for (ScriptEngineFactory factory: factories) { String[] engNames = factory.getNames(); for(String name: engNames) { System.out.println(name); } } } catch (Exception e) { }





Trace Oracle EBS user Activities

Example 01



select distinct fu.user_name User_Name,
                fr.RESPONSIBILITY_KEY Responsibility,
                ic.first_connect Connect_Start,
                ic.last_connect Connect_Stop,
                decode(ic.Function_type,
                       'JSP',
                       'OAF Form',
                       'FORM',
                       'Oracle Java Form',
                       '') Menu,
                ic.function_id
  from fnd_user fu, fnd_responsibility fr, icx_sessions ic
 where fu.user_id = ic.user_id
   AND fr.responsibility_id = ic.responsibility_id
   AND ic.disabled_flag = 'N'
   AND ic.responsibility_id is not null
   and fu.user_id = :UserID





FND tables for login details

How to find user logged in Oracle Applications and and I would like restrict some user login during weekends to oracle applications.
 How Logged to Forms
select distinct fu.user_name User_Name,fr.RESPONSIBILITY_KEY Responsibility from fnd_user fu,
fnd_responsibility fr, icx_sessions ic
where fu.user_id = ic.user_id AND
fr.responsibility_id = ic.responsibility_id AND
ic.disabled_flag=’N’ AND
ic.responsibility_id is not null AND
ic.last_connect like sysdate;

There are three primary tables which are involved in using the system profile ‘Sign-On:Audit Level’:
1) FND_LOGINS
2) FND_LOGIN_RESPONSIBILITIES
3) FND_LOGIN_RESP_FORMS

- When the profile is set to “User”, the only table that gets updated is the table FND_LOGINS and only one record per user session

- When the profile is set to “Responsibility”, both FND_LOGINS and FND_LOGIN_RESPONSIBILITIES will be updated:
a) FND_LOGINS gets only one record per user session
b) FND_LOGIN_RESPONSIBILITIES will be updated with one record for each responsibility selected during the session

- When the profile is set to “Form” all three tables are involved:
a) FND_LOGINS gets only one record per user session
b) FND_LOGIN_RESPONSIBILITIES will be updated with one record for each responsibility selected during the session
c) FND_LOGIN_RESP_FORMS will be updated with one record for each form selected during the session
In terms of performance, the data capture has negligible overhead.

Friday 1 November 2019

System Variables In Oracle Forms list

List Of System Varible That are use iN oracle Forms

System variable
SYSTEM.BLOCK_STATUS
SYSTEM.COORDINATION_OPERATION
SYSTEM.CURRENT_BLOCK
SYSTEM.CURRENT_DATETIME
SYSTEM.CURRENT_FORM
SYSTEM.CURRENT_ITEM
SYSTEM.CURRENT_VALUE
SYSTEM.CURSOR_BLOCK
SYSTEM.CURSOR_ITEM
SYSTEM.CURSOR_RECORD
SYSTEM.CURSOR_VALUE
SYSTEM.DATE_THRESHOLD*
SYSTEM.EFFECTIVE_DATE*
SYSTEM.EVENT_WINDOW
SYSTEM.FORM_STATUS
SYSTEM.LAST_FORM
SYSTEM.LAST_QUERY
SYSTEM.LAST_RECORD
SYSTEM.MASTER_BLOCK
SYSTEM.MESSAGE_LEVEL*
SYSTEM.MODE
SYSTEM.MOUSE_BUTTON_PRESSED
SYSTEM.MOUSE_BUTTON_SHIFT_STATE
SYSTEM.MOUSE_ITEM
SYSTEM.MOUSE_CANVAS
SYSTEM.MOUSE_X_POS
SYSTEM.MOUSE_Y_POS
SYSTEM.MOUSE_RECORD
SYSTEM.MOUSE_RECORD_OFFSET
SYSTEM.RECORD_STATUS
SYSTEM.RIGHT_MOUSE_TRIGGER_NODE
SYSTEM.SUPPRESS_WORKING*
SYSTEM.TAB_NEW_PAGE
SYSTEM.TAB_PREVIOUS_PAGE
SYSTEM.TRIGGER_BLOCK
SYSTEM.TRIGGER_ITEM
SYSTEM.TRIGGER_MENUOPTION
SYSTEM.TRIGGER_NODE
SYSTEM.TRIGGER_NODE_SELECTED
SYSTEM.TRIGGER_RECORD

OADBTransactionImpl in Oracle Application Framework (OAF)

OADBTransactionImpl is a class in Oracle Application Framework (OAF), which is a framework for building Oracle E-Business Suite applications...