Monday, 13 July 2015

Usage Of Execute Immediate

DECLARE
    l_query VARCHAR2(1000);
    l_order_number VARCHAR2(50) := '52424905';
   
    TYPE lr_order_detail_rec IS RECORD
        ( l_order_number oe_order_headers_all.order_number%TYPE,
          l_line_number  VARCHAR2(30),
          l_ordered_item oe_order_lines_all.ordered_item%Type,
          l_line_status  oe_order_lines_all.flow_status_code%TYPE,
          l_order_status oe_order_headers_all.flow_status_code%TYPE);
   
    TYPE lt_order_detail_tab IS TABLE OF lr_order_detail_rec
        INDEX BY BINARY_INTEGER;
   
    lt_order_detail_tab_o     lt_order_detail_tab;
BEGIN
    l_query := 'SELECT order_number, oe_flex_util.get_concat_value (oola.line_number,
                                          oola.shipment_number,
                                          oola.option_number,
                                          oola.component_number,
                                          oola.service_number)
                                 line_num,
                oola.ordered_item,
                oola.flow_status_code,
                ooha.flow_status_code
        FROM oe_order_headers_all ooha, oe_order_lines_all oola
        WHERE ooha.header_id = oola.header_id
            AND ooha.order_number = ' ||  l_order_number;
   
    BEGIN
        EXECUTE IMMEDIATE l_query
        BULK COLLECT INTO lt_order_detail_tab_o;
    EXCEPTION
        WHEN OTHERS THEN
            dbms_output.put_line('Inside exception ' || SQLERRM);
    END;
   
    dbms_output.put_line('lt_order_detail_tab_o.COUNT :- ' || lt_order_detail_tab_o.COUNT);
    dbms_output.put_line('Order Number || Line Number || ordered Item || Order Status || Line Status ' );
   
    FOR i IN lt_order_detail_tab_o.FIRST..lt_order_detail_tab_o.LAST
    LOOP
        dbms_output.put_line( lt_order_detail_tab_o(i).l_order_number|| ' '||
                                lt_order_detail_tab_o(i).l_line_number || ' ' ||
                                lt_order_detail_tab_o(i).l_ordered_item ||' '||
                                lt_order_detail_tab_o(i).l_order_status ||' ' ||
                                lt_order_detail_tab_o(i).l_line_status);
    END LOOP;
EXCEPTION
    WHEN OTHERS THEN
        dbms_output.put_line('Inside exception when others' || SQLERRM);
END;

API To Create Relationship Of Line With CONFIG Line Instance

To create relationship API CSI_II_RELATIONSHIPS_PUB.CREATE_RELATIONSHIP will be used as :-

DECLARE
V_RELATIONSHIP_ID       NUMBER;
X_RELATIONSHIP_TBL      CSI_DATASTRUCTURES_PUB.II_RELATIONSHIP_tbl;
X2_TXN_REC              CSI_DATASTRUCTURES_PUB.TRANSACTION_REC;
P2_COMMIT               VARCHAR2 (5);
P2_INIT_MSG_LST         VARCHAR2 (500);
P2_VALIDATION_LEVEL     NUMBER;
x2_return_status        VARCHAR2 (100);
x2_msg_count            NUMBER;
x2_msg_data             VARCHAR2 (2000);

l_object_id             NUMBER ;
l_subject_id            NUMBER ;
l_transaction_type_id   NUMBER ;
BEGIN
BEGIN
SELECT csi_ii_relationships_s.NEXTVAL
INTO V_RELATIONSHIP_ID
FROM DUAL;
EXCEPTION
WHEN OTHERS
THEN
V_RELATIONSHIP_ID := NULL;
END;
BEGIN
SELECT line_type_id
INTO l_transaction_type_id
FROM oe_order_lines_all 
WHERE line_id = <LINE_ID>;
EXCEPTION
WHEN OTHERS THEN
l_transaction_type_id := NULL;
END;
BEGIN
SELECT cii.instance_id
INTO l_object_id -- parent
FROM oe_order_lines_all oola, csi_item_instances cii
WHERE oola.line_id = cii.last_oe_order_line_id
AND oola.inventory_item_id = cii.inventory_item_id
AND oola.item_type_code = 'CONFIG'
AND oola.line_id = <LINE_ID>;
EXCEPTION
WHEN OTHERS THEN
l_object_id := NULL;
END;
BEGIN
SELECT cii.instance_id
INTO l_subject_id -- child
FROM oe_order_lines_all oola, csi_item_instances cii
WHERE oola.line_id = cii.last_oe_order_line_id
AND oola.inventory_item_id = cii.inventory_item_id
AND oola.line_id = <LINE_ID>;
EXCEPTION
WHEN OTHERS THEN
l_subject_id := NULL;
END;

X_RELATIONSHIP_TBL (1).RELATIONSHIP_ID := V_RELATIONSHIP_ID;
X_RELATIONSHIP_TBL (1).RELATIONSHIP_TYPE_CODE := 'COMPONENT-OF';
X_RELATIONSHIP_TBL (1).OBJECT_ID := l_object_id;             --22062065;
X_RELATIONSHIP_TBL (1).SUBJECT_ID := l_subject_id;           --33531940;
X_RELATIONSHIP_TBL (1).SUBJECT_HAS_CHILD := 'N';
X_RELATIONSHIP_TBL (1).POSITION_REFERENCE := NULL;
X_RELATIONSHIP_TBL (1).ACTIVE_START_DATE := SYSDATE;
X_RELATIONSHIP_TBL (1).ACTIVE_END_DATE := '';
X_RELATIONSHIP_TBL (1).DISPLAY_ORDER := NULL;
X_RELATIONSHIP_TBL (1).MANDATORY_FLAG := 'N';
X_RELATIONSHIP_TBL (1).CONTEXT := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE1 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE2 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE3 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE4 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE5 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE6 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE7 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE8 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE9 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE10 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE11 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE12 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE13 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE14 := NULL;
X_RELATIONSHIP_TBL (1).ATTRIBUTE15 := NULL;
X_RELATIONSHIP_TBL (1).OBJECT_VERSION_NUMBER := 1;

X2_TXN_REC.TRANSACTION_DATE := TRUNC (SYSDATE);
X2_TXN_REC.SOURCE_TRANSACTION_DATE := TRUNC (SYSDATE);
X2_TXN_REC.TRANSACTION_TYPE_ID := l_transaction_type_id;         --1003;
X2_TXN_REC.OBJECT_VERSION_NUMBER := 1;
--
CSI_II_RELATIONSHIPS_PUB.CREATE_RELATIONSHIP (
p_api_version        => 1.0,
p_commit             => P2_COMMIT,
p_init_msg_list      => P2_INIT_MSG_LST,
p_validation_level   => P2_VALIDATION_LEVEL,
p_relationship_tbl   => X_RELATIONSHIP_TBL,
p_txn_rec            => X2_TXN_REC,
x_return_status      => X2_RETURN_STATUS,
x_msg_count          => X2_MSG_COUNT,
x_msg_data           => X2_MSG_DATA);
END;      

API To Create Instance manually in Install Base

We can create instance manually using API CSI_ITEM_INSTANCE_PUB.CREATE_ITEM_INSTANCE.

Application of API:-

DECLARE
l_instance_rec            csi_datastructures_pub.instance_rec;
l_ext_attrib_values_tbl   csi_datastructures_pub.extend_attrib_values_tbl;
l_party_tbl               csi_datastructures_pub.party_tbl;
l_party_account_tbl       csi_datastructures_pub.party_account_tbl;
l_pricing_attribs_tbl     csi_datastructures_pub.pricing_attribs_tbl;
l_org_assignments_tbl     csi_datastructures_pub.organization_units_tbl;
l_asset_assignment_tbl    csi_datastructures_pub.instance_asset_tbl;
l_txn_rec                 csi_datastructures_pub.transaction_rec;
x_instance_id_lst         csi_datastructures_pub.id_tbl;

lr_party_rec              csi_datastructures_pub.party_rec;
lr_party_account_rec      csi_datastructures_pub.party_account_rec;
lr_ext_attrib_value_rec   csi_datastructures_pub.extend_attrib_values_rec;

l_return_status           VARCHAR2 (1);
l_msg_count               NUMBER;
l_msg_data                VARCHAR2 (2000);
l_msg_index_out           VARCHAR2 (100);
l_api_version    CONSTANT NUMBER := 1.0;

l_error_stage             VARCHAR2 (240);
l_start_date              DATE;
l_start_time              DATE;
l_location_id  hz_locations.location_id%TYPE;
l_party_id  hz_parties.party_id%TYPE;
l_cust_account_id  hz_cust_accounts.cust_account_id%TYPE;
BEGIN
BEGIN
SELECT internal_party_id
INTO l_internal_party_id
FROM csi_install_parameters;
EXCEPTION
WHEN OTHERS THEN
l_internal_party_id := NULL;
END;

BEGIN
SELECT hps.location_id
INTO l_location_id
FROM oe_order_lines_all oola,
HZ_CUST_SITE_USES_ALL hcsua,
hz_cust_acct_sites_all hcasa,
hz_party_sites hps
WHERE     oola.ship_to_org_id = hcsua.site_use_id
AND hcsua.cust_acct_site_id = hcasa.cust_acct_site_id
AND hcasa.party_site_id = hps.party_site_id
AND oola.line_id = <LINE_ID>;
EXCEPTION
WHEN OTHERS THEN
l_location_id := NULL;
END;

BEGIN
SELECT party_id, cust_account_id
INTO l_party_id, l_cust_account_id
FROM hz_cust_accounts hca, oe_order_lines_all oola
WHERE hca.cust_account_id = oola.sold_to_org_id
AND oola.line_id = <LINE_ID>;
EXCEPTION
WHEN OTHERS THEN
l_party_id := NULL;
END;

l_instance_rec.serial_number := '';
l_instance_rec.instance_id := NULL;
l_instance_rec.instance_number := NULL;
l_instance_rec.external_reference := '';

l_instance_rec.inventory_item_id :=
<INVENTORY_ITEM_ID>;
l_instance_rec.inv_master_organization_id := <MASTER_ORGANIZATION_ID>;
l_instance_rec.vld_organization_id :=
<SHIP_FROM_ORG_ID of LINE>;
l_instance_rec.LAST_OE_ORDER_LINE_ID :=
<LINE_ID FROM OE_ORDER_LINES_ALL>;
--l_instance_rec.instance_status_id         := 1011;
l_instance_rec.object_version_number := 1.0;
-- l_instance_rec.location_type_code := 'HZ_PARTY_SITES';
l_instance_rec.quantity := <SHIPPED_QUANTITY of LINE_ID>;
l_instance_rec.unit_of_measure :=
<UOM of ORDERED_ITEM LINE_ID>;
l_instance_rec.mfg_serial_number_flag := 'N';
l_instance_rec.version_label := 'AS_CREATED';
-- l_instance_rec.location_id := l_location_id;
l_instance_rec.active_start_date := SYSDATE;
l_instance_rec.install_date := SYSDATE;
l_instance_rec.location_id := l_location_id;
l_instance_rec.owner_party_id := l_party_id;
--l_instance_rec.ACCOUNTING_CLASS_CODE := l_accounting_class_code;--'CUST_PROD';
--l_instance_rec.rec.active_end_date := l_hdr_rec.ib_end_date;

lr_party_rec.party_source_table := 'HZ_PARTIES';
lr_party_rec.instance_id := NULL;
lr_party_rec.relationship_type_code := 'OWNER';
lr_party_rec.party_id := l_party_id;
lr_party_rec.contact_flag := 'N';
l_party_tbl (1) := lr_party_rec;

lr_party_account_rec.relationship_type_code := 'OWNER';
lr_party_account_rec.parent_tbl_index := 1;
lr_party_account_rec.party_account_id := l_cust_account_id;
lr_party_account_rec.instance_party_id := l_party_id;
--lr_party_account_rec.bill_to_address := '';
--lr_party_account_rec.ship_to_address := '';
l_party_account_tbl (1) := lr_party_account_rec;

lr_ext_attrib_value_rec.attribute_value_id := NULL;

l_txn_rec.transaction_date := SYSDATE;
l_txn_rec.source_transaction_date := SYSDATE;
l_txn_rec.transaction_type_id := 1;

l_error_stage :=
'Call API CSI_ITEM_INSTANCE_PUB.CREATE_ITEM_INSTANCE';

l_msg_data := NULL;
l_msg_index_out := NULL;
l_msg_count := NULL;

CSI_ITEM_INSTANCE_PUB.CREATE_ITEM_INSTANCE (
p_api_version             => l_api_version,
p_commit                  => FND_API.G_FALSE,
p_init_msg_list           => FND_API.G_FALSE,
p_validation_level        => FND_API.G_VALID_LEVEL_FULL,
p_instance_rec            => l_instance_rec,
p_ext_attrib_values_tbl   => l_ext_attrib_values_tbl,
p_party_tbl               => l_party_tbl,
p_account_tbl             => l_party_account_tbl,
p_pricing_attrib_tbl      => l_pricing_attribs_tbl,
p_org_assignments_tbl     => l_org_assignments_tbl,
p_asset_assignment_tbl    => l_asset_assignment_tbl,
p_txn_rec                 => l_txn_rec,
x_return_status           => l_return_status,
x_msg_count               => l_msg_count,
x_msg_data                => l_msg_data);

IF (l_return_status IN ('E', 'U'))
THEN
--l_error_code := 'E';
ROLLBACK;
FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP
fnd_msg_pub.get (p_msg_index       => i,
p_encoded         => 'F',
p_data            => l_msg_data,
p_msg_index_out   => l_msg_index_out);
dbms_output.put_line (

'l_return_status: ' || l_return_status);
dbms_output.put_line (
 
  'l_msg_data: ' || SUBSTR (l_msg_data, 1, 250));
END LOOP;
dbms_output.put_line( 'Instance creation failed for order# ' || order_rec.order_number || ' Serial Number :- ' || l_serial_number);
ELSE
dbms_output.put_line ('------------------------------------------');
dbms_output.put_line ('l_return_status: ' || l_return_status);
dbms_output.put_line('The instance ID: '
|| TO_CHAR (l_instance_rec.INSTANCE_ID)
|| ' Created For Order# :- ' || order_rec.order_number
|| ' and Serial number :- ' || l_serial_number);
dbms_output.put_line ('------------------------------------------');
COMMIT;
END IF;
END;

Tuesday, 7 July 2015

PL/SQL Record Type And Table Type

In this blog, I will explain about PLSQL Record Type and Table Type With Example.

Please don't forget to leave a comment/suggestion.

PLSQL Record Type

A record is a group of related data items stored in fields, each with its own name and datatype. You can think of a record as a variable that can hold a table row or some columns from a table row. The fields correspond to table columns.

Understanding PL/SQL Records
Records are composed of a group of fields, similar to the columns in a row. The %ROWTYPE attribute lets you declare a PL/SQL record that represents a row in a database table, without listing all the columns. Your code keeps working even after columns are added to the table. If you want to represent a subset of columns in a table, or columns from different tables, you can define a view or declare a cursor to select the right columns and do any necessary joins, and then apply %ROWTYPE to the view or cursor.

Defining a Record
The record type can be defined as  below :- 
TYPE
type_name IS RECORD
  ( field_name1  datatype1  [NOT NULL]  [:= DEFAULT EXPRESSION],
   field_name2   datatype2   [NOT NULL]  [:= DEFAULT EXPRESSION],
   ...
   field_nameN  datatypeN  [NOT NULL]  [:= DEFAULT EXPRESSION);
record-name  type_name;

Here "record-name" is object of "type_name". we can not access record type directly with type_name.

Example:- 

DECLARE
TYPE books IS RECORD
(title  varchar(50),
    author  varchar(50),
    subject varchar(100),
    book_id   number);
book1 books;
book2 books;

Assigning Values To PLSQL record Type:-
To access any field of a record we use (.) dot operator. 

SYNTAX:-
<type_name>.<field_name>

Example:-

DECLARE
   type books is record
      (title varchar(50),
       author varchar(50),
       subject varchar(100),
       book_id number);
   book1 books;
   book2 books;
BEGIN
   -- Book 1 specification
   book1.title  := 'C Programming';
   book1.author := 'Nuha Ali '; 
   book1.subject := 'C Programming Tutorial';
   book1.book_id := 6495407;

   -- Book 2 specification
   book2.title := 'Telecom Billing';
   book2.author := 'Zara Ali';
   book2.subject := 'Telecom Billing Tutorial';
   book2.book_id := 6495700;

   -- Print book 1 record
   dbms_output.put_line('Book 1 title : '|| book1.title);
   dbms_output.put_line('Book 1 author : '|| book1.author);
   dbms_output.put_line('Book 1 subject : '|| book1.subject);
   dbms_output.put_line('Book 1 book_id : ' || book1.book_id);
  
   -- Print book 2 record
   dbms_output.put_line('Book 2 title : '|| book2.title);
   dbms_output.put_line('Book 2 author : '|| book2.author);
   dbms_output.put_line('Book 2 subject : '|| book2.subject);
   dbms_output.put_line('Book 2 book_id : '|| book2.book_id);

END;

PLSQL Table Type

Both PLSQL Table Types i.e. Index-by tables and Nested tables have same structure and their rows are accessed using subscript notation.

Index-By Tables :-

Index-By Table is also called Associate Arrary. Index-by table is a set of key value pair, where its subscript is called as key and value assigned to it called as value. Each key in Index-by table is unique and it can either be Number or String.

Syntax :-

TYPE type_name IS TABLE OF element_type [NOT NULL] INDEX BY subscript_type;
table_name type_name;

Declaring and Using Index-By Table:-

DECLARE
     -- Associative array indexed by string:   
     TYPE book IS TABLE OF NUMBER  -- Associative array type
       INDEX BY VARCHAR2(64);   
     book_price  book;        -- Associative array variable
     i                VARCHAR2(64);
   BEGIN
     -- Add new elements to associative array:
     book_price('ABC')  := 200;
     book_price('DEF')     := 750;
     book_price('GHI') := 1000;

     -- Change value associated with key 'ABC':
     book_price('Smallville') := 2001;

     -- Print associative array:
     i := book_price.FIRST;
     WHILE i IS NOT NULL LOOP
       DBMS_Output.PUT_LINE
         ('Price of ' || i || ' is ' || TO_CHAR(book_price(i)));
       i := book_price.NEXT(i);
     END LOOP;
   END;

Nested Tables :-

A nested table is one-dimensional array with arbitrary number of elements whose size can increase dynamically. Nested table are like Index-By Tables, but there is no INDEX BY clause in Nested Tables.

Syntax:-
TYPE type_name IS TABLE OF element_type [NOT NULL];

table_name type_name;

A nested table can be stored in a database column and so it could be used for simplifying SQL operations where you join a single-column table with a larger table. An associative array(Index-By table) cannot be stored in the database.

Difference between Nested Table and Array:-

Nested tables are like arrays where in both the case data is stored in one dimension with below differences:-

  1. An array has a declared number of elements, but a nested table does not. The size of a nested table can increase dynamically.
  2. An array is always dense, i.e., it always has consecutive subscripts. A nested array is dense initially, but it can become sparse when elements are deleted from it.
Declaring and Using Nested table:-
DECLARE
   TYPE books_table IS TABLE OF VARCHAR2(10);
   TYPE price IS TABLE OF INTEGER;

   names books_table;
   rate price;
   total integer;
BEGIN
   names := books_table('ABC', 'DEF', 'GHI', 'JKL', 'MNO');
   marks:= rate(98, 97, 78, 87, 92);
   total := names.count;
   dbms_output.put_line('Total '|| total || ' books');
   FOR i IN 1 .. total LOOP
      dbms_output.put_line('Book:'||names(i)||', Price:' || rate(i));
   end loop;
END;

Using PLSQL Record Type and Table Type Together


DECLARE
    TYPE lr_order_detail_rec IS RECORD 
        ( l_order_number oe_order_headers_all.order_number%TYPE,
          l_line_number  VARCHAR2(20),
          l_ordered_item oe_order_lines_all.ordered_item%Type,
          l_line_status  oe_order_lines_all.flow_status_code%TYPE,
          l_order_status oe_order_headers_all.flow_status_code%TYPE);
    
    TYPE lt_order_detail_tab IS TABLE OF lr_order_detail_rec
        INDEX BY BINARY_INTEGER;
    
    lt_order_detail_tab_o     lt_order_detail_tab;
    
    CURSOR lc_order_cur
    IS
        SELECT order_number, oe_flex_util.get_concat_value (oola.line_number,
                                          oola.shipment_number,
                                          oola.option_number,
                                          oola.component_number,
                                          oola.service_number)
                                 line_num,
                oola.ordered_item,
                oola.flow_status_code,
                ooha.flow_status_code
        FROM oe_order_headers_all ooha, oe_order_lines_all oola
        WHERE ooha.header_id = oola.header_id
            AND ooha.order_number = '52424905';
        
BEGIN
    OPEN lc_order_cur;
        LOOP
            FETCH lc_order_cur BULK COLLECT INTO lt_order_detail_tab_o;
            EXIT WHEN lc_order_cur%NOTFOUND;
        END LOOP;
    CLOSE lc_order_cur;
    
    dbms_output.put_line('lt_order_detail_tab_o.count:- ' || lt_order_detail_tab_o.count);
    dbms_output.put_line('Order Number || Line Number || ordered Item || Order Status || Line Status ' ); 
    
    FOR i IN lt_order_detail_tab_o.FIRST..lt_order_detail_tab_o.LAST
    LOOP
        dbms_output.put_line( lt_order_detail_tab_o(i).l_order_number|| ' '|| 
                                lt_order_detail_tab_o(i).l_line_number || ' ' || 
                                lt_order_detail_tab_o(i).l_ordered_item ||' '||  
                                lt_order_detail_tab_o(i).l_order_status ||' ' ||
                                lt_order_detail_tab_o(i).l_line_status);
    END LOOP;
        
END;


Kindly leave a comment/suggestion.

Wednesday, 29 April 2015

FNDLOAD download and upload commands for AOL

FNDLOAD download and upload commands for AOLs:-

SQL to find application and DFF name:-

SELECT
application_id, DESCRIPTIVE_FLEXFIELD_NAME, application_table_name
FROM
fnd_descriptive_flexs_vl
WHERE
APPLICATION_TABLE_NAME like '%' || upper('%<TABLE_NAME>%') || '%'
ORDER BY APPLICATION_TABLE_NAME

FNDLOAD Command To Downlod Printer Styles
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcppstl.lct xxaoa_file_name.ldt STYLE PRINTER_STYLE_NAME="printer style name"

FNDLOAD Command To Downlod Lookups
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct xxaoa_file_name.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="prod" LOOKUP_TYPE="lookup name"

FNDLOAD Command To Downlod Descriptive Flexfield with all of specific Contexts
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct xxaoa_file_name.ldt DESC_FLEX P_LEVEL=:COL_ALL:REF_ALL:CTX_ONE:SEG_ALL? APPLICATION_SHORT_NAME="prod" DESCRIPTIVE_FLEXFIELD_NAME="desc flex name" P_CONTEXT_CODE="context name"

FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct xxx_file_name.ldt DESC_FLEX APPLICATION_SHORT_NAME="ONT" DESCRIPTIVE_FLEXFIELD_NAME="OE_LINE_RETURN_ATTRIBUTE" 

FNDLOAD Command To Downlod Multiple Flexfields:
Use a combination of APPLICATION_SHORT_NAME and DESCRIPTIVE_FLEXFIELD_NAME names ie. APPLICATION_SHORT_NAME=PER >> will download all PER flexfields DESCRIPTIVE_FLEXFIELD_NAME=PER_% >> will download all flexfields that start with ‘PER_’.

FNDLOAD <username>/<password> O Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct xxaoa_file_name.ldt DESC_FLEX DESCRIPTIVE_FLEXFIELD_NAME="PER_%"

FNDLOAD Command To Downlod Key Flexfield Structures:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct xxaoa_file_name.ldt KEY_FLEX P_LEVEL=:COL_ALL:FQL_ALL:SQL_ALL:STR_ONE:WFP_ALL:SHA_ALL:CVR_ALL:SEG_ALL? APPLICATION_SHORT_NAME="prod" ID_FLEX_CODE="key flex code" P_STRUCTURE_CODE="structure name"

FNDLOAD Command To Downlod Concurrent Programs:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct xxaoa_file_name.ldt PROGRAM APPLICATION_SHORT_NAME="prod" CONCURRENT_PROGRAM_NAME="concurrent name"

FNDLOAD Command To Downlod Value Sets:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct xxaoa_file_name.ldt VALUE_SET FLEX_VALUE_SET_NAME="value set name"

FNDLOAD Command To Downlod Value Sets with values:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afffload.lct xxaoa_file_name.ldt VALUE_SET_VALUE FLEX_VALUE_SET_NAME="value set name"

FNDLOAD Command To Downlod Profile Options:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscprof.lct xxaoa_file_name.ldt PROFILE PROxxaoa_file_name="profile option" APPLICATION_SHORT_NAME="prod"


FNDLOAD Command To Downlod Request Group:

FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcpreqg.lct xxaoa_file_name.ldt REQUEST_GROUP REQUEST_GROUP_NAME="request group"APPLICATION_SHORT_NAME="prod"

FNDLOAD Command To Downlod Request Sets:
- DOWNLOAD -- Request set Def   --

FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct <xxaoa_filename.ldt> REQ_SET REQUEST_SET_NAME=<request set name>

DOWNLOAD     -- Request set link   --
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcprset.lct <xxaoa_filename.ldt> REQ_SET_LINKS REQUEST_SET_NAME=<request set link name>

FNDLOAD Command To Downlod Responsibilities

FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct xxaoa_file_name.ldt FND_RESPONSIBILITY RESP_KEY="responsibility"

FNDLOAD Command To Downlod Responsibilities with all Security Groups:
FNDLOAD <username>/<PASSWORD> 0 Y DOWNLOAD FND_TOP/patch/115/import/afscursp.lct <USER>.ldt FND_USER USER_NAME="<USER>" SECURITY_GROUP=% DATA_GROUP_NAME=%


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.

FNDLOAD Command To Downlod Menus:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct xxaoa_file_name.ldt MENU MENU_NAME="menu_name"

FNDLOAD Command To Downlod Forms/Functions/Personalizations:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct <xxaoa_file_name.ldt> FND_FORM_CUSTOM_RULES form_name=<form name>
OR
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct xxaoa_file_name.ldt FUNCTION FUNCTION_NAME=<function_name>
OR
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct xxaoa_file_name.ldt FORM FORM_NAME=<form_name>
OR
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct <xxaoa_file_name.ldt> FND_FORM_CUSTOM_RULES function_name=<function name>

FNDLOAD Command To Downlod User/Responsibilities:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct xxaoa_file_name.ldt FND_USER

FNDLOAD Command To Downlod Alert:
FNDLOAD <username>/<password> 0 Y DOWNLOAD $ALR_TOP/patch/115/import/alr.lct my_file.ldt ALR_ALERTS APPLICATION_SHORT_NAME=FND ALERT_NAME=Alert name to download

FNDLOAD Command To Downlod Blob:
FNDLOAD <username>/<password> 0 Y mode configfile datafile entity [ param ... ]

FNDLOAD Command To Downlod Overwrite custom definitions:
FNDLOAD <username>/<password> 0 Y UPLOAD $FND_TOP/patch/115/import/.lct $XX_TOP/import/.ldt CUSTOM_MODE=FORCE


How To Transfer Custom Messages to another Instance:
a. Download the message from the source instance.
FNDLOAD <username>/<password> 0 Y DOWNLOAD @FND:patch/115/import/afmdmsg.lct password.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME=FND MESSAGE_NAME=PASSWORD-INVALID-NO-SPEC-CHAR
b. Move the custom LDT file (password.ldt) over to the destination instance.
c. Upload the custom message to the destination instance.
FNDLOAD <username>/<password> 0 Y UPLOAD @FND:patch/115/import/afmdmsg.lct password.ldt FND_NEW_MESSAGES APPLICATION_SHORT_NAME=FND CUSTOM_MODE=FORCE

XML DATA DEFINITION:
FNDLOAD <username>/<password> O Y DOWNLOAD $XDO_TOP/patch/115/import/xdotmpl.lct <xxaoa_filename.ldt> XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME=<application shortname>DATA_SOURCE_CODE=<data source code > TMPL_APP_SHORT_NAME=<template application short name>TEMPLATE_CODE=<template code>
The Above command downloads all the templates defined for this Particular Data Definition. For a particular template to be downloadeduse

FNDLOAD <username>/<password> 0 Y DOWNLOAD $XDO_TOP/patch/115/import/xdotmpl.lct <xxaoa_filename.ldt> XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME=<application shortname>DATA_SOURCE_CODE=<datadefshortcode> TMPL_APP_SHORT_NAME==<template application short  name> TEMPLATE_CODE= <templatecode>

How TO Migrate Work Flows From One Instance to other:
WFLOAD <username>/<password> 0 Y DOWNLOAD <xxaoa_filepath.wft> <item type>

Execute Following Command to upload the workflow to target instance:

WFLOAD <username>/<password> 0 Y UPLOAD <xxaoa_filepath.wft>

UPLOAD UPLOAD COMMANDS For Different AOL Components:
Note: UPLOAD command is same for all except replacing the .lct and passing any extra parameters if you want to pass

FNDLOAD Command To upload Ldt file for a Concurent Program
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a Data Definition
FNDLOAD <username>/<password> O Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a Request Set
FNDLOAD <username>/<password> 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a Request Set Links
FNDLOAD <username>/<password> 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a Lookup Up
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/aflvmlu.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a request group for a Concurrent Program
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afcpreqg.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a request group for a Request Set
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afcpreqg.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a Value Set
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a Value Set with values
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a DFF
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a DFF for a particular attribute column
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afffload.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a profile Option
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afscprof.lct file_name.ldt

FNDLOAD Command To upload Ldt file for a Audit Group
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/affaudit.lct file_name.ldt

FNDLOAD Command  To upload Ldt file for a Audit Schema
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/affaudit.lct file_name.ldt

FNDLOAD Command  To upload Ldt file for a Responsibility
FNDLOAD <username>/<password> O Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct file_name.ldt


FNDLOAD Command  To upload Ldt file for a XML Data Definition
UPLOAD  
FNDLOAD <username>/<password> 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct <xxaoa_filename.ldt>
FNDLOAD <username>/<password> 0 Y UPLOAD $FND_TOP/patch/115/import/afcprset.lct <xxaoa_filename.ldt>

FNDLOAD <username>/<password> O Y DOWNLOAD  $XDO_TOP/patch/115/import/xdotmpl.lct <xxaoa_filename.ldt> XDO_DS_DEFINITIONS APPLICATION_SHORT_NAME=<application short name>DATA_SOURCE_CODE=<data source code > TMPL_APP_SHORT_NAME=<template application short  name>TEMPLATE_CODE=<template code>

FNDLOAD <username>/<password> O Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct <xxaoa_filename.ldt>

The Above command downloads all the templates defined for this Particular Data Definition. For a particular template to be downloaded use

FNDLOAD <username>/<password> O Y UPLOAD $XDO_TOP/patch/115/import/xdotmpl.lct <xxaoa_filename.ldt>

FNDLOAD Command to upload ALERTS
FNDLOAD <username>/<password> 0 Y UPLOAD $ALR_TOP/patch/115/import/alr.lct  <ldt filename>


FNDLOAD Command TO Upload an NLS Language:
FNDLOAD <username>/<password> 0 Y UPLOAD <controlfile.lct> <datafile.ldt> \
- UPLOAD_MODE=NLS CUSTOM_MODE=FORCE WARNINGS=TRUE

Lookup For Hold Release Reasons In Order Management

 Oracle has provided an OE lookup "RELEASE_REASON" where it stores all the hold release reason codes.  You can enter your release ...