Form Customization
Form Customization
- Technical Training
- Chetan Anand
 Implementing Flexfields
                                     -2-
Course Agenda
   Day 1
Template Form
 Day 2
Implementing Calendar
Hands On
                                        -3-
Course Agenda
   Day 3
Implementing Flexfields
Hands On
 Day 4
                                       -4-
Coding a Form Using Oracle Applications
Coding Standards
    Tools such as Oracle Forms and PL/SQL are used whenever possible
     (avoid complex user exits using other coding languages)
    Fast performance over the World Wide Web (the web) is critical
                                             -6-
Application Architecture
                                         -8-
   Apache HTTP Server
                               Reports Server
                                                   Server
Discoverer Server
               Forms Server
Client
8i Ent Server
                        -9-
Oracle Applications Directory Structure
                             - 10 -
…Oracle Applications Directory Structure
    APPL_TOP Directory
                            - 11 -
…Oracle Applications Directory Structure
                                - 12 -
Oracle Applications Data Model
                           - 13 -
Oracle Applications Data Model
    Base Product Schema
             There is one schema for each product—a base product schema—that owns the
              data objects for that product.
             The following objects are installed in the base product schemas:
                 »   Tables
                 »   Sequences
                 »   Indexes
                 »   Constraints
    APPS Schema
             There is one schema—APPS—that owns all the code objects for the E-Business
              Suite and has access to all data objects.
             The following code objects are installed in the APPS schema:
                 »   Views
                 »   Packages
                 »   Procedures
                 »   Functions
                 »   Triggers
                                            - 14 -
Menus and Function Security
    Types of Function
      Form Function
Sub Function
        – Some functions provide a way to include other types of code, such as HTML pages or
          Java Server Pages (JSPs) on a menu and responsibility.
                                             - 16 -
… Overview of Menus and Function Security
    Menu
        – A menu is a hierarchical arrangement of functions and menus of functions that
            appears in the Navigator. Each responsibility has a menu assigned to it.
 Responsibility
                                               - 17 -
Development Steps
 Develop Functions
 Register Functions
   Create Submenu, If Any . Then Create Menu and attach all the
    Functions/Sub functions/Submenus to it
   Attach Menu to a responsibility
                                      - 18 -
Using Form Functions
    To call Forms from programmatically Use FND_FUNCTION.EXECUTE
     instead of OPEN_FORM
    For Making forms Query Only Use QUERY_ONLY=YES
                                      - 19 -
General Function and Menu Standards
    At the top level of a menu, two general categories should always exist,
     Setup and Report.
    Create function names (not user function names) as:
               <APPLICATION_SHORTNAME>_<FORMNAME>_<MODE>
                                        - 20 -
APPSTAND.fmb
                                            - 22 -
TEMPLATE.fmb
   Libraries
        – FNDSQF
              contains packages and procedures for Message Dictionary, flexfields, profiles, and concurrent
               processing.
        – APPCORE and APPCORE2
              packages and procedures that are required of all forms to support the menu, Toolbar, and other
               required standard behaviors.
        – APPDAYPK
              packages that control the Applications Calendar.
        – APPFLDR
              packages that enable folder blocks.
        – VERT, GLOBE, PSAC, PQH_GEN, GHR, JA, JE, and JL
              to support globalization and vertical markets.
        – CUSTOM
              calls that may be modified to provide custom code for Oracle Applications forms without modifying
               the Oracle Applications forms directly.
                                                     - 24 -
Triggers that often require some modification
    ACCEPT
         – Processes invocation of “Action, Save and Proceed” menu choice or toolbar
    FOLDER_RETURN_ACTION
         – This trigger allows customization of specific folder events
    KEY-DUPREC
         – This trigger disables the default duplicate record functionality
    KEY-CLRFRM
         – This trigger validates the form before attempting to clear the form
    KEY-MENU
         – This trigger disables the “Block Menu” command of Oracle Forms
    Key-LISTVAL
         – This trigger performs flexfield operations or LOV invocations .
         – Create block/item level triggers on fields using Calendars or fiedls that dynamically invoke flexfields
                                                     - 25 -
- 26 -
- 27 -
Triggers that often require some modification
    ON-ERROR
        – This trigger processes all errors .
        – To trap specific errors, check for your specific errors before the APP_STANDARD call
    POST-FORM
        – Reserved for future
    PRE-FORM
        – Set First window position
        – Add relevant form information
    QUERY-FIND
        – This trigger issues a default message saying that Query Find is not available
 WHEN-NEW-FORM-INSTANCE
    WHEN-NEW-RECORD-INSTANCE
        – This trigger maintains the state of Oracle Applications menu and toolbar
                                                  - 28 -
Triggers that often require some modification
    WHEN-NEW-RECORD-INSTANCE
        – This trigger maintains the state of Oracle Applications menu and toolbar
    WHEN-NEW-ITEM-INSTANCE
        – This trigger maintains the state of Oracle Applications menu and toolbar
                                            - 29 -
Property Classes
    Property classes are sets of attributes that can be applied to almost any
     Oracle Forms object.
    The TEMPLATE form automatically contains property classes, via
     references to APPSTAND, that enforce standard cosmetic appearances
     and behaviors for all Objects.
                                      - 30 -
Steps to follow
      Download it from $AU_TOP/forms/US to PLSQLLIB
      Download all the relevant directories, APPSTAND.fmb to PLSQLLIB
      Form should open without any error
      Rename Window, Canvas, Block
      Change the code in APP_CUSTOM.CLOSE_FIRST_WINDOW
      Change the code in the PRE-FORM trigger
      Change the arguments that have been passed to the
       FND_STANDARD.FORM_INFO call in the PRE-FORM trigger
      Change argument in the FDRCSID call in the WHEN-NEW-FORM-
       INSTANCE trigger with the appropriate form name, form version, etc.
                                     - 31 -
Steps to follow
    Make changes to form
                                       - 32 -
Controlling Window Behavior
     CASCADE: Child window overlaps the parent window, offset to the right and
       down by 0.3” from the current position of the parent window. Usually used for
       detail windows.
     RIGHT, BELOW: Child window opens to the right of, or below, the parent
       window without obscuring it.
     OVERLAP: Detail window overlaps the parent window, aligned with its left
       edge, but offset down by 0.3”.
     CENTER: Window opens centered relative to another window. Usually used
       for modal windows.
                                        - 34 -
…Positioning Windows Upon Opening
   Create two Master-detail Blocks in the form
                                         - 35 -
Closing the window
    The window close events for all non–modal windows get passed to
     APP_CUSTOM.CLOSE_WINDOW.
    if the cursor is currently in the window to be closed, APP_CUSTOM
     issues a do_key(’PREVIOUS_BLOCK’) to attempt to move the cursor
     out of the current window
                                    - 36 -
…Closing the window (example)
    Create 2 master detail Blocks
                                            - 37 -
Setting Windows Titles Dynamically
    Make use of procedure app_window.set_title
                                   - 38 -
… Setting Windows Titles Dynamically(Example)
    Create 2 master detail Blocks DEPT, EMP1 and all other related objects
                                              - 39 -
Coding Tabbed Regions
Tabbed Region
Tab Page
Fixed Fields
Controls
                                  - 41 -
… Coding Tabbed Regions
   Three Degrees of Coding Difficulty
Simple
                                            - 42 -
… Coding Tabbed Regions
     Medium
                                             - 43 -
… Coding Tabbed Regions
     Difficult
                                               - 44 -
… Implementing Tabbed Regions
   Creating the Layout in Forms Developer
     Adjust the tab canvas. Sequence the canvas after the content canvas, and
      before any stacked canvases that will appear in front of it.
     Create the tab pages.
     Adjust the tab pages. Apply the property class TAB_PAGE to each tab page.
      Set the tab page labels.
     Place your items on the appropriate tab pages.
     Adjust your layout. Set the field prompts as properties of your fields as
      appropriate.
                                         - 45 -
… Implementing Tabbed Regions
   Coding Your Tab Handler
        – FNDTABS.txt for the simple and medium cases
        – FNDTABFF.txt for the fixed field case
        These tab handlers can be downloaded from FND_TOP/resource
     Call your tab handler from triggers.
        – Add a form – level WHEN–TAB–PAGE–CHANGED trigger and call your new handler
        – Add a Block – Level WHEN-NEW-ITEM-INSTANCE trigger and call your new handler,
              Execution hierarchy : before
                                              - 46 -
Implementing Item Behavior
                                      - 48 -
… Dependent Field
   PACKAGE BODY DEPEND IS
   PROCEDURE ENAME(EVENT VARCHAR2)IS
    BEGIN
                IF (EVENT = 'WHEN–VALIDATE–ITEM') THEN
                 fnd_message.debug('1');
                 JOB('INIT');
                ELSE
                  fnd_message.debug('2');
                  APP_FIELD.SET_DEPENDENT_FIELD(EVENT,'EMP1.ENAME','EMP1.JOB');
                END IF;
   END ENAME;
END;
                                                           - 49 -
Mutually Exclusive Fields
    Create your item handler procedure using the procedure
     APP_FIELD.SET_EXCLUSIVE_FIELD
    Code a WHEN–VALIDATE–ITEM trigger on both the mutually exclusive
     items and call the procedure
    Code a PRE-RECORD and WHEN-CREATE_RECORD trigger on block
                                    - 50 -
Implementing Calendar
                                      - 52 -
Implementing Calendar
    Date fields should use the ENABLE_LIST_LAMP LOV,
                                       - 53 -
…Implementing Calendar (Display Only Mode)
   Add following comment BEFORE calendar.show KEY–LISTVAL
    calendar.setup(’DISPLAY’);
        – calendar.setup(’TITLE’, null, null, ’<translated text for window
         title>’);
                                      - 54 -
…Implementing Calendar (Disable Weekends in the Calendar Window)
                                   - 55 -
…Implementing Calendar (Disable Specific Date Ranges)
   Add following comment BEFORE calendar.show in trigger: KEY–LISTVAL
    calendar.setup(<30 char identifying name>, <low_date>, <high_date>);
                                    - 56 -
Enabling Query Behavior
                                 - 58 -
Enabling Query behavior
    Implementing Row–LOV
                            - 59 -
Implementing Row–LOV
   Create a Parameter for Your Primary Key
                                     - 60 -
Implementing Find Windows
   Copy the QUERY_FIND Object Group from APPSTAND
   Set the Previous Navigation Data Block property of the Find block to be the
    results block.
   Edit the KEY–NXTBLK Trigger same as FIND button’s trigger so that if user
    presses Go -> Next Block the behavior should mimic the FIND button
   Change the Find Window Title
                                                   - 61 -
Implementing Find Windows
   Create a block–level Pre–Query trigger in the Results block (Execution
    Hierarchy: Before) that copies query criteria from the Find window block
    to the Results block (where the query actually occurs).
        IF :parameter.G_query_find = ’TRUE’ THEN
           COPY (<find Window field>,’<results field>’);
           :parameter.G_query_find := ’FALSE’;
        END IF;
                                            - 62 -
Raising Query Find on Form Start Up
    At the end of your WHEN–NEW–FORM–INSTANCE trigger, call:
    EXECUTE_TRIGGER(’QUERY_FIND’);
                                 - 63 -
Implementing Flex Fields
….Contd
                                      - 65 -
Implementing Descriptive FlexField
      Freeze the flexfield definition
      Code the DFF in the form. Create the hidden fields (DFF segments) in
       the block. Set the query field size to 255 for the hidden fields
      Create the displayed field with the query length as 2000 and place it at
       the canvas at the required position . Name it as DESC_FLEX .Attach
       the ENABLE_LIST_LAMP LOV for the field. Set the Validate from LOV
       property for the item as No.
      In the WHEN-NEW-FORM-INSTANCE trigger call the Flexfield
       definition procedure.
          FND_DESCR_FLEX.DEFINE(
             BLOCK=>’block_name’,
             FIELD=>’field_name’,
             APPL_SHORT_NAME=>’DFF application_short_name’,
             DESC_FLEX_NAME=>’descriptive flexfield_name’
             );
                                              - 66 -
Implementing Descriptive FlexField
     Invoke the standard flexfield calls in the form as shown :
  Trigger
               Trigger                        Standard procedure calls
  Level
                                         - 67 -
Implementing Key FlexField
      Register the table using the AD_DD.REGISTER_TABLE and
       AD_DD.REGISTER_COLUMN table registration API’s in Application
       Object Library
      Create the hidden fields (ID Segment field) in the block. Set the query
       field size to 2000 for the hidden field (ID Segment field).
      Create the displayed field with the query length as 2000 and place it at
       the canvas at the required position.
      Also attach the ENABLE_LIST_LAMP LOV for the field. Set the
       Validate from LOV property for the item as No.
                                       - 68 -
Implementing Key FlexField
      In the WHEN-NEW-FORM-INSTANCE trigger call the Flexfield
       definition procedure. The sample call is given below.
            FND_KEY_FLEX.DEFINE(
            BLOCK=>’block_name’,
            FIELD=>’concatenated_segments_field_name’,
            ID=>’Unique_ID_field’,
            DATA_FIELD=>’concatenated_hidden_IDs_field’,
            APPL_SHORT_NAME=>’application_short_name’,
            CODE=>’key_flexfield_code’,
            NUM=>’structure_number’ );
                                         - 69 -
Implementing Key FlexField
     Invoke the standard flexfield calls in the form. The following table provides
        all the calls that need to be coded in the form.
 Trigger
               Trigger                         Standard procedure calls
 Level
                                            - 70 -
Controlling the Tool bar and Right Mouse
Menu
                                             - 72 -
Customizing Right–Mouse Menus (Popup Menus)
                                     - 73 -
…Customizing Right–Mouse Menus (Popup Menus)
  Set POPUP MENU property at the Item level to “POPUP”
             option_name varchar2,
             txt varchar2,
             initially_enabled boolean default true,
             separator varchar2 default null);
    Example :
    APP_POPUP.INSTANTIATE(’POPUP1’,’First Entry’);
    APP_POPUP.INSTANTIATE(’POPUP2’,’Second Entry’, TRUE, ’LINE’);
    APP_POPUP.INSTANTIATE(’POPUP3’,’Third Entry’, FALSE);
                                    - 74 -
…Customizing Right–Mouse Menus (Popup Menus)
   Add a field level POPUP1 user–named trigger that contains code to
    actually perform the required function. It executes when the user
    chooses this menu entry.
                                    - 75 -
Calling User Profiles
                                      - 77 -
Hierarchy in User Profiles
User
Responsibility
Application
Site
           - 78 -
User Profile APIs
    FND_PROFILE.PUT (name IN varchar2, value IN varchar2);
        – Puts a value to the specified user profile option. If the option does not exist, you can
          also create it with PUT.
                                              - 79 -
CUSTOM.pll
                                     - 81 -
CUSTOM Package
   The CUSTOM package contains the following functions and procedure:
       – CUSTOM.ZOOM_AVAILABLE
       – CUSTOM.STYLE
       – CUSTOM.EVENT
                                  - 82 -
CUSTOM.ZOOM_AVAILABLE
   If Zoom is available for this block, then return TRUE; otherwise return
    FALSE.
   Always test for the form and block name. Refer to the SYSTEM
    variables for form name and block name in your code and branch
    accordingly. The module name of your form must match the form file
    name.
   By default this routine must return FALSE.
                                     - 83 -
CUSTOM.STYLE
   This function allows to determine the execution style for a product–
    specific event if custom execution styles are supported for that product–
    specific event.
   Available styles are :
        – custom.before
        – custom.after
        – custom.override
        – custom.standard
                                     - 84 -
CUSTOM.EVENT
   This procedure allows to execute code at specific events.
   Always test for event name, then for form and block name within that
    event.
   Refer to the SYSTEM variables for form name and block name in code
    and branch accordingly.
                                    - 85 -
Writing Code for CUSTOM.pll
    CUSTOM library is located in the AU_TOP/resource directory (or
     platform equivalent).
    After writing code in the CUSTOM procedures, compile and generate the
     library using Oracle Forms. Then place this library into
     $AU_TOP/resource directory (or platform equivalent).
    The specification of the CUSTOM package in the CUSTOM library
     cannot be changed in any way.
    New packages can be added to the CUSTOM library, but any packages
     that are newly added to this library must be sequenced after the
     CUSTOM package.
    No SQL can be used in the library. However, a record group can be
     used to issue SELECT statements.
    Use calls to stored procedures for any other DML operations such as
     updates, inserts, or deletes.
                                      - 86 -
Writing Code for CUSTOM.pll
    Other libraries can be attached to CUSTOM.pll, except APPCORE.pll
     because it would cause a recursion problem (because CUSTOM is
     attached to APPCORE). As of Oracle Applications Release 11i, attach
     the APPCORE2 library to CUSTOM.
                                    - 87 -
PL/SQL APIs for Concurrent Processing
   FND_CONCURRENT.AF_ROLLBACK
      – FND_CONCURRENT.AF_ROLLBACK executes the ROLLBACK command for the
        specified rollback segment.
   FND_CONCURRENT.GET_REQUEST_STATUS
      – Returns the status of a concurrent request. If the request has already completed, also
        returns a completion message.
   FND_CONCURRENT.WAIT_FOR_REQUEST
      – Waits for request completion, then returns the request phase/status and completion
        message to the caller. Goes to sleep between checks for request completion.
                                          - 89 -
FND_FILE package
   FND_FILE.PUT_LINE
      – Arguments :
            which
            Buff
   FND_FILE.NEW_LINE
      – Arguments (input)
            which
            Lines
   FND_FILE.PUT_NAMES
      – Arguments (input)
            p_log
            p_out
            p_dir
 FND_FILE.CLOSE
                            - 90 -
FND_REQUEST. SUBMIT_REQUEST
   Arguments
       – (application IN varchar2 default NULL,
       – program IN varchar2 default NULL,
       – description IN varchar2 default NULL,
       – start_time IN varchar2 default NULL,
       – sub_request IN boolean default FALSE
       – argument1,
       – argument2, ..., argument99,
       – argument100) return number;
                                           - 91 -
FND_REQUEST.SET_REPEAT_OPTIONS
   Arguments
       – repeat_time
       – repeat_interval
       – repeat_unit
       – repeat_type
       – repeat_end_time
                           - 92 -
<Summary at the end of the course>
- 94 -