add

About Me

My photo
Oracle Apps - Techno Functional consultant

Wednesday, August 1

Oracle Forms Customizations

What it is

The CUSTOM library allows extension of Oracle Applications without modification of Oracle Applications Forms.
The custom library is an oracle forms PL/SQL library. It allows you to take full advantage of all the capabilities of the Developer suite of product and integrate your code directly with oracle application.

You can use the custom library for customization such as Calling other forms ,enforcing business rules  and disabling fields that apply for your site .

What are the Methods available to do the changes in Forms

There are two methods available to do the changes in Forms
·         CUSTOM.pll
·         FORMS Personalization (only available from 11.5.10 onwards )

 

How it works

  • In Oracle Apps every Form having form level triggers that makes call to CUSTOM.pll, as shown in the following picture.

 

Architecture of the custom library

    
          APPCORE2                                       Form
           Library                                           Standard triggers


 


          CUSTOM
          Library
                       
           Standard event triggers in the form call APPCORE2 routines that in turn call the CUSTOM Library .CUSTOM  is attached to APPCORE2 and APPCORE 2 is attached to all forms. So, the Custom library is global to all of oracle applications.

  • Oracle applications sends events to the custom library .  Your custom code can take effect based on these events.
  • You can use the custom library for customization such as Calling other forms ,enforcing business rules  and disabling fields that apply for your site.

Commonly used events that are trapped using CUSTOM.pll are
   ZOOM
   WHEN-NEW-FORM-INSTANCE
   WHEN-NEW-BLOCK-INSTANCE
   WHEN-NEW-RECORD-INSTANCE
   WHEN-NEW-ITEM-INSTANCE
   WHEN-VALIDATE-RECORD

What  we can do by using CUSTOM.Pll

CUSTOM.pll is used to add extensions to Oracle's form Functionality. Some of the common scenarios where CUSTOM.pll can be used are:-

1. Enabling/Disabling the fields
2. Changing the List of Values in a LOV field at runtime.
3. Defaulting values
4. Additional record level validations
5. Navigation to other forms.
6. Enabling Special Menu

Custom Library Location

The CUSTOM library is located in the $AU_TOP/resource directory .

Customization Steps

  1. First  move the Custom pll to the local directory.
  2. Then take backup of custom pll for this  rename the  CUSTOM.pll in $AU_TOP/resource Directory .
  3. Open CUSTOM.pll  through Form Builder  and  do the changes as per business logic ,then compile the coding and save as CUSTOM .pll.
  4. Move the  CUSTOM .pll  to the location of $AU_TOP/resource directory .
  5. Then through telnet go to the location of  $AU_TOP/resource folder and  compile the CUSTOM.pll .
  6. Then we can see the effect in the application.

Commands to compile

To convert from CUSTOM.pll to CUSTOM.plx
f60gen module_type=LIBRARY module=CUSTOM userid=apps/apps

To convert from CUSTOM.pll to CUSTOM.pld:f60gen module_type=LIBRARY module=CUSTOM script=YES userid=apps/apps

To convert back from CUSTOM.pld to CUSTOM.pll ( after having edited the text pld file )
f60gen module_type=LIBRARY module=CUSTOM parse=YES userid=apps/apps

How Multi-Developer do the changes at a time in CUSTOM.pll


Steps:

1.Create .pll library for the form you want to customize

   example:
            Package Body:
            PACKAGE BODY XXXXXAPXVDMVD
IS
PROCEDURE event (event_name VARCHAR2) IS
BEGIN
IF event_name = ‘WHEN-NEW-FORM-INSTANCE’ THEN
SET_ITEM_PROPERTY(‘VENDOR_TYPE_DISP’,REQUIRED,PROPERTY_TRUE);
END IF;
END event;
END XXXXXAPXVDMVD;

2.Attach your .pll to CUSTOM.pll.

cid:image005.png@01CD6FBB.E616BDF0


3.Call to your new .pll to CUSTOM.pll

Package Body of CUSTOM.pll
Form_name varchar2(30) := name_in(‘system.current_form’);
Begin
If form_name = ‘XXXXXAPXVDMVD’ THEN
xxxxxapxvdmvd.event(event_name);
Elsif form_name = ‘XXXXXOEXOEORD’ THEN
xxxxxoexoeord.event(event_name);
end if;
end event;

Custom.pll Screen Shot:

cid:image006.png@01CD6FBB.E616BDF0


Coding area in Custom pll

Example :


1. Change the label of a field
, Enabling/Disabling the fields and Make a field   
     mandatory.

Code:
procedure event(event_name varchar2) is
      form_name      varchar2(30) := name_in('system.current_form');
      block_name     varchar2(30) := name_in('system.cursor_block');
begin
      IF event_name = 'WHEN-NEW-FORM-INSTANCE'
      THEN
            IF form_name = 'POXPOEPO' and block_name = 'PO_HEADERS'  
            then
                  set_item_property('PO_HEADERS.AGENT_NAME',required,property_true);
                  set_item_property('PO_HEADERS.VENDOR_NAME',PROMPT_TEXT,'Joice Supplier');
                  set_item_property('PO_HEADERS.VENDOR_SITE_CODE',ENABLED,property_false);
            END IF;
      END IF;
end event;

Screen Shot:

Responsibility  : Purchaing, vision operations (USA)
Navigation       :  Purchase Ordersà Purchase Orders

Label Name    : Supplier after changes  Label Name : Joice Supplier
Lable Name    : Site after changes Enable properties false of the Site.




Label Changed                                                                        Enable Property false here


2. Create Dynamic  LOV
PROCEDURE EVENT(EVENT_NAME VARCHAR2)
IS
      FORM_NAME VARCHAR2(30) := NAME_IN('system.current_form');
      BLOCK_NAME VARCHAR2(30) := NAME_IN('system.cursor_block');
      QUERY_MODE VARCHAR2(30);
      RG_NAME VARCHAR2(40) := 'AP_ACCOUNT_TYPE';
      ERRCODE NUMBER;
BEGIN
      IF (EVENT_NAME='WHEN-NEW-ITEM-INSTANCE' )
      THEN
            IF (FORM_NAME='APXSUMBA' ) AND (BLOCK_NAME='ACCOUNTS')
            THEN
                  ERRCODE:= POPULATE_GROUP_WITH_QUERY('AP_ACCOUNT_TYPE' ,
                  'SELECT DISPLAYED_FIELD FROM AP_LOOKUP_CODES
                  WHERE LOOKUP_TYPE= ''BANK ACCOUNT TYPE''');
                  IF ERRCODE=0
                  THEN
                        SET_ITEM_PROPERTY('ACCOUNTS.BANK_ACCOUNT_TYPE',LOV_NAME ,'AP_ACCOUNT_TYPE');
                  ELSE
                        SET_ITEM_PROPERTY('ACCOUNTS.BANK_ACCOUNT_TYPE',ENABLED ,PROPERTY_FALSE);
                  END IF;
            END IF;
      END IF;
END EVENT;  

Screen Shot:

Responsibility  : Payables, vision operations (USA)
Navigation       :  Setupà PaymentàBank
                             Execute the Query (Ctrl+F11)
                             Click Bank Accounts we can seen the window, in this bank account type is used for dynamic lov.

Before Customization in  bank account type in payables Responsibility
the screen shot is like this .
Lov value are (BANK,C/C,CHECKING,CORPORATE,CURRENT)


After the customization the list of values are changed.

Responsibility  : Payables, vision operations (USA)
Navigation       :  Setupà PaymentàBank
                             Execute the Query (Ctrl+F11)
                             Click Bank Accounts we can seen the window, in this bank account type is used for dynamic lov.

After  Customization in  bank account type in payables Responsibility
the screen shot is like this .
Lov value are populated like this
(BANK, CHECKING,CURRENT,FRANCIS,JOICE)



3. Special Menu and ZOOM calling other forms 

ZOOM Enable:
FUNCTION ZOOM_AVAILABLE RETURN BOOLEAN
IS
      form_name  varchar2(30) := name_in('system.current_form');
      block_name varchar2(30) := name_in('system.cursor_block'); 
BEGIN
      IF (form_name = 'POXPOEPO' and block_name = 'PO_HEADERS') then
            return TRUE;
      ELSE
            return FALSE;
      END IF;
END ZOOM_AVAILABLE;

Event Call:
PROCEDURE EVENT(EVENT_NAME VARCHAR2)
IS
      mi_id          menuitem;
      form_name      varchar2(30) := name_in('system.current_form');
      block_name     varchar2(30) := name_in('system.cursor_block');
      P_Vendor_id    number;
      param_to_pass1 varchar2(255);
      param_to_pass2 varchar2(255);
      l_vendor_name  varchar2(250);  
BEGIN
      mi_id := find_menu_item('SPECIAL.SPECIAL15');
      IF form_name = 'POXPOEPO' and block_name = 'PO_HEADERS'
      THEN
            app_special2.instantiate('SPECIAL15', 'Calling Supplier Form');
            set_menu_item_property(mi_id, displayed, property_true);
            set_menu_item_property(mi_id, enabled, property_true);
      ELSE
            set_menu_item_property(mi_id, displayed, property_false);
      END IF;
 
      IF (event_name = 'SPECIAL15' or event_name = 'ZOOM')
      THEN
            Fnd_message.clear;
            Fnd_message.set_string('Very GOOD Joice Supplier Forms is coming --->>');
            Fnd_message.show;
            P_Vendor_id := name_in('PO_HEADERS.VENDOR_ID');
           
            fnd_function.execute(   FUNCTION_NAME=>'AP_APXVDMVD',
                                                OPEN_FLAG=>'Y',
                                                SESSION_FLAG=>'Y',
                                                OTHER_PARAMS=>'VENDOR_ID="'||to_char(P_Vendor_id)||'"'
                                          );                                             
      END IF;
END EVENT;  


Screen Shot:

Enabling Zoom button :
With Zoom, we can pass parameters from calling form to called form. 
In our case, I am passing the SUPPLIER NAME(Joice Supplier is the field Name) to the Supplier form, in which the Supplier Name’s corresponding data is fetched and displayed. 

Responsibility  : Purchaing, vision operations (USA)
Navigation       :  Purchase Ordersà Purchase Orders
Enable              :  ZOOM Button.





                                                                                   ZOOM BUTTON ENABLED




                                       ZOOM BUTTON CLICK


Before going to call the supplier form message  display

After the message the supplier form opens.


Sub menu Example:

In purchasing super user I enable one submenu under the tools menu . The name of the sub menu name  is “Calling Supplier Form”, When we click this ,it will call supplier form.
           
Responsibility  :  Purchaing, vision operations (USA)
Navigation       :  Purchase Ordersà Purchase Orders

Choose  menu  : ToolsàCalling Supplier Form



No comments: