Monday, October 08, 2012

Using CALL_FORM to invoke another form in Oracle Applications

The following topics will be discussed in this article:
  1. Overview of CALL_FORM.(Instead of call_form, we use fnd_function.execute in oracle apps)
  2. Steps for Development of Calling Form(XXPO_VENDORS.fmb).
  3. Steps for Development of Called Form(XXPO_VENDOR_SITES.fmb).
  4. Called Form Registration in Oracle Applications 11i (XXPO_VENDOR_SITES.fmb).
  5. Calling Form Registration in Oracle Applications 11i(XXPO_VENDORS.fmb).
1. Overview of CALL_FORM: (In Oracle Applications, we use fnd_function.execute instead of call_form)
CALL_FORM, OPEN_FORM, NEW_FORM are the Built-ins that will help us in creating “Multiple Form Applications”.
This built-in is used to invoke more than one form in a single session.
If one form is invoking other form, then invoking form is called as “Calling Form”.
The invoked form is called as “Called Form”.
This built–in is incompatible with OPEN_FORM, which is used by Oracle Applications routines. So you should use FND_FUNCTION.EXECUTE instead of either CALL_FORM or OPEN_FORM whenever you need to invoke a form programmatically. FND_FUNCTION.EXECUTE allows you to open forms without bypassing Oracle Applications security, and also takes care of finding the correct directory path for the form.
Syntax:-
FND_FUNCTION.EXECUTE
(function_name IN varchar2,
open_flag IN varchar2 default ‘Y’,
session_flag IN varchar2 default ‘SESSION’,
other_params IN varchar2 default NULL,
activate IN varchar2 default ‘ACTIVATE’,
browser_target IN varchar2 default NULL);

Description:  Executes the specified form function. Only executes functions that have a form attached. Displays a message to the end user if the function is not accessible.
Arguments:-
Function_Name:
The developer name of the form function to execute.
Open_flag:
‘Y’ indicates that OPEN_FORM should be used; ‘N’ indicates that NEW_FORM should be used.
You should always pass ‘Y’ for open_flag, which means to execute the function using the Oracle Forms OPEN_FORM built–in rather than the NEW_FORM built–in.
Session_flag: Passing ‘NO_SESSION’ or ‘N’ opens the form in the same session as the existing form; passing anything else opens your form in a new database session (including ‘SESSION’, the default).
Other_params:
An additional parameter string that is appended to any parameters defined for the function in the Parameters field of the Form Functions form. You can use other_params to set some parameters dynamically. It can take any number of parameters.

Example: From Vendor Details Form (XXPO_VENDORS.fmb) call the Vendor Site Details Form (XXPO_VENDOR_SITES.fmb) when I click on the Button Called “Sites”
2.Steps for Development of Calling Form(XXPO_VENDORS.fmb).:-
Step1:- Open Template.fmb with form builder save it with another name(XXPO_VENDORS.fmb).
Step2:- Delete “BLOCKNAME” from Window,Canvas and Data Block and delete “DETAILBLOCK” from Data Block.

Step 3:-
Create Window (XXPOWINDOW) apply subclass information as “WINDOW” and give the title.

Step 4:-
Give this window name in PRE-FORM trigger (Form Level) and give this window name in APP_CUSTOM body Program_Unit (in place of window name).

Compile and Close the window.
Next go to Program Units(APP_CUSTOM body) give the window name in 2 places as shown in below and Compile the Program Unit.



Step 5:- Create Canvas(DEPT_CANVAS) apply subclass information as Canvas.

Here Window is attached automatically.

Step 6:
Now Create Data block (PO_VENDORS) with Wizard or Manual, apply subclass information to the block as “BLOCK”   and also apply subclass information to the items as “TEXT_ITEM”.


Click on Next

Click on Next. Next…Finish.

Move Available Items to Display Items.(So, These items will be display on the “XXPOVENDORS” Canvas.

Click on Next.
Here give the Form title.


Go to Object Navigator(F3) Place cursor on the data block(PO_VENDOERS) apply sub class information as “BLOCK”

And apply subclass information to all items (as “TEXT_ITEM”) which exists in the block (PO_VENDORS).

Step 7:-Now create one button in the Canvas and give the name as “Sites”.


Now my Requirement is ,When I Click on the Sites button a new form(XX_PO_VENDOR_SITES) will be displayed with data based on vendor_id.
So we have to write code in the “WHEN-BUTTON-PRESSED” trigger of “Sites ”
Button.
:Global.vendor:=:po_vendors.vendor_id;
fnd_function.execute(FUNCTION_NAME=>’XXPO_VENDOR_SITES’,
OPEN_FLAG=>’Y’,
SESSION_FLAG=>’N’,other_params=>:Global.vendor);
Here we need to give called form function name so we have to develop a form(XXPO_VENDOR_SITES.fmb) and register this form in apps with function” ‘XXPO_VENDOR_SITES”.
other_params => here it is used to pass vendor_id from vendor details form to vendor site details form.
Compile and Close the window, and save the changes.
Step 8: Move this form from Local Machine to the Custom TOP(xxmz) using WINSCP Tool

Step 9: Compile the Form using f60gen in Unix Environment.(Putty or WINSCP Console)
$f60gen XXPO_VENDORS.fmb apps/apps

3.Steps for Development of Called Form(XXPO_VENDOR_SITES.fmb):-
Step1 : Open Template.fmb with form builder save it with another name(XXPO_VENDOR_SITES.fmb).

Step 2: Delete the block name from window, canvas ,data block and delete the detail block from data block.
Step 3: Now create a window and apply subclass information as “WINDOW”.

Step 4 : Give this window name in PRE-FORM trigger (Form Level) and give this window name in APP_CUSTOM body Program_Unit (in place of window name).

Compile and Close the window.

Compile and Close the Window.
Step 5 : Now create a canvas and apply subclass information as “CANVAS”.

Step 6 : Now create a data block for vendor sites.


Click on Next..finish


Click on Finish button

Now go to Object Navigator(f3) Click on the block apply subclass information as “BLOCK” and apply sub class information as”TEXT_ITM” for all items that exists in the block.


In “WHEN-NEW-FORM-INSTANCE” trigger give
Execute_query;

And go to Property Palette of “PO_VENDOR_SITES_ALL” data block
Give vendor_id=: Global.Vendor in the “WHERE Clause” Property.
Close and Save the changes.

Step 7 : Move the form(XXPO_VENDOR_DETAILS.fmb) from local machine to the custom top
Step 8 : Compile the form Using f60gen
$f60gen XXPO_VENDOR_SITES.fmb apps/apps
4.Called Form Registration in Oracle Applications 11i XXPO_VENDOR_SITES.fmb).
I . Create a Form.(Navigation:-Application Developer->Application-> Form)
Here give the Following Details:-
Form:-XXPO_VENDOR_SITES
Application: Custom Top Application Name(xxmz Custom)
User Form Name: any name(Vendor Site Details Form)
Description:any(Vendor Site Details Form)
Save and Close the form

II. Create a function (Navigation: Application->function)
Here give the following Details
Function:-any (XXPO_VENDOR_SITES)
Note:-“XXPO_VENDOR_SITES” is called form function name. So you have to give this function name in Calling Form (XXPO_VENDORS.fmb) “WHEN-BUTTON-PRESSED” trigger FND_FUCTION.EXECUTE(function=> XXPO_VENDOR_SITES)
User Function Name: any name(Vendor Site Details form Function)
Description: Any (Vendor Site Details form Function)

Go to “Properties” tab give the type as “Form”
Next Go to “Form” tab attach our user function form name here (i.e Vendor Site Details form).

Save and Close the form.
III . Attach that function to the Custom TOP menu
(Navigation: Application->Menu)
We can get Menu name from “Responsibility” Window of System Administrator.
(System Administrator->Security->Responsibility->Define)
Query with particular application name and responsibility name you will get “MENU NAME”
Copy that menu name, Query with that name in Application Developer Menu Window.
Here give the following Details:
Seq: Any Unique Number
Prompt: any (Vendor Site Details)
Function: Attach the User function Name (Vendor Site Details Form Function)

5.Calling Form Registration in Oracle Applications 11i(XXPO_VENDORS.fmb):-
I.Create a Form.(Navigation:-Application Developer->Application-> Form)
Here give the Following Details:-
Form:-XXPO_VENDORS
Application: Custom Top Application Name(xxmz Custom)
User Form Name: any name(Vendor Details Form)
Description:any(Vendor Details Form)
Save and Close the form

II. Create a function (Navigation: Application->function)
Here give the following Details
Function:-any (XXPO_VENDORS)
User Function Name: any name(Vendor Details Form Function)
Description: Any (Vendor Details form Function)

Go to “Properties” tab give the type as “Form”
Next Go to “Form” tab attach our user function form name here (i.e Vendor Details form).

Save and Close the form.
III.Attach that function to the Custom TOP menu
(Navigation: Application->Menu)
We can get Menu name from “Responsibility” Window of System Administrator.
(System Administrator->Security->Responsibility->Define)
Query with particular application name and responsibility name you will get “MENU NAME”
Copy that menu name, Query with that name in Application Developer Menu Window.
Here give the following Details:
Seq: Any Unique Number
Prompt: any (Vendor sub Form)
Function: Attach the User function Name (Vendor Details Form Function)

  • Switch responsibility to Custom TOP Application Responsibility.

Click on Menu Prompt (Vendor sub Form)


If you click on the “Sites” button the called form(XXPO_VENDOR_SITES.fmb) will be opened .(shown in below)

1 comment: