Tuesday, 11 December 2018

Create Applications with Special Information Types in Oracle

Task – To create a Medical Reimbursement form on SSHR screen so the employees can easily update their medical bills every month and their
manager can approve these bills and at the end of the month a process have to be run which will transfer these bills into employee’s payroll elements
so before payroll run these bill should be updated

Step 1 – Creating SIT
Login in as System Administrator -> Flexfield -> Key -> Segments
Search for Application (Human Resources) and Flexfield Title (Personal Analysis Flexfield)
Define a new row, we can call it MEDICAL_REIMBURSEMENT_KFF and the description can be Job Requests.
Next we click on "Segments" to define the form fields to be used in the application.
Field - ValueSet
=============
Employee Name LOV
Nature of Sickness LOV
Details of Sickness 30Char
Hospital Name 30Char
Date FND_STANDARD_DATE
Amount Allowed CRL_YES_NO
Amount Number
Then we save and compile.
Next, login as Global Super HRMS Manager. And look for the function "Define Special Information Type". Find the one we just created
MEDICAL_REIMBURSEMENT_KFF and check the "Enabled" and "Other" checkboxes and save.

Step 2 – Configure WorkFlow Process
Change the node attribute of HR_SIT_JSP_PRC seeded WF to Yes or Yes Dynamic
or
Copy the seeded workflow
open Workflow builder, login Open the HR item type. Under processes, find HR_SIT_JSP_PRC workflow process as a template Copy it, and paste.
When pasting, the internal name should be MEDICAL_REIMBURSEMENT_SIT_PROC_JSP_P (i.e the name of our new workflow process). The
display name can be Medical Reimbursement.
Save the workflow locally and upload it via WFLoad command

Step 3 – Define Function
After this, we go back into SysAdmin and go to Application -> Function
The function can be:
Function, User Function Name, Description
==================================
MEDICAL_REIMBURSEMENT_PROCESS., TEST Job Request Process, Special Information Types
Under the properties tab, we have:


Function, Type, Maintenance Mode, Context dependence
===========================================
MEDICAL_REIMBURSEMENT_PROCESS., SSWA jsp function , None, None
Under the Form tab we have
Parameters
==========
pAMETranType=SSHRMS&pAMEAppId=&pProcessName=
MEDICAL_REIMBURSEMENT_SIT_PROC_JSP_P&pItemType=HRSSA&pCalledFrom= MEDICAL_REIMBURSEMENT_PROCESS
&pPersonID=&pFromMenu=Y
Under the Web HTML tab, we have
HTML Call
=========
OA.jsp?akRegionCode=HR_CREATE_PROCESS_TOP_SS&akRegionApplicationId=800&OAFunc= MEDICAL_REIMBURSEMENT_PROCESS
MEDICAL_REIMBURSEMENT_SIT_PROC_JSP_P is the name of the workflow process we created earlier.
pCalledFrom and OAFunc must be the function name
save & Exit.


Step 4 – Map Function with Menu
Next is to add this function (Medical Reimbursement) to the Menu for TEST Employee Self Service.
Then we also need to open the menu "Global Self Service Functions Custom". And add our function to it as well under the function column.
Next we now navigate to our function and we have to personalize the page for it.

Step 5 – Personalize the Page
After this, we have to personalize the page:
/oracle/apps/per/selfservice/specialinformation/webui/PersonSitPG
to only show our SIT at functional level.
To do this, we will click on our new function in SSHR. But this will show all of the SIT's available which is quite a lot.
So on this page, we click on the "Personalization" link at the top.
Then from here, we find the column "Flex: Key flex for Sit" near the very bottom click the pen image to personalize the page.
Now, on the next page that shows up, find the "Segment List" column.
For this field, we enter values under the function header in the format:
STRUCTURE 1|Segment 1|Segment 2||Structure 3|Segment 7|Segment 8
So for our example we can have:
MEDICAL_REIMBURSEMENT_KFF | Employee Name | Date | Amount | Hospital Name | Details of Sickness

Step 6 – Setting up AME
The final thing to do is to setup AME rules for this workflow process:
Login as "Approvals Management Business Analyst" and create a new Rule under TEST HR
Combination, Header,
Condition - WORKFLOW_PROCESS_NAME in (HR_SIT_JSP_PRC) or (MEDICAL_REIMBURSEMENT_SIT_PROC_JSP_P) whatever you are using
Actions - Supervisory (one level up) or whatever we want it to be.

Deploy OA Framework

How to Deploy OA framework in the Instance

Deployment of OA framework consists of 5 steps.
  • Deploying Class files and VO/EO/AM xml files
  • Deploying PG/RN xml files
  • Deploying jpr files for Substitution
  • Setup AOL to access the page
  • Restart the server

Let's look at these one by one.

Deploying Class files


The files such as
  • Controllers *CO.class
  • Application modules *AM.class
  • View Objects *VOImpl.class, *VORowImpl.class, *VO.xml
  • Entity objects *EO.xml, *EOImpl.java

should be deployed in the $JAVA_TOP/<path of your file>.

For eg:
if your files path in jdeveloper is
$jdev_home/myprojects/oracle/apps/ap/setup/webui/setupCO.java
then place your class files in the following path in the instance
$JAVA_TOP/oracle/apps/ap/setup/webui/setupCO.class


Deploying Page and Region files


The Page xml files(*PG.xml) and region xml(*RN.xml) files resides in the database. So you have to import the file into the database to make it work in the instance. Oracle application provides XMLExporter/XMLImporter to export and import page files from and to the database.

Deploy the files to the Instance

java oracle.jrad.tools.xml.importer.XMLImporter /home/prasanna/pages/SetupPG.xml -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> ) (port = <port id>)))(connect_data = (sid = <sid>)))"

This command will import the SetupPG.xml file into the database.


Extracting from instance

If you have done your personalizations in the developement instance and you want to deploy the personalizations into the production instance, then you can extract the personalization using XMLExporter command from the developement instance and Import the extracted xml file into the production instance in the same way you did for PG.xml files.

java oracle.jrad.tools.xml.exporter.XMLExporter /oracle/apps/ap/setup/webui/customizations/site/0/SetupPG -rootdir <destination path> -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> ) (port = <port id>)))(connect_data = (sid = <sid>)))"

The above command will export the SetupPG from the data base to your file system at the destination path as XML file (SetupPG.xml)


Deploying jpr files for Substitutions, if any


If you have extended EO, VO or AM and created substitutions in your project. Then you have to deploy your .jpx file into the instance.

java oracle.jrad.tools.xml.importer.JPXImporter $AP_TOP/xxx/Setup.jpx -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> (port = <port id>)))(connect_data = (sid = <sid>)))"


Setup AOL to access the page


In case your page is referred in existing pages of Oracle applications you can skip this step. But if you want to access the page as a new Function then follow these steps.


Create Function as
ID: XX_SETUP
Name: SETUP
Function type(HTML tab) : SSW
URL: OA.jsp?page=/oracle/apps/ap/XXX/SetupPG&parameter1=xx&parameter1=xx


Attach the function to a Menu
Attach the menu to a Responsibility

Restart the server


After deployement you cannot see the page immediately on the server instance. This is because your Pages and class files would be cached in the middle tier. So you have to bounce the apache.

$COMMON_TOP/admin/scripts/adapcctl.sh stop
$COMMON_TOP/admin/scripts/adapcctl.sh start

After this process, clear the cache from the functional administrator responsibility and this step is optional.

Some times we may need to restart the whole middle tier to see the depolyed pages in the instance.
To Restart the instance use following command

Stop the instance
cd $INST_TOP/admin/scripts
adstpall.sh apps/apps

Start the instance
adstrtal.sh apps/apps

UIX (User Interface XML) Framework

Oracle EBS uses:

  • UIX for UI Components (i.e. View part)
  • BC4J for business components (i.e. Model part)
  • And what OAF does is the programmatic binding among all these.

UIX framework is J2EE-based framework for building web applications and is based on MVC design pattern.
The main focus of UIX is the user presentation layer of an application. UIX is platform independent as it is implemented in the Java programming language. UIX development can be declarative, using uiXML, an XML language for creating UIX pages.

UIX includes a set of UI components and classes for rendering them:

UI Components: These are implemented as Java Beans. They include page layouts and simple UI objects that map to standard HTML controls, such as buttons, forms, and checkboxes. There are other complex components, such as trees, hide-show controls, LOV etc.

Renderers: These are Java classes for rendering the UI components to target clients/devices. For example, components are rendered as HTML for use in web browsers or as WML for use in mobile devices.
Classes for UIX Components are in the oracle.cabo.ui package.

uiXML: This is an XML language for programming UIX applications. uiXML provides a declarative way of creating web applications programmatically using UIX Java APIs. The pages, events, and any other items defined with uiXML elements are all transformed into Java objects behind the scenes. Below is an example of a uiXML element (button):


uiXML documents are written in a text format, where document represents page or a region.
Classes supporting uiXML are located in oracle.cabo.ui.xml andoracle.cabo.servlet.xml packages.

Pages in UIX
===================
On the browser, "page" is just collection of HTML elements. However, while in developing phase, concept of "page" can be more complex, depending upon the declarative way used to create the page and renderers used.

A UIX page consists of a hierarchical set of components known as UI nodes. Some nodes define visible components, such as buttons, images, text fields, while others organize the layout and appearance of other nodes.
Nodes can have parents and children, and multiple nodes together form a tree-like structure used to represent a page's logical structure.

For example, left part below figure shows a logical hierarchy of UI nodes and right part shows the same hierarchy rendered as an HTML page.













Now in UIX, there is a java class for each UI nodes. These classes implement the UINode interface in the oracle.cabo.ui package. The UINode interface contains methods for the characteristics of nodes, such as:
public int getIndexedChildCount(RenderingContext context);
public UINode getIndexedChild(RenderingContext context, int childIndex);
public Enumeration getAttributeNames(RenderingContext context);
public Object getAttributeValue(RenderingContext context, AttributeKey attrKey);

Using Code Templates in JDeveloper

While coding in JDev, we often use code templates. For example, for writing 'System.out.println();', we can write 'sop' then press ctrl+Enter.
We can also create our own code templates and then when required, instead of writing the complete code, we can simply use custom shortcuts for our code.

Here I have shown how to create and use these custom code templates.

Mostly we face a requirement to navigate from one page to another on button click and also passing some parameters along with that. Below are steps for creating template for this:

1) Go to 'Tools --> Preferences...'


2) On Preferences window, expand 'Code Editor --> Code Templates'.


3) Click on Add, enter shortcut and description. In the code tab, write the code which you want on that shortcut as shown below:


4) Also, if we want to import some classes for that code, we can write those in 'Imports' tab.


5) Now we only need to write this shortcut 'navOnBtn' then press ctrl+Enter. This will automatically replace that shortcut name with the complete code.