Sunday, August 28, 2011

FNDLOAD for Territory/Language Specific

Sometimes we need to download Ldts for concurrent program/Lookups/Value Sets etc. which are Territory/language specific.
Hmmmm.....you just need to set the specific languge before downloading/uploading.

>> Related Scripts

>>
SELECT DECODE(parameter, 'NLS_LANGUAGE', 'LANGUAGE',
                         'NLS_TERRITORY', 'TERRITORY',
                         'NLS_CHARACTERSET', 'CHARACTER SET') Attributes,
                value
  FROM nls_database_parameters
 WHERE parameter IN ( 'NLS_LANGUAGE', 'NLS_TERRITORY','NLS_CHARACTERSET')

>>
SELECT NLS_LANGUAGE,NLS_TERRITORY,NLS_CODESET
  FROM fnd_languages
 WHERE nls_territory = 'FRANCE'
   AND language_code = 'F'

Setting up National Language Support
---------------------------------------

EXPORT NLS_LANG=<language>_<territory>.<character set>


Example (Downloading Lookup Ldt)
-------------------------------------

EXPORT NLS_LANG=American_America.UTF8  
>> No Need to do this, as it is already there as default, provided your Territory is American, please check with SQL provided above.

FNDLOAD apps/<apps_password> O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct <XX_LOOKUP_NAME_US>.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="<XXX>"
LOOKUP_TYPE="<XX_Lookup name>"

EXPORT NLS_LANG=French_France.WE8MSWIN1252

FNDLOAD apps/<apps_password> O Y DOWNLOAD $FND_TOP/patch/115/import/aflvmlu.lct <XX_LOOKUP_NAME_FRC>.ldt FND_LOOKUP_TYPE APPLICATION_SHORT_NAME="<XXX>" LOOKUP_TYPE="<XX_Lookup name>"

>> Reset to Default
EXPORT NLS_LANG=American_America.UTF8

Thursday, August 25, 2011

RICE/CEMLI Terminology

In my Oracle career I often hear confusion over RICE/CEMLI terminologies, what they stands for ? what is the meaning of...blah blah blah....so with the help of my very good friend Charan, I have decided to write my take on this.

AIM (Applications Implementation Methodology) => During packaged ERP(enterprise resource planning) implementations, Clients often have additional requirements apart from the existing (standard) business process, for which they need to create/change the Vanila system (Unchanged ERP Implemented system) processes, and its these changes that come under RICE/RICEW components. AIM is the methodology/standards/published guidelines, which Oracle suggests it's Clients to follow while developing
RICE/RICEW components for their business requirements.

RICE stands for Reports, Interfaces, Conversions, Enhancements / Extensions
-----
 > Sometimes extended to FRICE > F for Forms
                                         -------
                                        OR 
                                        RICEW > W for Workflow.
                                         -------

Forms/Reports/Workflows : Create/Change existing forms/reports/workflows available in  ERP system to  meet the Clients business requirements.

Interfaces : Linking (Programs) between other systems to ERP system in order to synchronize the Data.They can be Manual, Batch or Real-Time. Interfaces can be either outbound or inbound. An outbound interface reads data from Oracle Apps tables and usually creates output files in the third party tool specified format. An inbound interface reads data from flat files (usually) and calls Oracle APIs to upload data into Oracle Apps.

Conversion : It is converting the data structure and data design of legacy system data to satisfy the customer’s business rules before importing it into Oracle .It is like a one time run of an inbound interface except that the amount of data processed during conversion could be potentially huge since all the required data from the legacy system would be transferred to Oracle.

Enhancements/Extensions : Please see below.

>> In R12 RICE components have been extended to CEMLI components.
                                                                             --------

CEMLI Stands for Configurations/Customization, Extension, Modification, Localization, and Integration.


Configurations : Configure the existing, pre-built application features according to your client's requirement.Changing setups and profile values can be the example of configurations.

Customization : Customization means altering/changing the standard objects or creation of custom object to meet client's business need. It may be Extensions or Modifications.

Extensions : Extension means creating custom code from scratch, existing objects (views, packages and java classes etc) can be used. It is having different behaviour from seeded one.

Modifications : Modifications is enhancing/changing the existing code to meet the client's requirements. It is the modification of seeded behaviour.

Localization :  It is to define the different legislative support provided by oracle Applications based on country/region/language requirements.

Integration : It can be Data Integration or Application Integration, options for these two are Open Interface tables, APIs, EAI(Enterprise Application Integration Tools), BPEL, AQ, EDI etc.

             >> Apart from these there is one more term and that is Personalization.

Personalization : Tailoring the layout or visibility of page content to meet client requirements is Personalization. Changing the user interface (UI) look-and-feel, making any field visible/enabled/disabled/mandatory/non mandatory comes under Personalization.



>> There are many guidelines and risks related to RICE/CEMLI components, but that’s for some other day, here I’ll restrict myself to overview of these terminologies.


Sunday, August 14, 2011

How to Delete a Service Contract

How to Delete a Service Contract
================================


To delete a service contract from Application, the contract status should be either 'Entered' or 'Cancelled'.
In any other status you can not delete a Service contract from Application.

To Delete Contracts from Application
1. Go to Service Contracts Super User Responsibility --> Launch Contract --> Find Contract --> Open Contract
2. Status of the contract should be 'Entered' or 'Cancelled'
3. Go to Actions --> Delete Contract
4. Click OK.

However, if the contract is Activated once or is on QA Hold status you can not delete it from Application.
You can use below mentioned script to delete the contract.

Pseudo Code :

1. Change status of the Contract to 'Entered' if it is not in Entered state using API okc_contract_pub.update_contract_header.
2. Change status of all the contract lines to 'Entered' if not in Entered state using API okc_contract_pub.update_contract_line.
3. Delete all the lines of contract using API okc_contract_pub.delete_contract_line.
4. Delete contract header using API okc_contract_pub.delete_contract_header.
5. COMMIT the change or ROLLBACK in case of any error.

Code :

**************************************************************************************

DECLARE
CURSOR cur_hdr
IS
SELECT ID, contract_number, contract_number_modifier, start_date,
end_date, sts_code
FROM okc_k_headers_b okhb
WHERE 1 = 1
AND contract_number = :p_contract_number
AND NVL (contract_number_modifier, 'AAA') =
NVL (:p_contract_number_modifier, 'AAA');

x_head_update_rec_type okc_contract_pub.chrv_rec_type;
x_out_chrv_rec okc_contract_pub.chrv_rec_type;
x_clev_rec_type okc_cle_pvt.clev_rec_type;
x_out_clev_rec okc_cle_pvt.clev_rec_type;
x_return_status VARCHAR2 (1);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (20000);
x_msg_index_out NUMBER;
x_init_msg_list VARCHAR2 (1) := okc_api.g_false;
g_api_error EXCEPTION;
BEGIN
DBMS_OUTPUT.put_line ('Start');

FOR hdr_rec IN cur_hdr
LOOP
BEGIN
--- Setting header status to ENTERED to allow update
DBMS_OUTPUT.put_line ( 'Start Delete Contracts for Contract #: '
|| hdr_rec.contract_number
|| ' '
|| hdr_rec.contract_number_modifier
);

IF hdr_rec.sts_code <> 'ENTERED'
THEN
x_head_update_rec_type.ID := hdr_rec.ID;
x_head_update_rec_type.sts_code := 'ENTERED';
x_return_status := NULL;
x_msg_count := 0;
x_msg_data := NULL;
x_msg_index_out := NULL;
okc_contract_pub.update_contract_header
(p_api_version => 1.0,
p_init_msg_list => fnd_api.g_true,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_restricted_update => fnd_api.g_true,
p_chrv_rec => x_head_update_rec_type,
x_chrv_rec => x_out_chrv_rec
);

IF (x_return_status <> fnd_api.g_ret_sts_success)
THEN
DBMS_OUTPUT.put_line
('Set Header Status to ENTERED API Error ');
RAISE g_api_error;
END IF;
END IF; -- end if contract status <> 'ENTERED'

--- Setting lines status to ENTERED to allow update
FOR i_line IN (SELECT ID, sts_code
FROM okc_k_lines_b
WHERE dnz_chr_id = hdr_rec.ID)
LOOP
IF i_line.sts_code <> 'ENTERED'
THEN
x_return_status := NULL;
x_msg_count := 0;
x_msg_data := NULL;
x_msg_index_out := NULL;
x_clev_rec_type.sts_code := 'ENTERED';
x_clev_rec_type.ID := i_line.ID;
okc_contract_pub.update_contract_line
(p_api_version => 1.0,
p_init_msg_list => fnd_api.g_true,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_restricted_update => fnd_api.g_true,
p_clev_rec => x_clev_rec_type,
x_clev_rec => x_out_clev_rec
);

IF (x_return_status <> fnd_api.g_ret_sts_success)
THEN
DBMS_OUTPUT.put_line
('Set Line Status to ENTERED API Error ');
RAISE g_api_error;
END IF;
END IF; -- end if line is ENTERED
END LOOP; -- end loop for setting lines status to ENTERED

FOR line_rec IN (SELECT ID, line_number
FROM okc_k_lines_b
WHERE chr_id = hdr_rec.ID)
LOOP
DBMS_OUTPUT.put_line ('In Line Loop');
x_return_status := NULL;
x_msg_count := 0;
x_msg_data := NULL;
x_msg_index_out := NULL;
--- Call Delete Contract Line API
okc_contract_pub.delete_contract_line
(p_api_version => 1.0,
p_init_msg_list => fnd_api.g_true,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_line_id => line_rec.ID
);
DBMS_OUTPUT.put_line ( 'Delete Line Numer: '
|| line_rec.line_number
|| ' x_return_status: '
|| x_return_status
);

IF (x_return_status <> fnd_api.g_ret_sts_success)
THEN
DBMS_OUTPUT.put_line
('Delete_Contract_Line API Error: Delete Line.');
RAISE g_api_error;
END IF; -- end if delete line successfull
END LOOP;

---- Deleting contract
x_head_update_rec_type.ID := hdr_rec.ID;
x_return_status := NULL;
x_msg_count := 0;
x_msg_data := NULL;
x_msg_index_out := NULL;
okc_contract_pub.delete_contract_header
(p_api_version => 1.0,
p_init_msg_list => fnd_api.g_true,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
p_chrv_rec => x_head_update_rec_type
);

IF (x_return_status <> fnd_api.g_ret_sts_success)
THEN
DBMS_OUTPUT.put_line ('Delete Contract API Error: ');
RAISE g_api_error;
END IF;

DBMS_OUTPUT.put_line ('Delete Successfull');
COMMIT;
EXCEPTION
WHEN g_api_error
THEN
ROLLBACK;

FOR i IN 1 .. x_msg_count
LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => fnd_api.g_false,
p_data => x_msg_data,
p_msg_index_out => x_msg_index_out
);
DBMS_OUTPUT.put_line ('x_msg_data: ' || x_msg_data);
END LOOP;
WHEN OTHERS
THEN
ROLLBACK;
DBMS_OUTPUT.put_line ('When Others Error: ' || SQLERRM);
END; -- end begin for header cursor
END LOOP; -- end loop contract header

DBMS_OUTPUT.put_line ('End');
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
DBMS_OUTPUT.put_line ('Error: ' || SQLERRM);
END;


**************************************************************************************


P.S.: APIs used in the code are not supported by Oracle.
You may also try out OKC_DELETE_CONTRACT_PUB.delete_contract API

Sunday, August 7, 2011

API To Create/Update Party

This post describes the purpose of the
1>.“csi_party_relationships_pub.update_inst_party_relationship.  This API can be used to create a new instance party relationship in Installed Base.
2>.csi_party_relationships_pub.create_inst_party_relationship”. This API can be used to update an existing instance party relationship in Installed Base.

Pre-Requisite
-----------------
1. Install Base module should be installed

API Description:
--------------------
Package And Procedure Name
The API for creating/updating the party/owner is available in the standard package csi_party_relationships_pub.
 The PL/SQL Procedure create_inst_party_relationship of the standard package mentioned above is used to create a new instance party/owner relationship in Installed Base.
The PL/SQL Procedure update_inst_party_relationship of the standard package mentioned above is used to update an existing instance party/owner relationship in Installed Base

APIs Description: Parameters
------------------------------
Parameter NameType(In/Out)Data Type



p_api_versionINNUMBER
p_commitINVARCHAR2
p_init_msg_listINVARCHAR2
p_validation_levelINNUMBER
p_party_tblINcsi_datastructures_pub.party_tbl
p_party_account_tblIN OUT NOCOPYcsi_datastructures_pub.party_account_tbl
p_txn_rec
IN OUT NOCOPY
csi_datastructures_pub.transaction_rec
x_return_statusOUT NOCOPYVARCHAR2
x_msg_countOUT NOCOPYNUMBER
x_msg_dataOUT NOCOPYVARCHAR2




API Description: Parameter Sources
------------------------------------- 

In the Test Script the objective of the Test to create/update the following fields of the party/owner relationship.
1. Party details.
2. Party relationship.
3. Party Account details.
As the Asset Association is updating with the API, So the p_asset_assignment_tbl is populated.

In other cases Please refer to the table below.

Table Type Parameter NameAssociated Functional part


p_party_tblParty Association Updation.
p_account_tblParty-account relationship updation.
p_txn_recDetails of the Transation create as a part of current updation.

In the subsequent call the parameters used are: 
-----------------------------------------------
Parameter Name
Source(Tablename.column / Query)


p_party_tbl.instance_party_id
csi_i_parties.instance_party_id
p_party_tbl.instance_id
csi_i_parties.instance_id
p_party_tbl.party_id
csi_i_parties.party_id
p_party_tbl.object_version_number
csi_i_parties.object_version_number
p_party_tbl.relationship_type_code
csi_i_parties.relationship_type_code
p_party_tbl.party_source_table
'HZ_PARTIES'
p_party_tbl.active_start_date
System Date
p_party_tbl.active_end_date
NULL
p_party_tbl.contact_flag
N
P_ account_tbl.ip_account_id
csi_ip_accounts.ip_account_id
P_ account_tbl.instance_party_id
csi_ip_accounts.instance_party_id
P_ account_tbl.party_account_id
csi_ip_accounts.party_account_id
P_ account_tbl.object_version_number
csi_ip_accounts.object_version_number
P_ account_tbl. relationship_type_code
csi_ip_accounts.relationship_type_code
P_ account_tbl. parent_tbl_index
1
P_ account_tbl. active_start_date
System Date
p_api_version
1.0
p_commit
fnd_api.g_false;
p_init_msg_list
NULL
p_validation_level
3
P_ txn_rec.transaction_date
System Date
P_ txn_rec.source_transaction_date
System Date
P_ txn_rec.transaction_type_id
1 ( This value is derived from the table CSI_TXN_TYPES) ( 1 : Installed Base User Interface)
P_ txn_rec.object_version_number
1

1.       Get the above parameters from the table.columns mentioned above.
2.       Call the API though the calling script mentioned below.

*** > csi_party_relationships_pub.create_inst_party_relationship.

DECLARE
X_PARTY_TBL CSI_DATASTRUCTURES_PUB.PARTY_TBL;
X_ACCOUNT_TBL CSI_DATASTRUCTURES_PUB.PARTY_ACCOUNT_TBL;
X2_TXN_REC CSI_DATASTRUCTURES_PUB.TRANSACTION_REC;
x_return_status VARCHAR2(100);
x_msg_count NUMBER;
x_msg_data VARCHAR2(30000) := NULL;
x_created_manually_flag VARCHAR2(100);
l_org_id number:=41;
n number :=1;
V_INSTANCE_ID NUMBER;
P_COMMIT VARCHAR2(5);
P2_COMMIT VARCHAR2(5) := fnd_api.g_false;
P_VALIDATION_LEVEL NUMBER;
P_INIT_MSG_LST VARCHAR2(500);
V_INSTANCE_PARTY_ID NUMBER := 0;
V_IP_ACCOUNT_ID NUMBER := 0;
V_RELATIONSHIP_ID NUMBER;
V_SUCCESS VARCHAR2(1) := 'T';
X2_RETURN_STATUS VARCHAR2(100) := NULL;
X2_MSG_COUNT NUMBER;
x2_msg_data VARCHAR2(20000) := NULL;
P2_VALIDATION_LEVEL NUMBER;
P2_INIT_MSg_LST VARCHAR2(500) := NULL;
x_my_text VARCHAR2(30000) := NULL;
x_error_text VARCHAR2(30000) := NULL;
l_error VARCHAR2(30000) := NULL;
t_output                     VARCHAR2(2000);
t_msg_dummy               NUMBER;
BEGIN
V_INSTANCE_ID := <Instance id>;
V_INSTANCE_PARTY_ID := <Instance party id>;
V_IP_ACCOUNT_ID := <IP account id of the customer>;
csi_datastructures_pub.g_install_param_rec.fetch_flag := NULL;

g_party_tbl.instance_party_id := <INSTANCE_PARTY_ID>;
g_party_tbl(1).instance_id := <INS_ID>;
g_party_tbl(1).party_id := <PARTY_ID>;
g_party_tbl(1).object_version_number := <VERSION number>;
g_party_tbl(1).relationship_type_code := 'LEGAL OWNER';
g_party_tbl(1).party_source_table := 'HZ_PARTIES';
g_party_tbl(1).active_start_date := SYSDATE;
g_party_tbl(1).active_end_date := NULL;
g_party_tbl(1).contact_flag := 'N'
x2_txn_rec.transaction_date := TRUNC(SYSDATE);
x2_txn_rec.source_transaction_date := TRUNC(SYSDATE);
x2_txn_rec.transaction_type_id := 1;
x2_txn_rec.object_version_number := 1;


P2_VALIDATION_LEVEL := 3;
P2_INIT_MSg_LST := 'T';

g_account_tbl(1).ip_account_id := <IP_ACCOUNT_ID> ;
g_account_tbl(1).instance_party_id := <INSTANCE_PARTY_ID>;
g_account_tbl(1).party_account_id := <CUST_ACCOUNT_ID>;
g_account_tbl(1).object_version_number := <ACNT_VERSION>;
g_account_tbl(1).relationship_type_code := <Relationship Type code>;--'LEGAL OWNER';
g_account_tbl(1).parent_tbl_index := 1;
g_account_tbl(1).active_start_date := SYSDATE;

CSI_PARTY_RELATIONSHIPS_PUB.CREATE_INST_PARTY_RELATIONSHIP
(
p_api_version => 1.0
,p_commit => P2_COMMIT
,p_init_msg_list => P2_INIT_MSg_LST
,p_validation_level => 3  -- P2_VALIDATION_LEVEL
,p_party_tbl => X_PARTY_TBL
,p_party_account_tbl =>  X_ACCOUNT_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
);
dbms_output.put_line(X2_RETURN_STATUS);
IF X2_MSG_COUNT > 0 THEN
    FOR j in 1 .. X2_MSG_COUNT
      LOOP
      fnd_msg_pub.get ( j
                          , FND_API.G_FALSE
                          , X2_MSG_DATA
                         , t_msg_dummy );
  t_output := ( 'Error' || To_Char ( j ) || ': ' || x2_msg_data );
dbms_output.put_line(t_output);
END LOOP;
END IF;
END ;

*** > csi_party_relationships_pub.update_inst_party_relationship.

DECLARE
X_PARTY_TBL CSI_DATASTRUCTURES_PUB.PARTY_TBL;
X_ACCOUNT_TBL CSI_DATASTRUCTURES_PUB.PARTY_ACCOUNT_TBL;
X2_TXN_REC CSI_DATASTRUCTURES_PUB.TRANSACTION_REC;
x_return_status VARCHAR2(100);
x_msg_count NUMBER;
x_msg_data VARCHAR2(30000) := NULL;
x_created_manually_flag VARCHAR2(100);
l_org_id number:=41;
n number :=1;
V_INSTANCE_ID NUMBER;
P_COMMIT VARCHAR2(5);
P2_COMMIT VARCHAR2(5) := fnd_api.g_false;
P_VALIDATION_LEVEL NUMBER;
P_INIT_MSG_LST VARCHAR2(500);
V_INSTANCE_PARTY_ID NUMBER := 0;
V_IP_ACCOUNT_ID NUMBER := 0;
V_RELATIONSHIP_ID NUMBER;
V_SUCCESS VARCHAR2(1) := 'T';
X2_RETURN_STATUS VARCHAR2(100) := NULL;
X2_MSG_COUNT NUMBER;
x2_msg_data VARCHAR2(20000) := NULL;
P2_VALIDATION_LEVEL NUMBER;
P2_INIT_MSg_LST VARCHAR2(500) := NULL;
x_my_text VARCHAR2(30000) := NULL;
x_error_text VARCHAR2(30000) := NULL;
l_error VARCHAR2(30000) := NULL;
t_output                     VARCHAR2(2000);
t_msg_dummy               NUMBER;
BEGIN
V_INSTANCE_ID := <Instance id>;
V_INSTANCE_PARTY_ID := <Instance party id>; 
V_IP_ACCOUNT_ID := <IP account id of the customer>;
csi_datastructures_pub.g_install_param_rec.fetch_flag := NULL;

g_party_tbl.instance_party_id := <INSTANCE_PARTY_ID>;
g_party_tbl(1).instance_id := <INS_ID>;
g_party_tbl(1).party_id := <PARTY_ID>;
g_party_tbl(1).object_version_number := <VERSION number>;
g_party_tbl(1).relationship_type_code := 'LEGAL OWNER';
g_party_tbl(1).party_source_table := 'HZ_PARTIES';
g_party_tbl(1).active_start_date := SYSDATE;
g_party_tbl(1).active_end_date := NULL;
g_party_tbl(1).contact_flag := 'N'

x2_txn_rec.transaction_date := TRUNC(SYSDATE);
x2_txn_rec.source_transaction_date := TRUNC(SYSDATE);
x2_txn_rec.transaction_type_id := 1;
x2_txn_rec.object_version_number := 1;


P2_VALIDATION_LEVEL := 3;
P2_INIT_MSg_LST := 'T';

g_account_tbl(1).ip_account_id := <IP_ACCOUNT_ID> ;
g_account_tbl(1).instance_party_id := <INSTANCE_PARTY_ID>;
g_account_tbl(1).party_account_id := <CUST_ACCOUNT_ID>;
g_account_tbl(1).object_version_number := <ACNT_VERSION>;
g_account_tbl(1).relationship_type_code := <Relationship Type code>;--'LEGAL OWNER';
g_account_tbl(1).parent_tbl_index := 1;
g_account_tbl(1).active_start_date := SYSDATE;

CSI_PARTY_RELATIONSHIPS_PUB.UPDATE_INST_PARTY_RELATIONSHIP
(
p_api_version => 1.0
,p_commit => P2_COMMIT
,p_init_msg_list => P2_INIT_MSg_LST
,p_validation_level => 3  -- P2_VALIDATION_LEVEL
,p_party_tbl => X_PARTY_TBL
,p_party_account_tbl =>  X_ACCOUNT_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
);
dbms_output.put_line(X2_RETURN_STATUS);
IF X2_MSG_COUNT > 0 THEN
    FOR j in 1 .. X2_MSG_COUNT
      LOOP
      fnd_msg_pub.get ( j
                          , FND_API.G_FALSE
                          , X2_MSG_DATA
                         , t_msg_dummy );
  t_output := ( 'Error' || To_Char ( j ) || ': ' || x2_msg_data );
dbms_output.put_line(t_output);
END LOOP;
END IF;
END ;


Steps To Verify the Effect of 
-----------------------------
csi_party_relationships_pub.update_inst_party_relationship/  csi_party_relationships_pub.create_inst_party_relationship
----------------------------------------------------------
Verification: Changes that are expected
----------------------------------------
a> It should create/update the party/owner relationship within the Install Base
b> In csi_i_parties and csi_ip_accounts tables there should be column for the created/updated party id and account id.
Verification: Changes That Occur 
> Navigation to check the changes –
 Oracle Installed Base User 
a> Oracle Installed Base 
b> (Search with item instance -> Click on “Discription) 
c> Party Relationship à Parties/Accounts
In csi_i_parties and csi_ip_accounts tables there are columns for the created/updated party id and account id.
1>. SELECT relationship_type_code
, object_version_number
, last_update_date 
FROM csi_i_parties
WHERE party_id=<above mentioned party id>;

2>. SELECT relationship_type_code
, object_version_number
, last_update_date 
FROM csi_ip_accounts
WHERE ip_account_id=<ip account id>;



Saturday, July 16, 2011

Custom list management process (Sales Query Templates)

Introduction

This white paper provides an overview of an end to end solution to custom list management process. In today’s business scenario, very often we come across requirements, where client wants to generate a list of Parties/customers for different Campaigns. The Campaign can be Sales or Email and user can be Sales one or Marketing one. In this white paper we will discuss on an end to end solution how we can create custom list management process for different conditions/attributes/parameters based on which Sales/Marketing can get the  Parties/Customer list for Sales/Email Campaigns.

Business Case

In Oracle marketing, Very often clients want to get the list of parties/customers based on their own conditions as per their business need, which seeded Sales Query Template fails to provide, in such cases we need to provide Custom list management process based on their conditions. This custom list management process consists:
1.    Creation of custom view based on business requirements.
2.    Custom Data Source creation based the custom view created above.
3.    Custom Sales Query Template based on the custom Data Source created above.

Technology Used

The following technologies will be used while designing the solution:
1.    PL/SQL

Solution Overview

      Prerequisites

                  User should have Audience Administrator access.

      Data Base Table/View

Create custom database table/view based on your business requirements which will include all the attributes/conditions in form of columns.
Ex. A database view named XX_TEST_V has been created.

Prerequisites – You should have correct database access.

        Data Source     


Data sources are a fundamental component of the list management process. It helps the list creating process. Data can be stored in the application and use them to manage the audience for their products.

In short, they determine the type of data retrieved for lists.
Data sources determine:
• Attributes available to the end user during list creation
• TCA information mapping (when remote lists are migrated to a local instance)
• Data available in list entry
• Attributes available for splitting and charting
• Deduplication rules
Data sources map columns from a source table (or view) to the marketing list entries table AMS_LIST_ENTRIES. Once mapped, data from the table or view can be used for lists.

Data sources can be either child or parent. The parent data source determines the type of list that will be created. Usually, the attributes included in the parent data source are mapped to the list entries. Each parent data source also includes seeded templates and de-duplication rules. A child data source provides additional information about the parent. A parent can have an unlimited number of child data sources associated.

Creation of Data Source

If the seeded parent data sources do not meet your business requirements you can
create your own custom data source. When doing so, you can point to the Oracle TCA.
You can also use data that resides in a remote location

Prerequisites – You should have a table/view ready to use.

Configuring Data Source Attributes

When creating or updating data sources you will define the attributes for it. Using the
data source attribute pages, you can define data source attributes for list management
as well as data mining. The following table gives the descriptions for data source
attributes.


Data Sources Attributes

Attribute Name
Description
Attribute
The attributes of the table or view that the
data source references. The values are
displayed as they exist in the table or view
Display Name
Allows you to change the display name for the
attributes. The values entered in this column are displayed to the end user during the list creation process.

Map to List Entries
Use this field to map or organize how this
data source is displayed in the list entries
screen for the end user.
Note :- These are actually columns of AMS_LIST_ENTRIES table.
Display in List Entries
Use this checkbox to indicate that you want
this data source to display data (by default) in
the List Entries page for the end user.
Use for Split
The end user has the option to split a list by
attribute. Therefore, as the administrator,
when defining data source attributes, you
must specify that it is available for splitting.
Note :  If you want to use for splitting you must mapthe attribute.
Define LOV Chart
Selecting this icon enables you to define LOV
and chart ranges for this data source. If you
are charting an attribute, you must also map
to list entries.
LOV
If a list of values are defined for this attribute,
then you will see a check in this column.
Chart
If a chart is defined for this attribute, then you
will see a check in this column.
Enabled
Place a check in this checkbox to enable the
attribute for the data source. If this checkbox is left unchecked, this attribute will not be
available for use in the Sales Query template creation process.



Defining the List of Values and Charts for Data Sources

When defining data source attributes, you can choose to define a list of values that
correspond to it. This list of values can also be used to drive the chart ranges. This
reduces the chance of error because you are limiting the data the user can select.

To define the LOV and chart attribute, login as a user that has the Audience
Administrator responsibility and navigate to the Administration Dashboard.
Notes
• Locate the Data Source you want to configure and in the Attributes mid-tab, select
the Define, LOV chart icon.
• In the Add List of Values Using drop-down, select one of the following:
Manual Entries: This option enables you to manually define the LOV for the
attribute. If using this option, select "Add Another Row" and enter a value code
and display name.
Value code: Exact value (as it appears in the database). For example, the value
code for country could be CAN for Canada.
Display name: Text box that allows you to change the code name to a more
user-friendly display name. For example, the display name for CAN could be
Canada.
Another List of Values: Allows you to pick a specific list of values that have
previously been defined for similar attribute. This option allows you to re-use
the LOV that has previously been defined. This will save you time. Using this
option you essential share the LOV with other attribute, therefore changing the
definition of the LOV will affects all attributes sharing this LOV.
List of Value Name: Specify the values that you'd like this attribute to have. For
example, if you'd like the attribute "COUNTRY" to have "United States" and "
Canada" as the list of value options, select them here.
Custom SQL: Using this option, you can define the list of values using data
retrieved with SQL logic. Use the Custom SQL box to enter an SQL statement.
           
***Note: If you define an SQL query for an LOV, ensure that it does not
return a null value for the columns you selected.

        Set Up Details For Data Source



q     Click On APPLY Button
q     In the next screen provide the “Description” same as the name          
q     Here you will get the columns associated with view selected (Ex. XX_TEST_V here) as Attributes
q     Do the following changes against Display Name, Map To List Entries, Display In List Entries and Define LOV, Chart

How To Change “Display Name”

q   Just update the appropriate Display Name against each attributes.

How to “Map To List Entries”

q   Click on ‘Search’ symbol, right side of the Map to List Entries column.
q   Search by Column name and select the appropriate column.

How to do “Display in List Entries”

Ø  Check the check box against the attributes, which you want to show in the List/Campaign result.

How to do “Define LOV, Chart”


***Note: If you define an SQL query for an LOV, ensure that it does not
return a null value for the columns you selected.

Ø  Click on the symbol ‘Define LOV, Chart’ ageist an attribute
Ø  Select the appropriate option for “Add List of Values Using”
                   >> Steps to do when you select “Custom SQL” as “Add List of Values Using”
v  Click on “Go”
v  Give the appropriate “List of Values Name” and “Custom SQL” value.
v  Click on “Validate SQL
v  It will give the confirmation of valid query, click on “Apply”
>> Steps to do when you select “Another List of Values” as “Add List of Values Using”
v  Case when you want to reuse the same LOV
v  Click on “Go”
v  It will Create a “Search” Button against “List of Value Name”
v  Search (Click on the search Button) the appropriate LOV and Select.

v  It will automatically populate Custom SQl, validate query and apply, as you did before.
q   Steps to do when you select “Manual Entries” as “Add List of Values Using”
v  Click on “Go”
v  Then Click on “Add Another Row” Button
v  Give the appropriate “List of Values Name” and add as many rows you need to add and “Apply” button.

Sales Query Template

Sales Query Templates enable the end users to quickly and easily create lists. When creating a list, end user hastwo different list template options to choose from:
Standard List Template: You can specify conditions using the Natural Language
Query (NLQ) template, just as you would naturally think of them. You can define
your selection criteria by selecting the operator and the corresponding value for
each condition.
Parameterized SQL List Template: The Parameterized SQL List Template is based
                   on an SQL statement with parameters you provide to your user. Users must enter
 values from the selection parameters while creating a list.

Creation Of Sales Query Template

Custom Sales Query Template can be created with additional user-defined Conditions to meet            business requirements. These query templates can be based on the out-of-box data sources (Organization Contacts, Persons, Organizations) or any user-defined data source (for example, an industry-specific data mart). You can create these templates using either the Standard or Parameterized SQL template options.

Prerequisites – You should have a Data Source ready to use

Mapping Table of Sales Query Templates (Attributes)

You must configure the attributes that you will use to create a query, which are actually the parameters for the query while getting the Campaign List.

Attribute Name
Description
Attributes
The attributes that you define for the query
template. These are actually the parameters (where clause) of the query used at the time of Campaign List creation
Attribute Display Name
The name of the attribute as it is displayed in
the table. For example: an attribute “ZIP Code “might have “Postal Code”
as the display name.
Available Operators
These are specific operators that you may
choose from to add value to the attribute. For
example: you can define the operator 'is
between' , 'is after' for the “Contract Date”.
***Note :- You can choose more than one operator for an attribute.
Operator Default
Choose the default value of the operator
Value
List of values.
Value Display
Description against the attribute what to do, whether to enter the value manually or pick from the LOV
Default
If checked, this value is the default.
Mandatory
If checked, this attribute is the mandatory
In Use
Shows if the attribute is in use already.
***Note :- If it is checked, you cannot modify (update/delete) that attribute.


Set Up Details For Sales Query Templates

Go to Marketing Administrator Responsibility ->Campaign Dashboard
                ->  Right side in Related Link Click on Audience Workbench
                ->  Right side in Related Link Click on Audience Administrator
                ->  Right side in Shortcuts Click on Create Query Template

q   Enter the following values and Click on ‘Continue’ button
Field
Value
Query Template Name
Test Sales Query Template
Query Template Type
Standard
Data Source Name
Test  Data Source
Purpose
It is required to select a purpose. Purpose types are seeded, however, you can extend the purpose type lookup.
Seeded Purpose Types:
Cross Sell: Used for creating lists for the cross selling purposes.
Customer Acquisition: Used for creating lists for customer acquisition purposes.
Customer Retention: Used for creating lists for customer retention purposes.
General Purpose: Used for creating general lists (not tied to a specific purpose).
Lead Maturation: Used for creating lead maturation lists
Up Sell: Used for creating lists for up selling purposes.

>> Select as per your requirement, here we have selected “ALL”


*      Add Following attributes by clicking ‘Add Another Row’ Button.
Ø  How to add an attribute
*      Click on Search button ‘Select the Attribute Value’ for “Attributes”

*      It will open an window with all the columns associated with the view linked with the related Data Source, ‘Select to Expand’ all the attributes/columns
Creating Self Joins for Complex Queries - * Not in the scope of this implementation
In Oracle Marketing you can create a Self Join for complex queries. A Self Join is a query in which a table is joined to itself. You can use a Self Join to compare the values in a column with other values in the same column of the same table. This way you can get running counts and running totals in the SQL query. You can create a Self Join at the attribute stage.

*        Select the appropriate attribute
*      Now click on the Search button for ‘Available Operators’ and select the appropriate operator/operators.
*      Next to click on Search button for ‘Operator Default’ and select the operator defaulted
   
*      Steps to select ALL VALUE for “Value

*      Click on Search button for “Value” and select ‘List of Values’ from LOV and click on Go

*      Select all the values populated

v  Example 1
v  Example 2
*      Based on the operator selected please enter user friendly text in the ‘Value Display’ field, like “:Enter a Value”, “:Pick any value
*      Click on ‘Validate’ for ‘SQL validation’ and then on ‘Back’
*      After adding all the attributes and associated values, click on ‘Finish’ button

                              *** We are done with the Setups***

Verification Checklist


Include a subset of test steps that will confirm that the setup has been done properly and working fine.
*      Please navigate to Marketing Administrator Responsibility -> Campaign Dashboard -> Audience Workbench. This should open Activities Page. Click on Create List button.
*      Enter the required fields
Field
Value
List Name
xx_test_list
Audience
Test Data Source
List Creation Method
Standard
List Template Name
Test Sales Query Template


*      Click onContinue’ button
*      In next window default conditions/parameters/attributes will automatically be populated in ‘Selection’ section
*      Enter the values for those parameters.
*      Add more conditions by clicking on ‘Add Conditions’ button
*      Enter the values for the selected conditions and click on ‘Finish’
*      Click on ‘Generate List’
*      Refresh list status to generate the list ‘Status’ will change from draft->Scheduled-> Generating > Available
List Generation Status

Draft: when the recalculation table is not available.
In Progress: when you click the Apply button in the NLQB template definition
page. This implies that the concurrent request is submitted and recalculation table
generation is in process.
Available: when the recalculation table generates successfully.
Failed: when the recalculation table generation fails. Click the Apply button againto restart the recalculation table generation process

*      After changing the status to ‘Available’, check the generated list by clicking on ‘Entries’ tab.
*      Check the list summary by clicking on Selections->statistics tab.

Important Points To Remember/ Limitations


There are few important points to remember while creating the custom list management process.
v  Unique key limitations.
Ø  While defining Data Sources, you need to mention the Unique Key, which should be one of the columns of the view used.
Ø  Now while defining Sales Query Templates we define different parameters but Unique Key gets priority over all others and be seen as duplicate record in Campaign/List result.
Ex:- suppose we defined Party_id as a Unique Key, and party name, City, State, Service Contract etc. as other parameters in Sales Query Template.
While getting the Campaign/List we passed the parameter State as ‘WB’ and it gave three results as :
246836 Cognizant Technology Solutions      Kolkata           WB    23789
246836 Cognizant Technology Solutions      Bardhman      WB    68456
246836 Cognizant Technology Solutions      Ramput Hat   WB    98799     
Even if these three rows are different, campaign/List results will be treated as Duplicate results, because Party_id is the Unique Key.
Solution :- If you want to see these three rows as unique rows, create a custom column, combining values of different columns, like here you can define a custom column by combining (party_id + territory_id + contract_number)
v  Re-creation of Sales Query Templates.
Ø  Once you done with creating Sales Query Template and used once, you cannot modify in between, means you cannot add new parameter in between. You can only add at the end, so get the final list and order of the parameters to be defined in the Template before creating.
v  For using ‘Like’ operator, it needs to provide % operator explicitly in the parameter value.
v  Parameter values cannot be handled through front end, it can only be handled while creating database view. Ex. For free form fields, you cannot allow user to enter text in any case, it should be fixed either in upper case or in lower case or the case which can be handled at the time of view creation.
v  Profile Options values cannot be retrieved in view used, of course it can be retrieved when you            fetch from application.
v  No FNDLOAD available to download LDT of these setups, you have to do it manually if you want to migrate it to another instance 

Troubleshooting

v  List in 'Scheduled' Status.
Ø  While creating List, sometimes List status always be there in ‘Scheduled’ status.
Ø  Cause: The lock is in Workflow process at AMS_LIST_INIT_DET LIST_GENERATION
Ø  Solution: To implement the solution, please execute the following steps:
      1) Bounce the Concurrent Manager if Workflow Agent Listener is already running.
      2) If after bouncing the Concurrent Manager it still does not work then restart the Workflow Agent Listener for (Deferred) events.
v  Error: Query has exceeded <N number> rows. Potentially more rows exist, please restrict your query.
Ø  When your LOV query returns more rows, you can get the above error at the time of List generation.
Ø  Cause: The profile option 'FND: View Object Max Fetch Size' was set at 100.  This profile option controls the number of rows displayed in the OA Framework.
Ø  Solution: Increase the value for the profile option 'FND: View Object Max Fetch Size'. The default value is 200, but greater values can affect performance.  

Summary

This white paper provides the basic features of Custom list management process, we have more sophisticated features like parent-child Data Source, parameterized Sales Query Template etc. which also have some limitations, but those parts have not been discussed here. Again it depends upon business requirement which way we can achieve.
To implement custom list management process we have more setup related activities rather than technical work (creating database view/table and writing SQL queries for list of values). We have few limitations while creating list management process but most of the business requirements can be achieved through it which cannot be done through seeded Data Sources and Sales Query Templates.