Tuesday, 6 October 2015

Enbaling the ARchivelog

1. Fire up your SQL *PLUS and log in with SYSDBA priveledges.

START > RUN > sqlplus

SQL > CONNECT sys/passTheAdmin AS SYSDBA

2. Issue a Shutdown command

SQL > SHUTDOWN IMMEDIATE;

 
3. Mount yourDatabase

SQL > STARTUP MOUNT;

 
4. Set your database in ARCHIVELOG mode

SQL > ALTER DATABASE ARCHIVELOG;



5. Open your database

SQL > ALTER DATABASE OPEN;

Monday, 11 May 2015

Displaying the table



Result Based:Simple  search
-- Query Region>> construction Mode:result based serach
-- RC on QueryRN>>New Region using Wizard,region style table
-- Change the properites of attributes to search allowed true


Autocustomization Search
--Query region>>Coustion mode :Auto customization
-- RC on QueryRN>>New Region using Wizard,region style table
--RC on QueryRN,select simple serach panel
  RC on Region1 select messageTextimput
--RC on QueryRN select new simple search mapping


Inlinve LOV:
-- RC on PAgelayout for New item>>id,style:MessageLOVinput,prompt
--RC on region1 select new table using wizard select the attributes
--Set search allowed property for the attributes
--set LOVMap1 properties:Number


Extenal LOV

--Create a region in webui
--Create a page and new item in page
  item properties:
   style:LOV
   External LOV : is from Region in webui
   Expand LOv and select the attribute

Pop list
--Vo
--AM
--PG--pageLayoutRN
--New Item style:Message Choice
  select the Attributes

Friday, 13 March 2015

Order to Cash Cycle

Order to cash flow is the process of entering an order ,delivery of the the goods, then producing the invoice for the goods.


Creating the Order:
1)Navigation: Order Management Super user,Vision Operations(USA) >>Orders, Returns > Sales Orders
Enter the Customer Name ,Order type in the Order Information Form


2)Go to the Line items tab
Enter the ordered item,Quantity


3) Click on the Book Order button




4)Run the sql query
select order_number, header_id, flow_status_code from oe_order_headers_all
where order_number = 66555;
This is related to the Header information

select flow_Status_code from oe_order_lines_all where header_id = 195864;

Here the line status is Awaiting Shipping


Pick Release:

1)Navigation: Shipping>>Transaction>>

In the Query Manager screen, enter the order number in the From Order Number field and tab out. Then, click on the Find button.


Click on the Actions and select Launch Pick Release for the LOV then Go
The following Message will be displayed


Now Check for the status in the same form






Ship Confirm:
1)Move on to the Delivery tab and select the Ship confirm button then ok then the confirmation message is displayed.



2)Run this query

select delivery_detail_id, released_status, oe_interfaced_flag, inv_interfaced_flag
from wsh_delivery_details
where source_code = 'OE' and source_line_id = 393680;



Released_Status is C (Shipped) becomes shipped after the ship confirm
OE_Interfaced_Flag is Y –Interface Trip Stop has interfaced shipping data to OM
Inv_Interfaced_flag = Y -- Interface Trip Stop has interfaced shipping data to INV

Invoice:
1)Checking the line status
Move on to sales order form and query the sale order, move onto the line item tab and check the status of the line as”SHIPPED”
Go to the Tools>>Workflow Status




2)Verify that the order line workflow is now at the Fulfill - Deferred activity with a status of Deferred. This means that the next steps is to run the Workflow Background Process.

Navigate to sale order form and view>>Request

Run the workflow background program


Check whether this program is successfully completed. In addition to this notice that the AR concurrent requests Autoinvoice and Autoinvoice Import Program will run automatically to import the invoices into AR.

3)The workflow status for the order line (go to Tools > Workflow Status) should now show the following progression.


4)Run this sql Query

select line_id, open_flag, flow_status_code, invoice_interface_status_code
from oe_order_lines_all
where line_id = 393680;


5)Move on to the sales order Form and Line Items then Click on the Action button select Additional Information from the LOV.
Move onto the Deliveries tab here the status is Closed and pick status is Shipped

Check for the line status Closed.

This Status (Closed) indicates that the O2C cycle has completed successfully.

Wednesday, 25 February 2015

Cursor using the for loop
Example:
declare
p number(6);
cursor c is
select * from emp for update;
begin
for i in c
loop
select avg(sal) into p from emp where empno=i.empno group by deptno;
dbms_output.put_line(i.empno);
end loop;
end;

WHILE LOOP:
declare
cursor c is
select * from emp;
x emp%rowtype;
begin
open c;
fetch c into x;
while (c%found) loop
dbms_output.put_line(x.ename);
fetch c into x;
end loop;
end;


so, better to use the for loop

Friday, 20 February 2015

*******Fields present in the Requisition Form*****************

select distinct prha.segment1 Requisition_Number
,hou.name operating_unit
,prha.description
,prha.authorization_status Status
,prla.item_description
,prla.unit_meas_lookup_code UOM
,prla.unit_price
,prla.quantity
,prla.need_by_date
,prla.purchase_basis
,prla.destination_type_code
,papf.full_name
,msib.segment1 item
,mcb.segment1||'.'||mcb.segment2 as Categories
,gcc.code_combination_id
,gcc.segment1||'-'||gcc.segment2||'-'||gcc.segment3||'-'||gcc.segment4 as Charge_Account
,okhb.CONTRACT_NUMBER
from
hr_operating_units hou
,po_requisition_headers_all prha
,po_requisition_lines_all prla
,per_all_people_f papf
,mtl_system_items_b msib
,mtl_categories_b mcb
,gl_code_combinations gcc
,PO_REQ_DISTRIBUTIONS_ALL prda
,okc_k_headers_b okhb
where 1=1
and prha.org_id=hou.organization_id
AND prla.creation_date BETWEEN papf.effective_start_date AND papf.effective_end_date
and prla.requisition_header_id=prha.requisition_header_id
and prha.preparer_id =papf.person_id
and msib.inventory_item_id =prla.item_id
and prda.code_combination_id=gcc.code_combination_id
and prda.requisition_line_id =prla.requisition_line_id
and prla.category_id =mcb.category_id
and prha.segment1 = :Requisition
and prla.OKE_CONTRACT_HEADER_ID=okhb.id;
Query to build the  list the supervisors for a given employee in a single column

the format is as

Employee_1 -> Employee_2 -> Employee_3 -> Employee_4
where Employee_2 is the supervisor of Employee_1 and so on.




SELECT
 DISTINCT SYS_CONNECT_BY_PATH(FULL_NAME, '->') "Path",
LEVEL LVL
FROM
  PER_ALL_PEOPLE_F PPFS,PER_ALL_ASSIGNMENTS_F PAFE
WHERE 1 = 1
and PPFS.PERSON_ID =  PAFE.person_ID
AND TRUNC (SYSDATE) BETWEEN PAFE.EFFECTIVE_START_DATE AND PAFE.EFFECTIVE_END_DATE
AND TRUNC (SYSDATE) BETWEEN PPFS.EFFECTIVE_START_DATE AND PPFS.EFFECTIVE_END_DATE
and level = 3
  CONNECT BY Ppfs.PERSON_ID = PRIOR Pafe.SUPERVISOR_ID  -- PPFS,PAFE
 START WITH Ppfs.PERSON_ID = &Numbe ;

Wednesday, 18 February 2015

Nth highest Salary.........................!  :P



select top 1 from
(select distnict top n from emp  --retrving the nth highest salary
order by sal desc) result
order by sal;



with result as
(select sal,dense_rank() over (order by salary desc) as denserank
from emp)
select salary 
from emp
where result.denserank=n;


SQL::
Updating the column with value as D when it is duplicated.

Please go through the process.............................!

create table Emp_testing as select * from emp;//Creating the Table

select * from Emp_testing;

insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');                          
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
 insert into Emp_testing values('7369','SMITH','CLERK','7902','17-DEC-80','800','','20');
commit;

alter table Emp_testing add status varchar2(4);

select empno,ename,job,mgr,hiredate,sal,comm,deptno,status,count(1) as counts
from Emp_testing group by empno,ename,job,mgr,hiredate,sal,comm,deptno,status;

UPDATE Emp_testing t2
    SET t2.status = 'D'
    WHERE t2.rowid > (SELECT min(t1.rowid)
                    FROM Emp_testing t1
                    WHERE t1.ename=t2.ename);

you will the output in Status  column with D value it indicates that Those are duplicates

Friday, 23 January 2015

Deploying steps

Deploy OAF page

1. Copy all files from local machine to appropriate $JAVA_TOP directory 
2. Compile all java files (Controller Files) with command javac <file_name>.java
3, Call java importer to import all xml files
java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/prajkumar/oracle/apps/fnd/webui/HelloWorldPG.xml -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= <name of HOST>)(PORT=<port_number>))(CONNECT_DATA=(SID=<SID_NAME>)))" -rootdir $JAVA_TOP
4. Print Documents to check imported XML page content (Optional)
jdr_utils.printDocument('/prajkumar/oracle/apps/fnd/webui/HelloWorldPG',1000)
 
Example –
DECLARE
BEGIN
jdr_utils.printDocument('/xxapps/oracle/apps/fnd/webui/HelloWorldPG',1000);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
 
5. Create form function with property "SSWA jsp function" and webhtml "OA.jsp?page=xxapps/oracle/apps/fnd/webui/HelloWorldPG"
 

 

 

 
6. Add function to menu

 
7. Add menu to responsibility
 


8.Add this responsibility to the required user to get the our OAF page and Login with the user navigate to the responsibility menu and function then we will get the OAF page in the Application.

Basics of OAF

OAF Basics

With arrival for R12 and now Oracle Fusion, oracle is moving from Forms based interface to
Web based UI. So now days there is a buzz of OAF and ADF which has been the bases for development
of these Web based UI for Oracle ebiz.

Oracle Application Framework(OA Framework) is a proprietary framework developed by Oracle Corporation for application development within the Oracle E-Business Suite.
OA Framework is an architecture for creating web based front end pages and J2EE type of applications within the Oracle EBS ERP platform. In order to develop and maintain OAF functionality, Oracle's JDeveloper tool is used. OA Framework uses the UIX other XML technologies for building the components.

OA Framework is based on J2EE technology called BC4J (Business Components for Java)
The OA Framework is a Model-view-controller (MVC) framework built using J2EE (Java 2 Platform, Enterprise Edition) technologies.

                              

EO(Entity Objects)
Entity Object is based on database table or other data source.Entity Object contains attributes which represent database columns.All insert/update/delete (DML Operations) transactions go through EO to database.

VO:
View Objects are based on EO or SQL Query which is again based on EO Objects
Two types
1. SQL based
2. EO based
Basically VO is synonymous to views used in PLSQL Programming they are used for joining tables, filtering based on conditions and sorting the data. Entity Objects can be based on any number of
EO and provide access to EO.

Application Module:
Its a container for VO. Once you create a Application Module you need to associate the corresponding
VO to the Application Modules. Access to the VO is always provided through the Application Module.
Every Page in OAF Framework need to be associated with a AM.

Controller:
When user clicks a button, or performs certain action what responses should be triggered is coded in the
Controller. All the responses to User actions, Application Flow is coded into the Controller. m
Model objects like EO and VO can't be accessed directly from the Controller Class, except AM.

Some common methods that controller has
1. ProcessRequest: Fires when OAF page loads for the first time
2. ProcessFormRequest: Fires when user submits the page.

Below is the Onion ring MVC architectural representation, it explains how the security/encapsulation of
each layer happens when an OAF application is build. 

Creating the Data Entry Page

1. Create a New Workspace and Project
Right click Workspaces and click create new OAworkspace and name it as InsertDemo. Automatically a new OA Project is also created. Name the project as InsertDemo and package as xxapps.oracle.apps.fnd.insertdemo
 
2. Create a New Application Module (AM)
Right Click on InsertDemo > New > ADF Business Components > Application Module
Name -- InsertAM
Package -- xxapps.oracle.apps.fnd.insertdemo.server
 
3. Enable Passivation for the Root UI Application Module (AM)
Right Click on InsertAM > Edit InsertAM > Custom Properties >
Name – RETENTION_LEVEL
Value – MANAGE_STATE
Click add > Apply > OK
 
4. Create Test Table in which we will insert data (For Testing Purpose)
CREATE TABLE xx_insert_demo
(        -- --------------------- 
         -- Data Columns  
         -- --------------------- 
         column1                           VARCHAR2(100), 
         column2                           VARCHAR2(100), 
         -- ---------------------             
         -- Who Columns              
         -- ---------------------            
         last_update_date          DATE            NOT NULL, 
         last_updated_by           NUMBER     NOT NULL, 
         creation_date                 DATE            NOT NULL, 
         created_by                      NUMBER     NOT NULL, 
         last_update_login        NUMBER 
);

 
5. Create a New Entity Object (EO)
Right click on InsertDemo > New > ADF Business Components > Entity Object
Name – InsertEO
Package -- xxapps.oracle.apps.fnd.insertdemo.schema.server
Database Objects -- XX_INSERT_DEMO
 
Note – By default ROWID will be the primary key if we will not make any column to be primary key.
Check the Accessors, Create Method, Validation Method and Remove Method
 
6. Create a New View Object (VO)
Right click on InsertDemo > New > ADF Business Components > View Object
Name -- InsertVO
Package -- xxapps.oracle.apps.fnd.insertdemo.server
In Step2 in Entity Page select InsertEO and shuttle them to selected list
In Step3 in Attributes Window select columns Column1, Column2 and shuttle them to selected list
In Java page deselect Generate Java file for View Object Class: InsertVOImpl and Select Generate Java File for View Row Class: InsertVORowImpl
 
7. Add Your View Object to Root UI Application Module
Right click on InsertAM > Edit InsertAM > Data Model >
Select InsertVO in Available View Objects list and shuttle to Data Model list
 
8. Create a New Page
Right click on InsertDemo > New > Web Tier > OA Components > Page
Name -- InsertPG
Package -- xxapps.oracle.apps.fnd.insertdemo.webui
 
9. Select the InsertPG and go to the strcuture pane where a default region has been created
 
10. Select region1 and set the following properties:
ID -- PageLayoutRN
Region Style -- PageLayout
AM Definition -- xxapps.oracle.apps.fnd.insertdemo.server.InsertAM
Window Title -- Date Entry Page Window
Title -- Data Entry Page
Auto Footer -- True
 
11. Right click PageLayoutRN > New > Region
ID -- MainRN
Region Style -- defaultSingleColumn
 
12. Create Text Input Items
Right click on MainRN > New > Item
Set following properties for New Item
ID -- COLUMN1
Item Style -- messageTextInput
Maximum Length -- 100
Length -- 20
Prompt -- Column1
View Instance -- InsertVO1
View Attribute -- Column1
 
Again Right click on MainRN > New > Item
Set following properties for New Item 
ID -- COLUMN2
Item Style -- messageTextInput
Maximum Length -- 100
Length -- 20
Prompt -- Column2
View Instance -- InsertVO1
View Attribute – Column2
 
13. Add Apply and Cancel Buttons
Right click on PageLayoutRN > New > Region
         ID -- PageButtons
         Region Style -- pageButtonBar
 
Right click on PageButtons > New > Item
ID -- Cancel
Item Style -- submitButton
Attribute Set -- /oracle/apps/fnd/attributesets/Buttons/Cancel
Disable Server Side Validation -- True
Prompt -- Cancel
Warm About Changes -- False
Additional Text – Select to cancel this transaction.
 
Right click on PageButtons > New > Item
ID -- Apply
Item Style -- submitButton
Attribute Set -- /oracle/apps/fnd/attributesets/Buttons/Apply
Prompt -- Apply
Additional Text – Select to save this transaction.
 
14. Implement Row Initialization (Create a View Object Row)
Add createRecord method to your InsertAMImpl class
import oracle.jbo.Row;
import oracle.apps.fnd.framework.OAViewObject;
...
  
public void createRecord()
{
  OAViewObject vo = (OAViewObject)getInsertVO1();
 
  if (!vo.isPreparedForExecution()) 
  { 
 vo.executeQuery(); 
  }
 
  Row row = vo.createRow();
  vo.insertRow(row);
  row.setNewRowState(Row.STATUS_INITIALIZED);
} 
 
15. Create Controller for Page  
PageLayoutRN > Set New Controller >
Package Name: prajkumar.oracle.apps.fnd.insertdemo.webui
Class Name: InsertCO
 
16. Add Create Page Initialization to your Controller
Add following code to your processRequest()
import oracle.apps.fnd.framework.OAApplicationModule;
...
 
public void processRequest(OAPageContext pageContext,OAWebBean webBean)
{
  super.processRequest(pageContext, webBean);  
 
  if (!pageContext.isFormSubmission())
  {
   OAApplicationModule am = pageContext.getApplicationModule(webBean);
   am.invokeMethod("createRecord", null);
  }  
}

 
17. Add below method in InsertAMImpl Class to handle Apply Button action
import oracle.jbo.Transaction;
...
 
public void apply()
{
  getTransaction().commit();
}

 
18. Add below Logic in InsertCO to handle Apply Button
Add following code to your processFormRequest()
import oracle.jbo.domain.Number; 
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
...
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{super.processFormRequest(pageContext, webBean);
 OAApplicationModule am = pageContext.getApplicationModule(webBean);
 // Pressing the "Apply" button means the transaction should be
 // validated and committed.
              
 if (pageContext.getParameter("Apply") != null) 
 {
  OAViewObject vo = (OAViewObject)am.findViewObject("InsertVO1");
  String column1 = (String)vo.getCurrentRow().getAttribute("Column1");
  String column2 = (String)vo.getCurrentRow().getAttribute("Column2");
                     
  am.invokeMethod("apply");
                     
  // Create a FND Message with name "TEST_CREATE_CONFIRM" with two 
  // tokens                   
  MessageToken[] tokens = { new MessageToken("COLUMN1", column1),
                            new MessageToken("COLUMN2", column2) 
                          };
 
  OAException confirmMessage = new OAException( "FND",
                                 "TEST_CREATE_CONFIRM", tokens,
                                 OAException.CONFIRMATION, null);
   
  pageContext.putDialogMessage(confirmMessage);
  pageContext.forwardImmediately(
   "OA.jsp?page=/prajkumar/oracle/apps/fnd/insertdemo/webui/InsertPG",
    null, OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true, // retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
 }
}
 
 
 
19. Congratulations you have successfully created data insert page. Run InsertPG page to test Your Work