Showing posts with label Oracle Scripts. Show all posts
Showing posts with label Oracle Scripts. Show all posts

Thursday, 25 August 2011

CUSTOM.pll versus Forms Personalization

It is indeed time to stop using CUSTOM.pll
If you are on 11.5.10, then it is important for development team to enforce the usage of Forms Personalization over CUSTOM.pll, where possible.

Most of the things that can be done using CUSTOM.pll can now be done via Forms Personalization.
However there are certain gaps for which we have no option but to rely on CUSTOM.pll

This article compares the two techniques i.e. CUSTOM.pll versus Forms Personalizations

Why should we prefer FP over CUSTOM.pll ?1.    CUSTOM.pll is a single file/entity, hence only one developer can make changes to CUSTOM.pll at any given point in time.
You may also read best practices in CUSTOM.pll at this link
2.    If for some reasons CUSTOM.pll causes issues in Production, you will have to re-release the code changes after another round of UAT.
Form Personalizations makes this much simpler by allowing you to disable specific personalizations.
3.    You do not need to resort to programming for trivial tasks like changing prompt, and more so for changing prompts in Muli-Lang environment




Lets do a quick comparison between Forms Personalization and CUSTOM.pll
Task/Business Requirement
CUSTOM.pll
Forms Personalization
Change LOV Query
Yes
Yes
a. Create a New Record Group
b. Attach new RG to LOV
Change field properties like Mandatory/Display etc
Yes
Yes
Zoom to another screen
Yes
Yes
a. Enable Menu
b. Trap the Menu event
Disable a Menu entry when certain conditions are met
Yes
No
See Note-1
Display messages, warnings, hints etc
Yes
Yes
Display message with Questions, and conditionally execute code based on users response to the question
Yes
No
Execute PL/SQL Stored procedures
Yes
Yes
Change Navigation and Navigational Properties
Yes
Yes
Change block properties like “Query Where Clause” etc
Yes
Yes
Change is applicable across multiple screens, like Changing window title for all screens within one Organization/Responsibility
Yes
Yes
See Note
-2
Show FND Messages with their tokens replaced
Yes
See Note-3

Important: Oracle will keep on improving capabilities in Forms Personalizations.
Hence some of these limitations that we see now in Forms Personalization might disappear over a period of time.


Note-1

Once a menu has been enabled using Forms Personalization, it then can not be conditionally disabled. However the proposed workaround over this issue is to display a message when MENU is clicked in the scenario’s it was meant to be disabled.



Note-2
Lets say you want to change the window title for all the screens within a responsibility. In this case, in CUSTOM.pll you could do so by a pseudo code similar to below
    If fnd_global.responsibility like ‘XX%CASH%’ THEN
        Set window title ( ‘Note: All transactions are audited’);
    End if
As you can see, this can be achieved quite easily in CUSTOM.pll  and the changes will be visible across multiple screens in the context.
However, for Forms Personalization, you will have to go and personalize each and every screen for which you want this change to be effective.


Note-3
The proposed workaround is to display the message that is returned as a result from SQL Statement.





Time for some Q&A


Question: Should we migrate code from CUSTOM.pll into Forms Personalization?
Not really, there is no value in doing so, given that CUSTOM.pll is still supported and will remain so within the realms of Apps Unlimited.


Where is the metadata for Forms Personalization stored?
These personalizations are stored in FND tables



What is called first? Forms Personalization or CUSTOM.pll
First your form personalization is called, and then CUSTOM.pll is called.



Is forms personalization called for additional set of triggers vis-à-vis CUSTOM.pll?
Not really, the same set of triggers are passed to both CUSTOM.pll and Forms Personalization. To understand the fundamentals, visit this link CUSTOM.pll concepts

CUSTOM.pll

CUSTOM.pll is used to add extensions to Oracle's form Functionality. Some of the common scenario 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 screens.
6. Enabling Special Menu


Primarily there are two methods of extending Oracle Forms, and these are

    CUSTOM.pll
    FORMS Personalizations
In this article we will cover the basics of using CUSTOM.pll for extending Oracle Forms


How and why does CUSTOM.pll work?
Every form in Oracle Apps is created using something called as TEMPLATE.fmb. But some of the modules like HRMS have their own HR Specific Templates[HRTEMPLT.fmb]. These template files have form level triggers that make call to CUSTOM.pll. The triggers that can be trapped using CUSTOM.pll in HRMS screen can be different than those which can be trapped for other modules.


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


However, for example in HRMS, you can also write code in CUSTOM.pll to trap below listed events :-

PRE-DELETE and POST-DELETE
PRE-UPDATE and POST-UPDATE
PRE-INSERT and POST-INSERT
POST-FORMS-COMMIT
WHEN-CREATE-RECORD
KEY-DELREC




How to identify which trigger is most suitable for writing your business logic?
You can either open the FMB itself, and see the triggers which are calling CUSTOM.pll.
However, there is a easier way to work out the most suitable triggers. You can navigate to Help/Diagnostics/Custom Code/Show Custom Events


Once that radio button has been set, you will see the list of Events Displayed on the screen.



In some cases, the desired WHEN-NEW-BLOCK-INSTANCE or  WHEN-NEW-ITEM-INSTANCE are not being fired. What can I do?
It should always be possible to trap these events in CUSTOM.pll . But in some cases, the form  might have these triggers at block/field level, with the trigger property being OVERRIDE. Due to this, the corresponding form level triggers[ to invoke CUSTOM.pll] do not fire. In this case you must  raise a bug with Oracle on Metalink.


Structure code code in CUSTOM.pll
      IF event_name = 'WHEN-NEW-FORM-INSTANCE'
      THEN
         IF form_name = 'ARXTWMAI' AND block_name = 'INVOICE_HEADER'
         THEN
            xx_arxtwmai.default_customer;
         ELSIF form_name = 'ARXTWMAI' AND block_name = 'INVOICE_HEADER'
         THEN
                .....
         END IF;
       ELSIF event_name = 'WHEN-NEW-BLOCK-INSTANCE'
      THEN
                .....
      END IF ;



Lets take some scenario's where CUSTOM.pll can be used
1. Change the label of a field

app_item_property2.set_property ('BLOCK.FIELD',label,'New Label');

2. Default a value
copy (TO_CHAR (n_person_id),'PERSON_BLOCK.PERSON_ID' );

3. Alter the SQL for LOV Query
PROCEDURE filter_customers_in_lov IS
  v_customer_group_id recordgroup;
  n_temp_id           NUMBER;
  v_customer_lov      lov;
BEGIN
  v_customer_group_id := create_group_from_query('XX_CUSTOMER_GROUP'
                                   ,'select ... from hz_cust_accounts where ..your custom criteria here..');
  n_temp_id           := populate_group(v_customer_group_id);
  v_customer_lov    := find_lov('EXISTING_LOV_NAME_HERE');
  IF get_lov_property(v_customer_lov,group_name) = 'EXISTING_GROUP_NAME_HERE'
  THEN
         set_lov_property(v_customer_lov,group_name,'XX_CUSTOMER_GROUP');
  END IF;
END filter_customers_in_lov;


4. Make a field mandatory

app_item_property2.set_property ('XXBLOCK_NAME.XXFIELD_NAME',required,property_true);
Similarly you can enable or disable the fields too.

5. You can display messages, for example

FND_MESSAGE.CLEAR;
fnd_message.set_name('APPL_SHORT_NAME_HERE', 'MSG_NAME_HERE'); or fnd_message.set_string('message text');
fnd_message.warn or fnd_message.error or fnd_message.


6. Enable or Disable Special Menu

PROCEDURE manage_special_menu IS
  mi_id menuitem;
BEGIN
  mi_id := find_menu_item('SPECIAL.SPECIAL15');
  IF name_in('system.cursor_block') = 'INVOICE_HEADER' THEN
    app_special2.instantiate('SPECIAL15', 'Print Invoice');
    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;
END manage_special_menu;


7. Handle the click on Special Menu
  IF event_name = 'SPECIAL15' THEN
    IF form_name = 'INVOICE_FORM' THEN
      xx_invoice_form.process_printing;
    END IF;
    IF form_name = 'SUPPLIER_FORM' THEN
      xx_supplier_form.email_supplier;
    END IF;
  END IF;


8. Ask user a question, and take appropriate action  v_token_value      VARCHAR2(1000);
  n_button_selection INTEGER;
BEGIN
  fnd_message.set_name('APPL', 'MESSAGE');
  fnd_message.set_token('XXTOKEN1', v_token_value);
  n_button_selection := fnd_message.question('Email Invoice', 'Fax Invoice', '', 1, 2, 'question');
  IF n_button_selection = 1 THEN
    xx_call_invoice_print;
  ELSE
    xx_fax_invoice;
  END IF;

9. Call Another form functionfnd_function.EXECUTE(
   function_name => 'XX_FORM_FUNCTION_NAME_HERE'
  ,open_flag        => 'Y'
  ,session_flag     => 'SESSION'
  ,other_params   => 'P_INVOICE_ID = "' || n_invoice_header_id || '"'
  ,activate_flag    => 'Y');


10. Make some segments of a KeyFlexfield Display-Only depending upon some condition
For example to make 1st segment of a KFF display-only, we can use
IF v_check_result='xyz' THEN
FND_KEY_FLEX.UPDATE_DEFINITION(
     BLOCK => 'BLOCKNAMEHERE'
    ,FIELD => 'FLEXFIELDNAME'
   ,ENABLED => 'Y'
   ,DISPLAYABLE => 1);
END IF ;



As you may have gathered by now, almost any form related task can be done using CUSTOM.pll
Action Type in CUSTOMAllowed
Opening SQL CursorsYes
Executing pl/sql stored proceduresYes
Referencing fields using bind notation like :block.fieldNo
Exception managementYes


For additional reading on CUSTOM.pll, please visit
Best Practices for Development on CUSTOM.pll
Playing with CUSTOM.pll

Working with CUSTOM.pll

Why is a best practice needed for CUSTOM.pll?
Lets say you have different environments in which different developers are working for a single instance Production System. Assuming they all want to work upon CUSTOM.pll in parallel. In order to manage such situation efficiently, you need to have some methodology/rules when working on CUSTOM.pll

First lets consider various options that we have on table
1. One developer works on CUSTOM.pll at a time, checks out from source control while working, so that no other developer can work upon it until 1st developers changes go to production.
Limitation:- You can impact timescales, as other project teams may require to modify CUSTOM.pll at the same time.

2. Let two developers work on CUSTOM.pll library and let their work independently go to Production.
Limitation:- This is a painful process, as it will hurt when non-tested code in CUSTOM.pll reaches production.
This can happen if first developer's changes to CUSTOM.pll FAIL UAT and second developers changes PASS the UAT. The second developer would have included the CUSTOM.pll changes made by first developer which is still undergoing testing. Second developer needs to includes 1st developers changes too into CUSTOM.pll, to factor for a situation whereby both developer's code were to succeed UAT.

3. Use CUSTOM.pll simply as a stub [Best Practice]. The actual event handling takes place in a separate set of libraries [pll] which are attached to CUSTOM.pll.
What does this mean?
To explain this, lets consider a situation as below

Lets assume two developers want to work on CUSTOM.pll simultaneously
-->First developer wants to work on form named POXPOEPO.fmb [via CUSTOM.pll]
          Lets say, to make a duplicate check for Supplier Name against an existing company record in TCA, and warn user.
-->Second developer wants to work on form named PERWSSPP.fmb [via CUSTOM.pll]
          Lets say, to make a duplicate check for Employee Name against an existing person record in TCA, and warn user.  

First developer will do the steps below
1. Create XXPOXPOEPO.pll [ if does not already exist]
Within this, add a procedure as below within package XXPOXPOEPO
  procedure check_warn_duplicate_supplier is
  begin
       NULL ;
  end check_warn_duplicate_supplier ;
2. Attaches APPCORE2.pll and FNDSQF.pll to XXPOXPOEPO.pll
3. Checks in XXPOXPOEPO.pll to Source Control
4. Attaches XXPOXPOEPO.pll to CUSTOM.pll
5. In CUSTOM.pll
         IF form_name = 'POXPOEPO' AND block_name = 'XXXWHATEVER'
         THEN
            XXPOXPOEPO.check_warn_duplicate_supplier ;
         END IF;
6. Checks in CUSTOM.pll into source control.


Note:- Second developer will do exactly the same steps, but by using XXPERWSSPP.pll instead


Both the developers will have their skeleton code checked into source control, which does nothing at all [just NULL command].Also, both the developers will have their respective XXFORMNAME.pll files checked into source control.

What happens next?
First developer will checkout his XXPOXPOEPO.pll and make changes for vendor name validation.
  procedure check_warn_duplicate_supplier is
  begin
       --pseudo code below
       if duplicate THEN
              fnd_message to warn to user
       end if;
  end check_warn_duplicate_supplier ;
The developer will not check-in these changes to source control, until their changes have succeeded UAT.

Second developer too, will make their changes to XXPERWSSPP.pll, without checking in XXPERWSSPP.pll into source control.

What we have done here is that, as soon as above steps are done, any other developer can start working on CUSTOM.pll.
Effectively this will allow multiple developers to work on CUSTOM.pll, with their changes being promoted to production independent of other developers changes to CUSTOM.pll. This becomes possible, because each developer will work on the respective XXFORMNAME.pll for their respective form.

Any new developer, say third developer, will pick up the CUSTOM.pll from source control, which will either call "NULL" procedures [no effect] or actual procedures, depending upon the progress of code of other developers.

After the successful UAT, a developer must check-in changes to their XXFORMNAME.pll into source control.



Are there any catches?
You need some procedures in the way code is released to production. Lets say 1st developers patch goes to production after 2nd developers patch? This can happen if 1st developers UAT happens after second developers UAT.
Well... This situation can be avoided, by releasing patches to production in one bundle, whilst maintaining the sequence of the patching.
If worst does happen, then you can re-apply "second developers" patch again to production...at least you do not have to tinker the source code directly within production.



You may ask, why don't we attach APPCORE.pll to XXFORMNAME.pll
We do this, to avoid recursion, as is discussed in link CUSTOM.pll commands.
Hence we attached APPRCORE2.pll instead, which happens to be a slightly cut-down version of APPCORE.pll .

Switch off CUSTOM.pll programatically

What is the requirement?
Lets say you do not want CUSTOM.pll to be invoked when a specific profile option "XX Disable Custom.pll" is set to Yes.
Effectively we need to be able to programatically switch of CUSTOM.pll


How do I programatically disable CUSTOM.pll ?
CUSTOM.pll gets called from APP_STANDARD package [in APPCORE.pll]. APP_STANDARD is effectively called from all the Oracle Apps Form Triggers. If you open appcore.pll, you will notice that within package app_standard, reference to global variable made. If global variable is set to OFF, then CUSTOM.pll does not get called.

How do I doublecheck that above holds true?
Use examine, in normal mode you will notice the value of this global variable as NORMAL


Turn custom code off using help menu, and then you will notice the value of global variable changing.



What are the two options to disable CUSTOM.pll programatically?
Option 1:- Use Forms Personalization


Note: The limitation of Forms personalization, is that you will need to implement this change for each and every FORM/Function separatelyThis limitation does not exist in CUSTOM.pll as we will see below.

Option 2:- Use CUSTOM.pll [yes CUSTOM.pll to turn off CUSTOM.pll conditionally]
IF event_name = 'WHEN-NEW-FORM-INSTANCE' THEN
    IF fnd_profile.value( 'GL_SET_OF_BKS_ID' ) = 999 THEN
         copy ( 'OFF' , 'GLOBAL.APP_CUSTOM_MODE' ) ;
    ELSE         copy ( 'NORMAL' , 'GLOBAL.APP_CUSTOM_MODE' ) ;
    END IF ;
END IF ;

So, CUSTOM.pll still rules in certain cases, as in this case whereby you wish to implement a logic spanning multiple forms with few lines of code.

Compiling Commands for CUSTOM.pll in R12

Path for CUSTOM.pll:
-------------------------
$AU_TOP/resource
To convert from CUSTOM.pll to CUSTOM.plx:
---------------------------------------------------------
frmcmp_batch module=CUSTOM.pll userid=apps/<pwd> output_file=CUSTOM.plx module_type=LIBRARY batch=yes compile_all=special

Compiling Commands for CUSTOM.pll in 11i

Please find some commands for CUSTOM.pll

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

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

Create Oracle FND_USER with System Administrator

If you have the Apps Password, its quite easy to create a FND_USER for yourself by using the API.
I find this script very useful when development environment gets cloned from Production(that is when i do not have FND_USER in Production.
Please note that:-
1. You will be allocated System Administrator by this script. Hence you can assign whatever responsibilities that you desire latter, after logging in.
2. The password will be set to oracle
3. You need apps password to run this script. Alternately you need execute permission on fnd_user_pkg from the user where this script will be run. If using some other user, please use apps.fnd_user_pkg.createuser
4. You need to do a COMMIT after this script has run. I have not included the commit within this script.
5. When running this script, you will be prompted to enter a user name.

--------------------------------Script-----------------------------------
DECLARE
  v_session_id INTEGER := userenv('sessionid');
  v_user_name  VARCHAR2(30) := upper('&Enter_User_Name');
BEGIN
  --Note, can be executed only when you have apps password.
  -- Call the procedure to Create FND User
  fnd_user_pkg.createuser(x_user_name                  => v_user_name
    ,x_owner                                 => ''
    ,x_unencrypted_password       => 'oracle'
    ,x_session_number                  => v_session_id
    ,x_start_date                           => SYSDATE - 10
    ,x_end_date                            => SYSDATE + 100
    ,x_last_logon_date                  => SYSDATE - 10
    ,x_description                         => 'easyoracleapps.blogspot.com'
    ,x_password_date                  => SYSDATE - 10
    ,x_password_accesses_left     => 10000
    ,x_password_lifespan_accesses => 10000
    ,x_password_lifespan_days     => 10000
    ,x_employee_id                       => 30
         /*Change this id by running below SQL*/
         /*  
        SELECT person_id
                    ,full_name
        FROM   per_all_people_f
       WHERE  upper(full_name) LIKE '%' || upper('<ampersand>full_name') || '%'
       GROUP  BY person_id
                          ,full_name
       */
    ,x_email_address => 'easyoracleapps.blogspot@gmail.com'
    ,x_fax           => ''
    ,x_customer_id   => ''
    ,x_supplier_id   => '');
  fnd_user_pkg.addresp(username       => v_user_name
                      ,resp_app       => 'SYSADMIN'
                      ,resp_key       => 'SYSTEM_ADMINISTRATOR'
                      ,security_group => 'STANDARD'
                      ,description    => 'Auto Assignment'
                      ,start_date     => SYSDATE - 10
                      ,end_date       => SYSDATE + 1000);
END;
/

Oracle FNDLOAD Script

PLEASE USE THIS LINK FOR FNDLOAD ON APPS2FUSION.COM

In this article I wish to give real working examples of Oracle's FNDLOAD utility.
Besides that, I have included some useful notes on FNDLOAD utility
I have used FNDLOAD successfully in past for several different entities/data types within Oracle 11i for almost all my previous clients, ever since this utility became available.
Some of the examples in this FNDLOAD article include:-
FNDLOAD to transfer Request Groups
FNDLOAD for moving Concurrent Programs
FNDLOAD to download and upload Forms Personalizations ( or Personalisations depending on where you are located )

To FNDLOAD Web ADI, visit the link Web ADI FNDLOAD

Use FNDLOAD for transferring value set definitions.
-->Please note that when transferring Key Flex Fields and Descriptive flex fields the respective value sets against each segment will be extracted and loaded automatically.

Also, FNDLOAD can be used to migrate Key FlexFields, Descriptive Flexfields, Responsibilities and almost every other FND entity.

Please note that the text written down here could get wrapped in the browser.
Hence you may have to use \ to continue the single line command on Unix, in case you find the lines wrapping
In my case I am ensuring that $CLIENT_APPS_PWD has the apps password before running the scripts


------------------------------------------------------------------------------------------


##To FNDLOAD Request groups
FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct XX_MY_REPORT_GROUP_NAME.ldt REQUEST_GROUP REQUEST_GROUP_NAME="XX_MY_REPORT_GROUP_NAME" APPLICATION_SHORT_NAME="XXGMS"
##Note that
##---------
## <> will be your Application Shortname where request group is registered
## XX_MY_REPORT_GROUP_NAME
Will be the name of your request group
## ##To upload this Request Group in other environment after having transferred the ldt file

FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD $FND_TOP/patch/115/import/afcpreqg.lct


------------------------------------------------------------------------------------------


##To FNDLOAD Concurrent Programs
FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CUSTOM_ORACLE_INTERFACE_PROG.ldt PROGRAM APPLICATION_SHORT_NAME="XXGMS" CONCURRENT_PROGRAM_NAME="XX_CUSTOM_ORACLE_INTERFACE_PROG"
##Note that
##---------
## XXGMS will be your custom GMS Application Shortname where concurrent program is registered
## XX_CUSTOM_ORACLE_INTERFACE_PROG
Will be the name of your request group
## XX_CUSTOM_ORACLE_INTERFACE_PROG.ldt is the file where concurrent program definition will be extracted
## ##To upload
FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct XX_CUSTOM_ORACLE_INTERFACE_PROG.ldt


------------------------------------------------------------------------------------------


##To FNDLOAD Oracle Descriptive Flexfields
$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct XX_PO_REQ_HEADERS_DFF.ldt DESC_FLEX APPLICATION_SHORT_NAME=PO DESCRIPTIVE_FLEXFIELD_NAME='PO_REQUISITION_HEADERS'
##Note that
##---------
## PO is the Application Shortname against which descriptive flexfield against PO Headers is registered
## PO_REQUISITION_HEADERS
is the name of Descriptive Flexfield against PO Requisition Headers
## Use the SQL below to find the name of DFF, rather than logging into the screen (ooops via jinitiator)
########----->SELECT
########----->application_id, DESCRIPTIVE_FLEXFIELD_NAME, application_table_name
########----->FROM
########-----> fnd_descriptive_flexs_vl
########----->WHERE
########-----> APPLICATION_TABLE_NAME like '%' || upper('&tab_name') || '%'
########----->ORDER BY APPLICATION_TABLE_NAME
########----->/
## To upload into another environment
$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/afffload.lct XX_PO_REQ_HEADERS_DFF.ldt

## OK another example for DFF against FND_LOOKUPS
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct XX_FND_COMMON_LOOKUPS_DFF.ldt DESC_FLEX APPLICATION_SHORT_NAME=FND DESCRIPTIVE_FLEXFIELD_NAME='FND_COMMON_LOOKUPS'
## OK another example for DFF against Project Accounting Expenditure Types
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct XX_PA_EXPENDITURE_TYPES_DESC_FLEX_DFF.ldt DESC_FLEX APPLICATION_SHORT_NAME=PA DESCRIPTIVE_FLEXFIELD_NAME='PA_EXPENDITURE_TYPES_DESC_FLEX'



------------------------------------------------------------------------------------------


##To FNDLOAD Oracle Menus
$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct ICX_POR_SSP_HOME.ldt MENU MENU_NAME="ICX_POR_SSP_HOME"
##Note that
##---------
## Oracle Menus are not attached to applications. Hence no need to include application short name
## ICX_POR_SSP_HOME is the menu name. This can be validated via below SQL
## select user_menu_name from fnd_menus_vl where menu_name = 'ICX_POR_SSP_HOME' ;
## Also note that we do not pass in the User_menu_name in this example
## OK, now to upload this file
$FND_TOP/bin/FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD $FND_TOP/patch/115/import/afsload.lct ICX_POR_SSP_HOME.ldt


----------------------------------------------------------------------------------------------------------------------------

## Well, now for FND Messages to download a single message
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct \
XX_ICX_POR_LIFECYCLE_PAY_TIP.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME='ICX' MESSAGE_NAME=XX_ICX_POR_LIFECYCLE_PAY_TIP

## Or you may as well download all the messages within an application
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afmdmsg.lct \
XX_ALL_GMS_MESSAGES_00.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME='XXGMS'

## now to upload using FNDLOAD
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/afmdmsg.lct XX_ICX_POR_LIFECYCLE_PAY_TIP.ldt


----------------------------------------------------------------------------------------------------------------------------


## Now it's the turn of Lookup values. Again, its not a rocket science
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD aflvmlu.lct XX_TRX_BATCH_STATUS.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME ='XXGMS' LOOKUP_TYPE="XX_TRX_BATCH_STATUS"
## Note that
## XX_TRX_BATCH_STATUS is the name of FND Lookup Type in this example
## This will download all the lookup codes within the defined lookup
## To upload
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD aflvmlu.lct XX_TRX_BATCH_STATUS.ldt

----------------------------------------------------------------------------------------------------------------------------
## You can also move the User definitions from FND_USER FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct ./XX_FND_USER_PASSI.ldt FND_USER USER_NAME='ANILPASSI'
#Do not worry about your password being extracted, it will be encrypted as below in ldt file
#BEGIN FND_USER "ANILPASSI"
#  OWNER = "PASSIA"
#  LAST_UPDATE_DATE = "2005/10/19"
#  ENCRYPTED_USER_PASSWORD = "ZGE45A8A9BE5CF4339596C625B99CAEDF136C34FEA244DC7A"
#  SESSION_NUMBER = "0"
To upload the FND_USER using FNDLOAD command use
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct ./XX_FND_USER_PASSI.ldt
Notes for using FNDLOAD against FND_USER:-
1. After uploading using FNDLOAD, user will be promoted to change their password again during their next signon attempt.
2. All the responsibilities will be extracted by FNDLOAD alongwith User Definition in FND_USER
3. In the Target Environment , make sure that you have done FNDLOAD for new responsibilities prior to running FNDLOAD on users.
----------------------------------------------------------------------------------------------------------------------------


## Now lets have a look at the profile option using oracle's FNDLOAD
FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD $FND_TOP/patch/115/import/afscprof.lct POR_ENABLE_REQ_HEADER_CUST.ldt PROFILE PROFILE_NAME="POR_ENABLE_REQ_HEADER_CUST" APPLICATION_SHORT_NAME="ICX"
## Note that
## POR_ENABLE_REQ_HEADER_CUST is the short name of profile option
## We aren't passing the user profile option name in this case. Validate using ...
########----->select application_id, PROFILE_OPTION_NAME || '==>' || profile_option_id || '==>' ||
########----->USER_PROFILE_OPTION_NAME
########----->from FND_PROFILE_OPTIONS_VL
########----->where PROFILE_OPTION_NAME like '%' || upper('&profile_option_name') || '%'
########----->order by PROFILE_OPTION_NAME
########----->/
## Now to upload
FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD $FND_TOP/patch/115/import/afscprof.lct POR_ENABLE_REQ_HEADER_CUST.ldt


----------------------------------------------------------------------------------------------------------------------------


## Now for the request sets that contain the stages and links for underlying concurrent programs
## For this you will be firstly required to download the request set definition.
## Next you will be required to download the Sets Linkage definition
## Well, lets be clear here, the above sequence is more important while uploading
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET.ldt REQ_SET REQUEST_SET_NAME="FNDRSSUB4610101_Will_look_like_this"
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET_LINK.ldt REQ_SET_LINKS REQUEST_SET_NAME="FNDRSSUB4610101_Will_look_like_this"
## Note that FNDRSSUB4610101 can be found by doing an examine on the
########----->select request_set_name from fnd_request_sets_vl
########----->where user_request_set_name = 'User visible name for the request set here'
## Now for uploading the request set, execute the below commands
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET.ldt
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct XX_GL_MY_INTERFACE_SET_LINK.ldt


----------------------------------------------------------------------------------------------------------------------------


## Now for the responsibility
FNDLOAD apps/$CLIENT_APPS_PWD O Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct XX_PERSON_RESPY.ldt FND_RESPONSIBILITY RESP_KEY="XX_PERSON_RESPY"
## note that XX_PERSON_RESPY is the responsibility key
## Now to upload
FNDLOAD apps/$CLIENT_APPS_PWD O Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct XX_PERSON_RESPY.ldt


----------------------------------------------------------------------------------------------------------------------------
## OK, now for the forms personalizations
## For the forms personalizations, I have given three examples as below.
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_PERWSHRG.ldt FND_FORM_CUSTOM_RULES function_name="PERWSHRG-404"
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_HZ_ARXCUDCI_STD.ldt FND_FORM_CUSTOM_RULES function_name="HZ_ARXCUDCI_STD"
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_AP_APXVDMVD.ldt FND_FORM_CUSTOM_RULES function_name="AP_APXVDMVD"
## Note that the function name above is the function short name as seen in the Function Definition Screen
## Now to upload the forms personalizations that are defined against these forms functions....
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_PERWSHRG.ldt
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_HZ_ARXCUDCI_STD.ldt
FNDLOAD apps/$CLIENT_APPS_PWD 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct XX_AP_APXVDMVD.ldt


----------------------------------------------------------------------------------------------------------------------------


Notes :
1. Give special attention when downloading Menus or Responsibilities.
In case your client has several developers modifying Responsibilities and Menus, then be ultra carefull. Not being carefull will mean that untested Forms and Functions will become available in your clients Production environment besides your tested forms, functions and menus.

2. Be very careful when downloading flexfields that reference value sets with independent values for GL Segment Codes.
By doing so, you will download and extract all the test data in GL Codes that might not be applicable for production.

3. There are several variations possible for FNDLOAD, for example you can restrict the download and uploads to specific segments within Descriptive Flex Fields. Please amend the above examples as desired for applying appropriate filterations.

4. The list of examples by no mean cover all possible FNDLOAD entities.

5. FNDLOAD is very reliable and stable, if used properly. This happens to by one of my favourite Oracle utilities.

4. Last but not the least, please test your FNDLOAD properly, so as to ensure that you do not get any unexpected data. In past I have noticed undesired results when the Lookup gets modified manually directly on production, and then the FNDLOAD is run for similar changes. If possible, try to follow a good practice of modifying FNDLOADable data only by FNDLOAD on production environment.

5. As the name suggests, FNDLOAD is useful for FND Related objects. However in any implementation, you will be required to migrate the Setups in Financials and Oracle HRMS from one environment to another. For this you can use iSetup. "Oracle iSetup".
Some of the things that can be migrated using Oracle iSetup are
GL Set of Books, HR Organization Structures, HRMS Employees, Profile Options Setup, Suppliers, Customers,  Tax Codes
& Tax Rates, Financials Setup, Accounting Calendars, Chart of Accounts, GL Currencies.