Showing posts with label ORACLE APPLICATIONS FUNCTIONALITY. Show all posts
Showing posts with label ORACLE APPLICATIONS FUNCTIONALITY. Show all posts

Tuesday, 12 April 2011

ORACLE APPLICATIONS FUNCTIONALITY



ORACLE APPLICATIONS FUNCTIONALITY.
/***************************************/

 Oracle applications is a integrated comprehensive suite of 
applications which includes a complete suite of products starting 
from marketing, SALES, service, telesales, order management, 
AP, AR, GL, Contracts etc.

The hierarchy in Oracle application is given by the  

         user 
           |
  responsibility 
  /  \
    menu    Request Groups
     |          |        \
function. Concurrent programs   Request Sets     | \
    Concurrent Request
 programs   Stages       | 
      Concurrent Programs


When a user enters into the oracle applications, the user is prompted to 
choose one of the responsibilities that are available. The typical 
responsibilities that are available are the system administrator, application 
developer and product specific responsibilities. Typically one responsibility 
corresponds to one product application. As an ex, a responsibility called 
"Marketing Intelligence Collection Manager" is created for accessing the 
Marketing Intelligence application product.  Once the user chooses this 
responsibility then all the functionality corresponding to that product 
comes up. That means he can run all the concurrent programs corresponding 
to that. Similarly a general ledger responsibility will have the functionality 
corresponding to that. A user can be given more than one responsibility from 
which he can choose when he logs in. System administrator is the greatest 
responsibility that a user can have. It gives complete access to the system. 

 Each responsibility is also tied to a request group. A request group 
is a set of concurrent programs. If a user has a responsibility which is tied 
to a request group, then that user can access/run all the concurrent programs 
that are in that request group. Optionally a request group can also be a 
collection of concurrent programs and request set. A request set is a convenient 
way of clubbing certain related concurrent programs into one unit, so that 
when the user runs that request set, all the concurrent programs mentioned
in that request set are run at once concurrently. This is very convenient 
for a customer who does not need to run individually each concurrent 
program. There is a request set wizard to create request sets. In a 
request set, we can optionally specify conditionally whether to continue 
with the next concurrent program if the first one succeeds or fails. 
We can also define the request stages in the request sets.
 As mentioned above in the diagram, a responsibility is tied 
to a single menu. A menu can have submenus. And a menu or submenu is 
tied to multiple functions. A function is typically a report 
(any kind of report like a html or oracle reports report). Hence if 
a user can access to a menu which has five submenu items then he 
can see five menus after he logs in and if he double clicks on each 
one of them, he sees the corresponding functions.  A sysadmin can 
typically define a function by specifying a function name, its 
parameter, the way of calling that function etc.

Now let us see what are the typical functions a user can do with 
the system administrator responsibility. Using sysadmin 
responsibility he can define new users, new responsibilities. He 
can also define profile values (site level or application level). 
He can create new concurrent programs which is done as follows. 
To define a concurrent program he first needs to create an 
executable. An executable is tied to a pl/sql program package 
(package.procedure). Once the executable is defined, the concurrent 
program is defined and this executable is tied to that. And when 
the user runs this concurrent program, the corresponding package 
procedure is executed on the server side. The user can also specify 
the parameters for this concurrent program at the time of definition. 
The user can define a value set. A value set is typically a lov 
(list of values). Once a value set is defined, when a parameter is 
created, the parameter can be associated with this value set, so 
that the user is restricted to those set of values.
  Now let us see the functions that a user can do 
using the application developer responsibility. An apps developer 
can define objects and regions. A region typically consists of 
various attributes and the corresponding values. And objects 
are typically queries. Using Apps Developer responsibility you 
can also define messages. Oracle Message dictionary provides 
nls compliant messages. Once defined all the developers can 
use the message by using the fnd_message.get_message and 
fnd_message.set_token api's. Typically when you can getmessage 
the message is fetched from the message dictionary and put on 
the message stack. And after that the tokens (which are defined 
as &) are replaced with the actual parameters.
Once all these are defined, when the product needs to be 
shipped to the customer, the developer needs to download certain 
files and send them. In oracle application, each kind of file 
does certain function. For ex a .pls file is a package or 
procedure. A .ldt file can be concurrent program, request set 
or request group. A .jlt file is  a region and a .slt file is 
a menu and .odf is a file downloaded from the case which 
constructs the schema.

The typical syntax for that is

FNDLOAD apps/apps@seed115 0 Y $FND_TOP/afcconfig.lct  REQUEST_GROUP bimcprg.ldt

FNDLOAD apps/apps@seed115 0 Y $FND_TOP/afcconfig.lct REQUEST_SET bimcprg.ldt

FNDLOAD apps/apps@seed115 0 Y $FND_TOP/afcconfig.lct  PROGRAM bimcprg.ldt

FNDLOAD apps/apps@seed115 0 Y $FND_TOP/afcconfig.lct  PROFILE  bimcprg.ldt

Lookup Values : 
 We can define lookups in Oracle Applications using the 
Application Developer responsibility. On the lookup screen we can 
define a lookup type, lookup code and its meaning. Once defined a 
lookup goes into the fnd_lookups base tables. Then optionally we can 
define a view on top of that table, which will give only our product 
values as,
  Select code,value from fnd_lookups where lookup_type ='AMS%'
Which will give only the AMS related lookup codes.  So while defining 
value sets we can also hit this view ams_lookups in that screen.

Ak region items Data

The Ak regions, ak_region_items is basically the metadata information 
about the UI components. As an ex, let us consider typical report which 
will have the title ,parameters, row data, labels. In this environment all 
these components are defined in the AK database. This will help us , in 
case if the product is installed in any other language then  those table 
data is converted into that particular language and the report is displayed 
in that particular language.

As mentioned earlier a responsibility is typically tied to a particular 
product functionality. Also a function is part of a product functionality 
that is registered under a unique name, for the purposes of assigning to a 
responsibility.

Form function (or form) a form function is a function which invokes a 
form and is called from a navigator window. Subfunction does not 
appear in a navigator window and cannot be navigated to.

As a responsibility will have a menu associated with it which in turn has 
certain functions or menus of functions.  Exclusion rules are those which 
admin will use to associate certain functions or menus of functions to a 
particular responsibility, and hence restrict the access as needed for that 
responsibility. If exclusion rules are not applied then a new menu 
hierarchy needs to be created.

Profile: A user profile is a set of changeable options which affect the 
way your application behaves. There are four types of profile options 
available and they are
 site level profile
 application level  profile
 responsibility level
 user level 
If the "find system profile Values " is set to Application,
The "find system profile Values " block gives all the system profile 
values pertaining to all the users corresponding to all the responsibilities 
of the application. The user level profile has the highest priority. As an 
ex we can have ams_marketing_calendar profile option set at the site 
level and get hte profiel value in the code using  
fnd_profile.get("AMS_MARKETING_CALENDAR");

Grouping concurrent requests: we know that the concurrent request can 
be grouped into a request groups andrequest group can be assigned to 
the request set. while creating request set we can create request stages 
which is again a groups of request.  All the requests in a request stage 
run simultaneously, however the stages as a whole run sequentially. 
Hence according to our requirement we can set certain request into 
stages and run them.
A request stage is successful only if all the requests in it are successful. 
We can also conditionally run the subsequent stage if the previous stage 
is successful.  Hence a request set consists of stages. We can end the 
request set after any stage by not specifying what to do in case of 
success, error or warning ie. if the stage is not linked to any other stage.
Also we can define a particular stage in the request set to be critical in 
which case the status of the request set is the status of the most recent 
critical stage. Also an end user can create request sets which are 
accessible to only him and are called private request sets.
After a set is defined we can assign a user to be owner of that request 
set. When a set is created, we can specify the owner or need not specify. 
if we do specify, then the owner of the set can run that request set (even 
if it is not included in the request group). Hence in summary if a user is 
assigned as owner to a concurrent program, he can either run or edit that 
concurrent program parameters etc.

It is possible to define a concurrent program (using the concurrent  
program form) to be incompatible with a particular concurrent program 
or request set, then that concurrent  program will not simultaneously run 
when the request set is running. You can also define a concurrent 
program to be incompatible with itself meaning two instances of that 
program should not be run simultaneously. If there is such 
incompatibility and if the user has requested a concurrent program to be 
started (and if there is already an incompatible concurrent program is 
running), then the user program is run immediately after the 
incompatible program is completed.

It is possible to define shared parameters define only once for a program 
is a set and it is accessible for all the programs in the set.

Some changes that we make are made immediately available and some 
changes require choosing a different user or responsibility.

Hitherto we have been seeing the standard submission request form of 
the oracle apps. Typically wehen define the execs and concurrent 
programs, they go into the tables which are given below.(AOL tables) 
fnd_concurrent_requests,fnd_run_requests, 
fnd_conc_request_arguments, fnd_conc_stat_summary etc typically if a 
concurrent program writes to a file using the fnd_file.put_line api, then 
the log file is generated whose name is l.req.

We can access the concurrent manager administration screen when v log 
in using the sys admin responsibility. 
We can also start the concurrent manager from the unix command 
prompt as, by setting certain env, 
   say for ex we can start the concurrent manager on saldbg database, 
then
$ relenv code saldbg /afrz/cmrsal 
$ ps -ef  | grep LIBR 
 $ asu -applrt 
 $ startmgr


Some questions: Preserving the custom menu across the upgrades. : 
When we are upgrading the OA menus they might get overwritten. A 
good idea is to reattach a custom menu to an already existent after the 
upgrade.

Stage function parameters window.  ?




Oracle Applications Concurrent program Coding standards.


When we start coding any oracle concurrent program i.e a package spec and body (s.pls and b.pls) , it is necessary we need to follow certain standards. Let us start from the package.procedure from where the user runs the concurrent program. In that concurrent program, we definitely need to have two out variables ERRBUF and ERRCODE. Depending up on the value of the ERRCODE value the concurrent manager will decide this particular concurrent program has errored out or succeeded. A value of 2 for ERRCODE indicates that the concurrent program has failed. And a value of 1 indicates that it is a warning and a value of 0 indicates that it is a success. Hence this is a very important point to consider.  In turn this top level program can call a number of other package.procedures in its script. Each procedure should have certain IN and OUT parameters. The IN parameters are p_api_version_number, p_init_msg_list, p_validation_level, p_commit and the OUT parameters  x_msg_count, x_msg_data and x_return_status.  Now after the api is called, we need to put some code to check whether the api call was successful  which is given below. 

                 IF    x_return_status = FND_API.g_ret_sts_error
                 THEN
                       RAISE FND_API.g_exc_error;
                 ELSIF x_return_status = FND_API.g_ret_sts_unexp_error THEN
                       RAISE FND_API.g_exc_unexpected_error;
                 END IF;

And at the end of that particular procedure we need to put the following logic, (so that if there is any problem with the above called procedure the control jumps to one of the following exceptions)

EXCEPTION

   WHEN FND_API.G_EXC_ERROR THEN
     x_return_status := FND_API.G_RET_STS_ERROR;
     -- Standard call to get message count and if count=1, get the message
     FND_msg_PUB.Count_And_Get (
          --  p_encoded => FND_API.G_FALSE,
            p_count   => x_msg_count,
            p_data    => x_msg_data
     );
 errcode = 2;


   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN

     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
     -- Standard call to get message count and if count=1, get the message
     FND_msg_PUB.Count_And_Get (
            --p_encoded => FND_API.G_FALSE,
            p_count => x_msg_count,
            p_data  => x_msg_data
     );
 errcode = 2;

   WHEN OTHERS THEN
     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
     IF FND_msg_PUB.Check_msg_Level (         FND_msg_PUB.G_msg_LVL_UNEXP_ERROR)
     THEN
        FND_msg_PUB.Add_Exc_msg( g_pkg_name,l_api_name);
     END IF;
     -- Standard call to get message count and if count=1, get the message
     FND_msg_PUB.Count_And_Get (
           -- p_encoded => FND_API.G_FALSE,
            p_count => x_msg_count,
            p_data  => x_msg_data
     );
 errcode = sqlcode;

END POPULATE;

Note that in the exceptions we are setting the errcode to 2 if the api raise either expected or unexpected errors. Apart from api calls raising the exceptions , we can also raise these exceptions, when some error happens.

Flexfields 
A flex field is made up of subfields or segments.  There are two types of flex fields which are key flexfields and descriptive flexfields.

A key flex field consists appears on a form just like a normal text field. But when you click on it, it will open into a window consisting of sub fields or segments. Here each segment has a name and a list of values (or value set). An ex of a key flex field is a inventory part which can segments like the color, size, shape, weight etc. Hence if there is a part number in a particular form. That is this particular part is identified by that value(combination of values). 
Also consider if a part has a flexfield structure f1+f2+f3 , another org can have the same part as f2+f3+f1. Or it can have any number of segments and if the form does not have space to store this, it will provide scrollbars for accommodating this flexfields.

A descriptive fields appears as a one character field with no prompt as[], but when you click on it, it will open into a window with appropriate prompts and segments making up of those fields. It just provides some customizable expansion space.[] They display context sensitive information corresponding to the entered item value.
Descriptive flex fields have two different types of segments, global and context sensitive.
A global segment is a segment that always appears in the descriptive flexfield popup window regardless of the context while a context sensitive segment is a segment that may or may not appear depending upon the context field (reference field)

Hence the flex fields help us in customizing our application and they help us in representing the accounting codes, product codes, item codes with additional programming involved.


Flex field structure
 
  S1  S2 S3 S4 S5

Each segment is represented in the database table as a column. Hence just by jumbling the above segments we get a different structure of the flexfield. Hence we can define more than one structure at a time.

Defining flex fields

 Define value sets for each segment in the flexfield
 Defining the segment structures :prompts,order,sizes)
 define the values for the segments
 define the additional features

 
Combination : A combination is basically a complete set of segment 
values or complete code.A combinations table is basically a key flexfield table which 
stores this kind of complete
codes  and unique id for each such code combination. However the 
other tables refer tot his unique id rather 
than the entire the code.
Qualifier : when you define a flexfield structure, each segment 
 in that configuration is given a particular 
qualifier. This is because a flexfield structure can be represented 
 in any structure (ie S1 S4 S3 S2 S5), 
then we know that the second qualifier is in fourth position currently.

Hence for the already existing flexfield we can define a new structure

When you are capturing key info then typically you would be using a
 key flexfield, and if you are capturing some optional information 
they you would use descriptive flexfield.

MULTI-ORG Concept and Business Groups etc 
/***************************************/
The typical organization hierarchy in Oracle Apps is
  Business group => Legal Entity  => Operating Unit => Inventory Org

We can define each of these things using the responsibility Oracle HRMS Manager, 
 in the work Structures =>  Organization =>  Description.

However if you do not have more than one business group, then 
there is no need to create a business group as Oracle Applications 
provides already predefined business group by name "Setup Business Group".

Now once again,go to the Oracle HRMS manager responsibility and create 
the organizations using the menu,  
 work Structures =>  Organization => Description.
and for each organization, mention the type of organization either 
as legal entity, operating unit and inventory organization. Also we 
can define a single organization and classify as all of them
(legal entity, operating unit and inventory organization ) together.

The UI is being felt as tough here. The sequence of steps that is
followed here are
 create an organization and assign a location to that organization 
 (that you have created before)
 Save this organization
 Classify this organization as legal entity,operating unit or inventory organization.
 Enable this organization , by checking the enable check box and then save it.
 Once enabled, if we try to quit this form, 
 if the organization is legal entity, the system will ask 
for the employer information
 if the organization is operating unit, the system will ask for the legal entity and SET OF BOOKS information.

Hence first create an hierarchy of organizations create as many operating 
units and inventory orgs as has been designed and assigned them to 
correct legal entities and set of books.


MULTIORG SUPPORT :
---------------
The ability to divide a complex organization into a hierarchical 
structure of organization is the idea behind the multiorg structure.
Using oracle apps, we can define the following levels
 Define accounting set of books
A set of books is a functional currency, chart of accounts 
(account structure to record the transactions) and a accounting calendar.
 Define business groups.
Business group is the highest level in the hierarchy of the multi org. 
Employee data is maintained in this group or the business group 
secures the HR information.
 Legal entities
  You prepare tax information for this kind of entity.
 Operating units : or a business unit like Accounting, purchasing etc.
 Inventory orgs : These are the inventory units.

The above hierarchical structure needs to be done after we have 
decided upon which org entities in our org are participating in 
multi-org structure.
First create a set of books account. Once that is done create a 
business group. And then associate this particular business group 
with a responsibility. And then enter the system using that 
particular responsibility. After entering thru this responsibility, 
create the legal entity, when you create the legal entity this 
entity is automatically attached to that set of books.  And then 
create operating units (business units). When you set the profile 
value MO:Operating unit to this particular value , then we you 
login again  thru a responsibility, this profile value is read  
and you will see the info corresponding to that operating unit. 
And then run adadmin.
Typically let us see why a business organization decides to go 
with the multi org concept. This is because if there are multiple 
groups in an org, the people in one org should not be able to see 
the data in other groups which means that every table or data 
structure should be striped by the org_id or every table should 
have org_id as a column. How that is implemented is as follows.

Initially let us say we have a table by name ams_abc.
1. Then we create a table with the name having (_all) i.e ams_abc_all which will have the data corresponding to all the operating units or all organizations. 
2. Then we create a view on top of this table using the query given below.
select * from 1;
  
  SELECT distinct aps.customer_trx_id
  FROM   ar_payment_schedules_all aps
  WHERE  aps.class = 'INV'
  AND    aps.status = 'OP'
  AND    aps.amount_due_remaining < 0
  and    aps.customer_trx_id = 2800242
  AND    EXISTS
      (SELECT 1 FROM ar_payment_schedules_all aps2
       WHERE  aps2.customer_trx_id = 2800242
  AND    aps2.amount_due_remaining > 0 );
  
select selected_for_receipt_batch_id from ar_payment_schedules_all
 where trx_number = '10996'

/*Close Other Windows Disabled 
In Sysadmin Nav Path Security->Responsibility->Define
Query up your PA Reponsibilty, and in the "Menu Exclusion" tab, insert the following line
Type = "Function"
Name = "Navigator: Disable Multiform" 
*/


--CHECK LIST : WHAT ARE THE TYPICAL CHECKS THAT YOU MAKE IN AN ORGANIZATION. 

  --What kind of business they do,is this a Merchandizing business, or a 
     Service business.
  
  /*How many set of books they have,do they reporting set of books as well
    (is it a Multiple country business)*/
  
  select  * from gl_sets_of_books
  -- where mrc_sob_type_code ='N'
  
  /*How many operating units and inventory orgs they have(usually companies have 
    just one each) and multiple subinventories.
    (Interesting in Oracle applications, we do not have a way to see ,given the set 
    of books, how many legal entities,OU,IO's from the forms. But given 
    an Operating unit or IO, we can get to know what is the SOB,LE,OU or IO. 
    Hence the only way to know that heirarchy is to simply run the queries below).*/
  
    select   org_information1  set_of_books_id
      ,org_information2  legal_entity_id
      ,org_information3  operating_unit_id
      ,hoi.organization_id  Inventory_organization_id
      ,org_information4
      ,haou.name
    from   hr_organization_information hoi
       ,hr_all_organization_units  haou
    where   1=1  
    and    hoi.organization_id  = haou.organization_id 
    and    org_information_context ='Accounting Information'
    and    hoi.org_information1 = 1001
  
  Infact there can many set of books even with in US, depending up on the 
  accounting calendar, currency.
   
  Do they use the budgetary control,which let you create the encumbrances from different 
     modules and allows you to funds  checks.
  Do they have MRC (multiple reporting currencies) and where is this set.
  
  What kind of Accounting Methods do they use in the feeder systems like AP, AR etc.
     i.e Cash or Accrual. Mostly this is Accrual.

   The profile option MO: Operating Unit will always the store the 
 operating unit id (and not the inventory_org id)
   The Profile option MO:Top Operating Level stores the values 
 of set of books, legal entity or operating unit. 

   If it is SOB, user can run the report with any LE underneath that sob
   if it is LE,  user can run the report with any OU underneath that LE
   if it is OU,  user can run the report with any OU mentioned in the 
 MO: Operating Unit profile option.
      There are certain predefined oracle app reports which we can run 
 with above mentioned reporting levels.
    Ex : Aging 4 Buckets report.*/
  
 begin
 dbms_output.put_line(fnd_profile.value('ORG_ID'));
 end;

 /* First get to know what is your set of books id. Go to the 
 profile option,"GL Set of Books Name". find the set of 
 books id and name */

  select * from gl_sets_of_books 
  where name = fnd_profile.value('GL_SET_OF_BKS_NAME')

 -- Then you can get to know what is the organization details for your operating unit.
    select organization_id ,name from hr_organization_units
 where organization_id = 
        (select  profile_option_value 
        from    fnd_profile_option_values
        where  profile_option_id
        = (select profile_option_id from fnd_profile_options
           where   profile_option_name = 
    (select DISTINCT profile_option_name 
     from fnd_profile_options_tl
     where user_profile_option_name = 'MO: Operating Unit')
      )
        and  application_id = 0 
        and  level_id = 10001
 )
     
   /* Hr_organization_information table stores two classes of information 
     If org_information_context = 'CLASS', then it gives information 
 about the org itself.
         i.e  whether it is a Legal Entity,Operating Unit, Inventory Organization.
     Interestingly ,the below query will give you info about 
 everything other than set of books id,which makes sense 
 as SOB is accounting stuff.
    */
       select    hoi.organization_id
             ,hoi.org_information_context
       ,haou.name Name,hoi.*
       from  hr_organization_information hoi
       ,hr_all_organization_units  haou
       where hoi.organization_id =728
       and   hoi.organization_id  = haou.organization_id 
       and   org_information_context = 'CLASS'
      
   /* 
   If org_information_context = 'Accounting Information',it provides 
   information on how it is related to other Orgs. Given a specific 
   organization id,get a list of parents i.e set of books,legal entity 
   and operating unit, run it.
   If the org_information_context is Accounting Information, the 
   org_information1 will store the set of books id and org_information3 
    will give the inventory org id. Hence given the set of books id we 
   can get all the heirarchy in one particular record as below. 
  */     
  
 select     org_information1  set_of_books_id
   ,org_information2  legal_entity_id
   ,org_information3  operating_unit_id
   ,hoi.organization_id  Inventory_organization_id
   ,org_information4
   ,haou.name
 from   hr_organization_information hoi
   ,hr_all_organization_units  haou
 where 1=1  
--  and  org_information1= 1  -- this isthe sob id
 and    hoi.organization_id  = haou.organization_id 
 and    org_information_context ='Accounting Information'
and    hoi.org_information1 = 1001

--   What products are installed in the instance

 
      SELECT /*+ USE_NL (A B I) */
       DISTINCT a.application_id, a.application_name,
                b.application_short_name, b.basepath, i.product_version
    ,i.patch_level,i.install_group_num
           FROM fnd_application_tl a,
                fnd_application b,
                fnd_product_installations i
          WHERE a.application_id = i.application_id(+)
            AND a.application_id = b.application_id
            AND a.LANGUAGE = USERENV ('LANG')
  ORDER BY 2




  select * from hr_all_organization_units --where organization_id = 44
  where  name like '%Aus%'
  
  select * from hr_all_organization_units_tl where organization_id = 3608
  
-- If we enable trace from the concurrent requests definition form,  
then the trace file will be created
-- with the oracle process id value as part of its file name.
select oracle_process_id, oracle_session_id, os_process_id, request_id
from fnd_concurrent_requests
where request_id = 4330105
 

-- KFF's & DFF's:
/****************
In the case of Descriptive Flexfields(DFFs),they basically give 
the non-mandatory information (and usually descriptive)
and also they go into the non primary key columns in the 
underlying database tables.
Importantly , they consist of mandatory and optional columns. 
Every DFF will have a code called Global data Elements which will 
consist of certain columns. These are mandatory columns and will 
always show up in the DFF. Apart from it, we can also have 
other user-defined codes and the segments corresponding to it.
So for ex, if "Global data Elements" is defined to have say 3 columns.

and we have defined two more codes as Code1 which has  say 5 
attributes and Code2 which has  say, 6 attributes.
           
Now having defined this, when we go to the from and click on this 
DFF, it will open up and shows the 3 mandatory columns and another
 column which say "Context value". Now for this if we choose Code1,
 it will immediately show
5 more columns in that DFF, making it totally 3 + 5 = 8 columns.
           
Or if we choose Code2, it will immediately show 6 more columns in 
that DFF, making it totally 3 + 6 = 9 columns.

Usually at the table level, this data goes into the attribute 
columns ,with the category column determining
the context. For ex, 
*/

  select interface_header_context, interface_header_attribute1,
 interface_header_attribute2 -- etc
  from    ra_customer_trx_all
  where  interface_header_context = 'VPS-PP SETUP'

/*In the case of Key Flexfield(KFFs) also, we can define as many 
codes as we want for a particular flexfield.However here the user
 is not given the option of choosing which code he wants. Usually 
this is done by a profile
option/System option which decides which particular code is used. 
As an ex, consider the KFF "Accounting Flexfield".,here we can 
define as many codes as we want. However when we define the Set 
of books, we choose which accounting flexfield we want. Once this 
is done, we define the accounting values based on that accounting 
flexfield structure. 

Similarly in the case of KFF, "Sales Tax Location Flexfield", many
 codes are defined like

    Province, city
    state, city
    state,county,city
  And a profile option or a high level System option will determine
which of the above code structures we are going to use (and not the user).
So in the case of AR (Receivables Application), if we go to 
the System Options,*/
 Setup => System => System Options 
 => Tax Tab => Location Flexfield structure(State.County.City)


/*
This actually forms the part of the primary key of the underlying 
table and hence once chosen, we cannot change the option. (However 
we change the context value option and different records will have 
different values).

Apart from all these Item Categories is a different kind of KFF 
and will be explained, this can be found from the Inventory queries.


--Difference between Lookups and Profile Values : 
/*********************************************
 Difference between lookups (more than one value) and profile values.

In the case of Profiles, for a particular profile option, we can have 
a list of values to choose from, but however we only set one value to 
that option. Hence at any point of time, that option will be set to 
a particular value.
For ex, consider the profile option,"GL: Set Of Books" can be set to 
a value of 'US', even though we define multiple set of books like 
AUD,JPN etc.
*/ 

 select * from fnd_profile_option_values

/*
In the case of Lookups, for a particular lookup , we can have may values
active at a particular time. For ex,we can define a lookup say 
crm_campaign_status which can have values like 'NEW', 'PLANNED', 'IN PROGRESS',
'COMPLETED' etc.  We can define as many values for a particular lookup 
and enable and disable a few of them as we need.  But at the time of 
using this lookup, the user may choose only one particular value or more.
*/ 
  select * from ar_lookups

  select * from qp_lookups where lookup_code = 'AGR'

--VALUE SETS :
-------------
Value Set Defn : Typically a value set can be defined as an independent 
list, a LOV based on a table etc. However we can also have a valueset 
which is a DFF. 
Step 1 : Typically a value set can be defined from 
       Setup => application => values
Step 2 : To define a valueset as a DFF, we can go to the DFF definition 
of segments and query for the DFF title as "Flexfield%" and in the value 
below, query by the name created above in the step 1. Once you pull up the 
valueset, we can define the segments corresponding to that flexfield.


Business Group Id and Operating Unit Id :
/***************************************/
Per my understanding,both are used for similar purpose but used by
different modules.
Business groups(business_group_id) are used in HRMS and most(rest!) 
of the other modules use operating unit(org_id), to segregate data visibility. 












Oracle Financials : 

Why not all the flex field structures are stored in a code 
combinations table
• where do u define that the current value of the set of books.(i.e 
what is the current account structure)
• when using the payables we enter the invoices and payments, and in 
receivables we have receipts or cash ,but 
 there is not journal id or batch number  but how they are correlated 
in the general ledger. so we can say that 
 the invoice ,payments,receipts are the actual journals.
• how can we see what is imported

Oracle applications will give predefined flex fields in which 
accounting flexfield is most important (Accounting 
Flexfield is the title) with code = GL#

Now you have to create flexfield structure for ur company based on that 
accounting flexfield by giving a code 
,title etc,(setup,financials,flexfields,key,segments)
Do not freeze the flexfield yet
Define the segments.
 Define the 1st segment. before this also define a value set using 
sysadmin resp and   attach that to this
 Define the 2nd segment. before this also define a value set using 
sysadmin resp and attach that to this
 Define the 3rd segment. before this also define a value set using 
sysadmin resp and attach that to this
 Define the 4th segment. before this also define a value set using 
sysadmin resp and attach that to this
 Define the 5th segment. before this also define a value set using 
sysadmin resp and attach that to this.
Freeze the flexfield definition.
Compile the flexfield. This will generate a concurrent program and will 
be completed by itself.

For the Accounting Flexfield, when it was created which was part of the 
seed data the underlying table defined was 
gl_code_combinations. Likewise for other flexfields we have different 
code combination tables. Hence we choose a 
particular flexfield, we are entering the data, in effect, into a 
particular code combination table.

Hence when all the value sets, segments are properly defined, then the 
flexfield is successfully compiled. So we have
 successfully defined an accounting flexfield structure.
 Actually we can also define the values for each of the segment of the 
flexfield.(This is done at setup,financials,
flexfields,key,values)


  
  
 --- Alerts are of two kinds Periodic and Event driven.
 select * from wf_deferred
 
Periodic alerts are those for which you can set a periodicity like 
on demand,everyweek etc. Event driven alerts basically create a 
trigger on the underlying table ,so that when something like insert 
or update happens they trigger and send an email.