Monday 22 June 2015

Single Invoice Creation API in Oracle Apps

     Lets discuss about single invoice creation API in Oracle Apps. Here invoice has been created by passing only mandatory values.

Below is the PL/SQL block Where the API AR_INVOICE_API_PUB has been called.


DBMS Output :








Invoice Header info from the Application:









Invoice Line Info from the Application :

Friday 19 June 2015

Create a Folder from database objects in Discoverer

   Lets discuss how to create a Folder from database objects i.e view in discoverer to create a report.

1) Login to Oracle Discoverer Administrator
2) Open the Business area where to create the folder
3) Go to Insert=>Folder=>New











 4) Select On-line dictionary to load the meta data from and click on Next
















5) Select the schema of the object and the object name and click on next

















6) Move that Object to the right side
















7) As it is a simple folder uncheck all the check boxes and click on Next
















8) If required make any changes for the available option or keep as it is and click on Finish

 















9) Now the folder is available in the Business Area

Wednesday 17 June 2015

Enable About this Page and Personalize Page in OAF

Let us discuss how to enable About This Page and Personalize Page in OAF.

Below is the page which does not show About This Page and Personalize Page.











1) Go to System Administrator=>Profile=>System.
2) Check the User and select the user name from LOV
3) Find the profile FND: Diagnostics as below
















4) Set the profile value at user Level to Yes. And save 












5) Select the user and Find the Profile option Personalize Self-Service Defn












6) Set the Profile Value at user level to Yes as below and Save.










7) Now the OAF page is showing About this Page and Personalize Page for the user.

Wednesday 10 June 2015

Unable to Open Form Personalization Window -Solution

            When you try to open form personalization window from Help=>Diagnostics=>Custom Code=>Personalize You May get below error.












Solution:
You need to set the profile option 'Utilities: Diagnostics' and set this to 'Yes' at Responsibility Level.
Go to System Administrator=>Profile=>System















Select the Responsibility and profile then Click on Find








Now the Form Personalization Window will be opened.










You can also set this profile option at different Level i.e Site Level,User Level

User Creation API in Oracle Apps

    Using the API fnd_user_pkg.createuser you can create user in Oracle Apps. You can find the below PL/SQL block to create user by passing the user details to the API as input parameter.



Once it is created you can check that from the database by using below query.

You can also verify this from the application

Log Into System Administrator Responsibility=>Security=>User=>Define
Press F11 and enter the user name =>Press CTRL+F11. 


Tuesday 9 June 2015

Some Coding Standards or tips to create Custom Table in Oracle Apps

If you are creating a custom table in Oracle apps you can follow some below coding standards or Tips.

1) Create the custom table in Custom schema not in apps schema.
2) Avoid the length of the table name to 30. ( 30 char is the max. allowed for table name. It is better to create the table name max to 29 char)
3) The table name should start with XX_(It is better to use the schema name with XX. Eg. If you are creating a table in XXINV schema then create the table starts with XXINV_tablename)
4) Avoid using the datatype LONG and LONGRAW if it is that much necessary.
5) Avoid using the Hash(#) in the table name.
6) Avoid the length of table column name to Max i.e 30
7) Avoid the Hash(#) in the column name.
8) Avoid use the Alphanumeric table names.
9) Avoid unique table name.
Eg: You have created table1 with length of table name is 29 char and avoid to create table2 with same name as table1 till 29th char and only the change in 30th char.
10) The custom table should have WHO columns.
The who columns in Oracle Apps
     1) created_by
     2)Creation_date
     3)Last_update_date
     4)Last_updated_by
     5)last_update_login
11) Avoid using LOB data fields if it is not necessary.
12) Create a view for the custom table in the same custom schema and the column should match with both the table and the view.
13) Create a SYNONYM for the view in apps schema.
14) Don’t create the SYNONYM on custom schema. Create the SYNONYM for the View which is referring to the custom table. 
15) Register the custom table to Apps using AD_DD package. To register table you can go through  Script to Register Custom Table using AD_DD Package



Monday 8 June 2015

Ref Cursor in PL/SQL

      Ref cursor or Cursor Variable is a pointer to a result set in database. Ref cursor is the pl/sql datatype whose value is the memory address of a query work area in database.

Characteristics of a Ref Cursor:
1) Ref cursor refers to the Memory address on the database.
2) A ref cursor involves an additional database round trip. The data is not to be retrieved until the user attempts to read it.
3) Ref Cursor is not updatable. You cannot update the database by using Ref cursor.
4) A Ref Cursor is not backward scrollable. The data represented by the Ref Cursor is accessed in forward-only serial manner.
5) A Ref-Cursor is PL/SQL datatype. You create and return a ref cursor in PL/SQL Block.

Difference between Normal cursor and Ref Cursor:
1) Cursor doesn't have a return type but A Reference Cursor have a return type
2) REF cursor can be assigned dynamically while Normal cursor once defined cann't be changed.
3) Ref cursor can be associated with many no. of sql statements where cursor can be associated only with one sql statement.
4) Using Ref Cursor we can pass cursor data as parameter to the procedure or function but in normal cursor it is not.

Types of Ref Cursor:

There are 2 types of Ref Cursor

1) Strongly Typed Ref Cursor:
Ref Cursor with Return type is called strongly typed Ref Cursor.

2) Weakly Typed Ref Cursor:
Ref Cursor without return type is called weakly Typed Ref Cursor.

General Syntax:
TYPE cursor_name IS REF CURSOR [RETURN return_type];
Example for Strongly typed Ref Cursor:

Table creation Script


PL/SQL Block for Strongly Typed ref cursor:
 

OUTPUT:







Example for Weakly Typed Ref Cursor:

Refer the same table created above.


Output:









Difference between Strongly Typed and Weakly typed Ref Cursor:
1) A strongly typed cursor always returns a known Type . But weakly typed ref Cursor has return type that depends on the SQL query executed.
2) In Strongly typed Ref Cursor the Compiler find the problems in a PL/SQL Block by comparing the types returned. But In weakly typed Ref cursors compiler cannot find the problem at compile time.
3) In strongly typed Dynamic query is not possible but in weakly typed Dynamic Query is possible.

SYS_REFCURSOR:
SYS_REFCURSOR is same as the weekly typed ref cursor and that can be used to pass cursors from and to a stored procedure.
If you are using SYS_REFCURSOR then no need to use the TYPE for declaration.

General Syntax :
Ref_cursor_name SYS_REFCURSOR;

Create a procedure and use the same table created above.


Call the procedure by passing ref cursor


Output:

Oracle ADF Key Components

ADF Model:
     ADF Model is a declarative framework that provides an abstraction layer between business services and the view and controller layers of an enterprise application that standardizes the way that components in those layers interact with each other.

ADF Business Components:
       ADF Business Components are prebuilt application objects that are based on Java EE design patterns and best practices and which simplify the development and maintenance of complex, high-performance, and database-centric services.

ADF Controller:
      ADF Controller provides an enhanced navigation and state management model on top of JSF’s controller layer. Using JDeveloper, you can declaratively create task flows that can manage application control between different types of activities, such as pages, methods on managed beans.

ADF Faces:
ADF Faces provides the view layer for ADF applications.

ADF Mobile Browser:
     ADF Mobile browser enables you to create application views that are optimized for browsers on small devices.

ADF Desktop Integration:
    ADF Desktop Integration enables developers to extend Fusion web applications so that end users can work with them using Microsoft Excel workbooks as a client.

ADF Swing:
     ADF Swing is a framework for developing databound Java clients that use ADF Model to access business services.

ADF Security:
     The ADF Security framework uses and extends the Oracle Platform Security Services (OPSS) architecture to simplify the securing of ADF applications and enables fine-grained access control for ADF resources such as bounded task flows.

Oracle Metadata Services:
    The Oracle Metadata Services (MDS) framework allows you to create applications that your customers can further customize for their users or customers and which the end users can also customize without touching the source code or affecting the ability of the application to be patched or updated.


Source: Oracle Documentation

Friday 5 June 2015

Cursor in PL/SQL- Part 2

   In the previous  post Cursor in PLSQL-Part 1 we have discussed about the basics of PL/SQL Cursor. Let us discuss more about the Cursors in this post.

Cursor FOR-LOOP:
   Using cursor FOR LOOP you can process the records in the cursor without using OPEN and Fetch the Cursor. The Cursor FOR LOOP handles open and fetch the records from the cursor.

General Syntax for cursor FOR-LOOP :


You can refer the below example for Cursor FOR LOOP.

 

Output:












Parameterized Cursor:
  You can also pass the parameters to the cursor and while calling you need to call the cursor with parameter value.

General Syntax:


You can go through the below example for parameterized cursor.


Output:










Cursor FOR LOOP without declaring a Cursor:
    You can use the cursor FOR LOOP without declaring a cursor in DECLARE block. While using the for loop you can use the select statement.

General Syntax:

You can go through the below example.


Output:

Objects in PL/SQL-Part1

        Oracle object types are user-defined types that make it possible to model the real world entities, such as employees, customers and Customer Order details as objects in the database.

     New Object types can be created using any built-in datatypes, Composite data types, collections or existing object types.

    Object Type model is same as classes in any other languages such as C++, Java.

Advantages of Objects:
1) Objects can encapsulate the operations along with data:
     Any database table contains only the data but objects can have both data and  methods/functions.
2) Objects are efficient:
    As the objects consists both data and operations and metadata is stored in the database, Developers can re-use these objects as it is. It provides the re-usability option.
3) Objects can re-presents Part-Whole relationships.
    Object types allow you to represent part-whole relationships. Any object can have another object as attribute.

Object Types:
    Object types are database schema objects which defines both structure and behavior. You can use object types as normal datatypes like NUMBER, VARCHAR2.

Structure of an Object Type:
An object type has 2 parts:
1) Specification : Specification declares a data structure i.e. set of attributes and Operations called methods needed to manipulate the data .

2) Body: The body part defines the methods declared in the specification i.e. body implements the specification.

General Syntax:
1) Specification:


2) Body:


Thursday 4 June 2015

Hello World Page in ADF 12C

Let us discuss about the steps to create ADF Fusion Web Application and Simple Hello World Page 
in JDeveloper 12C.

1) Open JDeveloper 12C .
2) Select File =>New=>Application.
3) From the Item list at right side ADF Fusion Web Application.
 









4) Write the Application name and Application Package prefix . Click on Next.
 









5) By Default it displays the Project Name and Directory. Select ADF Business Components . 

Click on Next.
 


6) It displays the Default package information, Java Source path and Output directory. Click on Next
 










7) It displays the project name as ViewController and the directory path. Select ADF Faces.Click on Next.
 










8) It displays the default package information for ViewController. Click on Next
 










9) By Default it selects Use Jdeveloper’s default build tools radio button. Click on Finish.
 












10) Fusion web Application quick start check list will be opened and it shows step by step instructions 
to build the application.
 













11) Expand the ViewController =>Web Content=>WEB-INF and Click on adfc-config.xml
 












12) Drag the View component from right side to the adfc-config.xml page and rename it. Double click on the Component.
 


 13) Below page will be appeared.
 









14) Select JSP XML radio button and the radio button Reference ADF Page Template and Click on ok.
 


15) Expand text and selection from ADF Faces from Right Side. Select Output Text and drag it to the JSPX page.
 







16) Re-name that output textbox to HelloWorld …!!!
 










17) Type the header name to Hello World Page.
 







18) Click on save All . Right click on JSPX page and click on Run.
 












19) The output will be as below.