Monday, March 5, 2012

Standalone concurrent program in Oracle Applications


Creating a PL/SQL Concurrent Program in Oracle Applications
===========================================================

This note describes the basic steps to set-up PL/SQL programs as Standalone concurrent program in Oracle Applications
NOTE - Although this article has been prepared on a Release 11, the steps for 10.7 , R12 will be similar.


Introduction
============
These steps will create a package with four procedures.  
The first procedure is a simple standalone procedure that just writes some messages to the log file.  
Secondly create a procedure that calls another procedure as a child process. 
Set-up a procedure as a standalone process that accepts a parameter and outputs the entered parameter to the log file.


1) Create custom application
============================
Customizations should be created in a separate area in a custom application.   

This process relies on a custom table created as described below:
  create table mzRunTable (source_name varchar2(20), status varchar2(20), date_created date);


2) Create and load PL/SQL program
=================================
Create the following two files:


a)  mzRunS.pls
+++ START OF SCRIPT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

create or replace package mzConcTest  is
/** Header - Test package from Oracle Support note 73492.1  - Version 1.0.0**/
  procedure mzFirst(errbuf out varchar2, retcode out varchar2);
  procedure mzCallMe(errbuf out varchar2, retcode out varchar2);
  procedure mzMain(errbuf out varchar2, retcode out varchar2);
  procedure mzParameter(errbuf out varchar2, retcode out varchar2, mzVar in varchar2 );
end mzConcTest ;
/
show errors
commit;
+++ END OF SCRIPT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

b)  mzRunB.pls
+++ START OF SCRIPT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

create or replace package body mzConcTest as

  procedure mzFirst(errbuf out varchar2, retcode out varchar2) as
    mzVar varchar2(20);
    begin
    mzVar := 'OK';
    retcode := 0;
     fnd_file.put_line(FND_FILE.LOG,'mzFirst procedure '|| mzVAR);
     fnd_file.put_line(FND_FILE.LOG,'Retcode = '|| retcode);
  end mzFirst;

  procedure mzCallMe(errbuf out varchar2, retcode out varchar2) as
    begin
        fnd_file.put_line(FND_FILE.LOG,'mzCallMe procedure');
        retcode := 0;
        insert into mzRunTable
        (source_name
        ,status
        ,date_created)
        values
        ('MZCALLME'
        ,'WORKING OK'
        ,sysdate);
    commit;
     fnd_file.put_line(FND_FILE.LOG,'Retcode = '|| retcode);

     exception
       when others then
        retcode := 4;
            fnd_file.put_line(FND_FILE.LOG, 'ABORTED RUN.   Retcode = '|| retcode);

    end mzCallMe;

  procedure mzMain(errbuf out varchar2, retcode out varchar2) as
      l_errbuf varchar2(2000) := '' ;
      l_retcode number(1) :=  0;
      l_phase varchar2(2000) := '' ;
      l_status varchar2(2000) := '' ;
      l_dev_phase varchar2(2000) := '' ;
      l_dev_status varchar2(2000) := '' ;
      l_message varchar2(2000) := '' ;
      l_request_id number := 0;
      l_get_request_status boolean ;
  begin
    retcode := 0;
     fnd_file.put_line(FND_FILE.LOG,'mzMain procedure');
      l_request_id := fnd_request.submit_request('FND', 'MZCALLME', 'Mikes MZCALLME routine');
    commit;
        if l_request_id = 0 then
          l_errbuf := 'Request id is zero' ;
          FND_FILE.PUT_LINE(FND_FILE.log,l_errbuf);
        retcode := 1;
        else
          l_errbuf := 'Request id '||to_char(l_request_id) ;
          FND_FILE.PUT_LINE(fnd_file.log, l_errbuf);
          l_errbuf := 'Monitoring request '||to_char(l_request_id) ;
          FND_FILE.PUT_LINE(FND_FILE.log,l_errbuf);
          l_get_request_status := fnd_concurrent.wait_for_request(l_request_id, 60, 0, l_phase, l_status, l_dev_phase, l_dev_status, l_message);
          if l_dev_status = 'ERROR' then
            l_errbuf := 'Import failed with message '||l_message ;
            FND_FILE.PUT_LINE(FND_FILE.log,l_errbuf);
        retcode := 2;
          else
            l_errbuf := 'Request finished with status '||l_status ;
            FND_FILE.PUT_LINE(FND_FILE.log,l_errbuf);
          end if ;
       end if;
     fnd_file.put_line(FND_FILE.LOG, 'COMPLETED RUN.   Retcode = '|| retcode);

     exception
       when others then
        retcode := 3;
            fnd_file.put_line(FND_FILE.LOG, 'ABORTED RUN.   Retcode = '|| retcode);
  end mzMain ;

procedure mzParameter(errbuf out varchar2, retcode out varchar2, mzVar in varchar2) as
    begin
    retcode := 0;
     fnd_file.put_line(FND_FILE.LOG,'mzParameter procedure');
     fnd_file.put_line(FND_FILE.LOG,'Parameter received was: '|| mzVar);
     fnd_file.put_line(FND_FILE.LOG,'Retcode = '|| retcode);
end mzParameter;

end mzConcTest ;
/
show errors
commit;
+++ END OF SCRIPT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now run mzRunS.pls then mzRunB.pls against the database.  It was loadied against the APPS schema,
but one should load them into the Custom Schema and create appropriate grants and synonyms if required.
The files above compile successfully against an Oracle 8.0.4 database.   If any errors are received,
check the source files for incorrect spacing, spelling or extra carriage returns.


3) Set-up concurrent program and test results
=============================================
For this section it is assumed that a custom application called 'PLSQL Test' was created.  
Enter whatever the custom application is called where 'PLSQL Test' is mentioned in the following set-up steps.

Set-up three separate tests one at a time.  

Test One - simple standalone procedure
--------------------------------------

As System Administrator do the following:-

a) Setup the Executable.   Concurrent-->Program-->Executable
Executable              = mzFirst
Short Name        = mzFirst
Application             = PLSQL Test
Description             = First Test
Execution Method        = PL/SQL Stored Procedure
Execution File Name     = mzConcTest.mzFirst

b) Define the Concurrent Program.   Concurrent-->Program-->Define
Program                 = mzFirst
Short name              = mzFirst
Application             = PLSQL Test
Description             = First Test
Executable Name         = mzFirst
(Leave all other settings as the default)

c) Add Concurrent Program to Concurrent Request Group.   Security-->Responsibility-->Request
Group                   = PLSQL Test
Application             = PLSQL Test
Code                    =
Description             = First Test
Requests Type           = Program
Requests Name           = mzFirst
Requests Application    = PLSQL Test

d) Now log in to the user/responsibility that has access to the 'PLSQL Test'
request group and run the 'mzFirst' request.   Monitor the request which should complete with 'Normal' status.
There will not be an output file, so just look at the Log file that has been generated. 
 It should look similar to that listed below:
+---------------------------------------+
MZFIRSTPLSQL module: mzFirst
Start of log messages from Plsql  program
+---------------------------------------+
mzFirst procedure OK
Retcode = 0
+---------------------------------------+
End of log messages from PlSql program
+---------------------------------------+


Test Two - Procedure that spawns another procedure as a child concurrent process
--------------------------------------------------------------------------------

As System Administrator do the following:-

a) Setup the Executable.   Concurrent-->Program-->Executable
Executable              = mzMain
Short Name        = mzMain
Application             = PLSQL Test
Description             = Calling PLSQL procedure
Execution Method        = PL/SQL Stored Procedure
Execution File Name     = mzConcTest.mzMain

b) Setup the Executable.   Concurrent-->Program-->Executable
Executable              = mzCallMe
Short Name        = mzCallme
Application             = PLSQL Test
Description             = Called PLSQL procedure
Execution Method        = PL/SQL Stored Procedure
Execution File Name     = mzConcTest.mzCallme

c) Define the Concurrent Program.   Concurrent-->Program-->Define
Program                 = mzMain
Short name              = mzMain
Application             = PLSQL Test
Description             = Calling PLSQL procedure
Executable Name         = mzMain
(Leave all other settings as the default)

d) Define the Concurrent Program.   Concurrent-->Program-->Define
Program                 = mzCallMe
Short name              = mzCallMe
Application             = PLSQL Test
Description             = Calling PLSQL procedure
Executable Name         = mzCallMe
(Leave all other settings as the default)

e) Add Concurrent Program to Concurrent Request Group.   Security-->Responsibility-->Request
Group                   = PLSQL Test
Application             = PLSQL Test
Code                    =
Description             = Calling PLSQL procedure
Requests Type           = Program
Requests Name           = mzMain
Requests Application    = PLSQL Test

d) Now log in to the user/responsibility that has access to the 'PLSQL Test' request group and run the 'mzMain' request. 
 Monitor the request which should first spawn the 'mzCallme' request,
 then once this child process has completed 'Normal' the 'mzMain' process will also complete with 'Normal' status.
There will not be an output file, so just look at the Log file for the two concurrent processes.  
They should look similar to that listed below:-
+---------------------------------------+
MZMAIN module: mzMain
+---------------------------------------+
Start of log messages from Plsql  program
+---------------------------------------+
mzMain procedure
Request id 6428
Monitoring request 6428
Request finished with status Normal
COMPLETED RUN.   Retcode = 0
+---------------------------------------+
End of log messages from PlSql program
+---------------------------------------+

+---------------------------------------+
MZCALLME module: mzCallMe
+---------------------------------------+
Start of log messages from Plsql  program
+---------------------------------------+
mzCallMe procedure
Retcode = 0
+---------------------------------------+
End of log messages from PlSql program
+---------------------------------------+


Test Three - standalone procedure with passes parameter
-------------------------------------------------------

As System Administrator do the following:

a) Setup the Executable.   Concurrent-->Program-->Executable
Executable              = mzParameter
Short Name        = mzParameter
Application             = PLSQL Test
Description             = Procedure with parameter
Execution Method        = PL/SQL Stored Procedure
Execution File Name     = mzConcTest.mzParameter

b) Define the Concurrent Program.   Concurrent-->Program-->Define
Program                 = mzParameter
Short name              = mzParameter
Application             = PLSQL Test
Description             = Procedure with parameter
Executable Name         = mzParameter
(Leave all other settings as the default)
Click on 'Parameters' button and enter the following:-
Seq            = 1
Parameter        = mzVar
Description        = Text sent to log file
Value Set        = 15 Characters
(Leave all other settings as the default)

c) Add Concurrent Program to Concurrent Request Group.   Security-->Responsibility-->Request
Group                   = PLSQL Test
Application             = PLSQL Test
Code                    =
Description             = First Test
Requests Type           = Program
Requests Name           = mzParameter
Requests Application    = PLSQL Test

d) Now login to the user/responsibility that has access to the 'PLSQL Test'
request group and run the 'mzParameter' request.   When selected it should pop up a window to ask to enter
the 'mzVar' parameter value.  Enter 'This is a test' as the text.   Monitor the request which should complete with 'Normal' status.
  The parameter entered will be seen on the 'View Requests' window in the 'Parameters' column.
There will not be an output file, so just look at the Log file that has been generated. 
 It should look similar to that listed below:
+---------------------------------------+
MZPARAMETER module: mzParameter
+---------------------------------------+
Start of log messages from Plsql  program
+---------------------------------------+
mzParameter procedure
Parameter received was: This is a test
Retcode = 0
+---------------------------------------+
End of log messages from PlSql program
+---------------------------------------+




Sunday, March 4, 2012

Inventory Managers

Launch "Material Transaction Manager" from Inventory setup module. This will schedule a concurrent program called Process transactions interface (INCTCM) every 5 minutes. This manager (concurrent program) reads records from MTL_TRANSACTIONS_INTERFACE validates them and moves the successful transactions onto MTL_MATERIAL_TRANSACTIONS_TEMP, and submits Inventory Transaction Worker (INCTCW) which then processes these records through inventory.

Launch "Cost Manager" from Inventory setup module. This schedules a concurrent program called Cost Manager (CMCTCM) every 5 minutes. Cost transaction manager costs material transactions in Oracle Inventory and Oracle Work in Process in the background.

Launch "Move transaction Manager" from Inventory setup module. This will schedule a concurrent program called WIP Move Transactions Manager (WICTMS) every 5 minutes.

i think these steps may help resolve your problem

Wednesday, February 22, 2012

Oracle Inventory On Hand . Available to Reserve Quantity , Available to Transact

/* Oracle Inventory On Hand . Available to Reserve Quantity , Available to Transact */

/* Formatted on 2/22/2012 11:26:05 AM (QP5 v5.114.809.3010) */
CREATE OR REPLACE PROCEDURE GET_LOT_ITEM_QTY (
   P_LPN_ID                  IN     NUMBER,
   P_ORGANIZATION_ID         IN     NUMBER,
   P_SOURCE_TYPE_ID          IN     NUMBER,
   P_INVENTORY_ITEM_ID       IN     NUMBER,
   P_REVISION                IN     VARCHAR2,
   P_LOCATOR_ID              IN     NUMBER,
   P_SUBINVENTORY_CODE       IN     VARCHAR2,
   P_LOT_NUMBER              IN     VARCHAR2,
   P_IS_REVISION_CONTROL     IN     VARCHAR2,
   P_IS_SERIAL_CONTROL       IN     VARCHAR2,
   P_IS_LOT_CONTROL          IN     VARCHAR2,
   X_LPN_ONHAND                 OUT NUMBER,
   X_RESERVABLE_QUANTITY        OUT NUMBER,
   X_TRANSACTABLE_QUANTITY      OUT NUMBER,
   -- NSRIVAST, INVCONV , START
   P_GRADE_CODE              IN     VARCHAR2,
   X_SQOH                       OUT NUMBER,
   X_SATT                       OUT NUMBER,
   X_SATR                       OUT NUMBER
-- NSRIVAST, INVCONV, END
)
IS
   L_MSG_COUNT             VARCHAR2 (100);
   L_MSG_DATA              VARCHAR2 (1000);
   L_RQOH                  NUMBER;
   L_QR                    NUMBER;
   L_QS                    NUMBER;
   L_ATR                   NUMBER;
   L_ATT                   NUMBER;
   L_QOH                   NUMBER;
   L_LPN_CONTEXT           NUMBER;
   L_RETURN_STATUS         VARCHAR2 (1);
   X_RETURN                VARCHAR2 (1);
   L_IS_REVISION_CONTROL   BOOLEAN := FALSE;
   L_IS_SERIAL_CONTROL     BOOLEAN := FALSE;
   L_IS_LOT_CONTROL        BOOLEAN := FALSE;
   L_LPN_CONTEXT           NUMBER;
   L_TREE_MODE             NUMBER;
   -- NSRIVAST, INVCONV,  START
   X_SRQOH                 NUMBER;
   X_SQR                   NUMBER;
   X_SQS                   NUMBER;
   -- NSRIVAST, INVCONV, END

   QUANTITY_EXCEPTION EXCEPTION;
BEGIN
   -- CLEARING THE QUANTITY CACHE
   INV_QUANTITY_TREE_PUB.CLEAR_QUANTITY_CACHE;

   IF UPPER (P_IS_REVISION_CONTROL) = 'TRUE'
   THEN
      L_IS_REVISION_CONTROL := TRUE;
   ELSE
      L_IS_REVISION_CONTROL := FALSE;
   END IF;

   IF UPPER (P_IS_SERIAL_CONTROL) = 'TRUE'
   THEN
      L_IS_SERIAL_CONTROL := TRUE;
   ELSE
      L_IS_SERIAL_CONTROL := FALSE;
   END IF;

   -- BUG NO 2768731
   IF P_LOT_NUMBER IS NULL
   THEN
      L_IS_LOT_CONTROL := FALSE;
   ELSE
      L_IS_LOT_CONTROL := TRUE;
   END IF;

   IF (P_INVENTORY_ITEM_ID IS NULL)
   THEN
      RAISE QUANTITY_EXCEPTION;
   END IF;

   -- RESERVE MODE
   L_TREE_MODE := 1;                    --TO GET AVAILABLE TO RESERVE QUANTITY

   --CALL PUBLIC API
   INV_QUANTITY_TREE_PUB.QUERY_QUANTITIES (
      P_API_VERSION_NUMBER           => 1.0,
      P_INIT_MSG_LST                 => 'F',
      X_RETURN_STATUS                => L_RETURN_STATUS,
      X_MSG_COUNT                    => L_MSG_COUNT,
      X_MSG_DATA                     => L_MSG_DATA,
      P_ORGANIZATION_ID              => P_ORGANIZATION_ID,
      P_INVENTORY_ITEM_ID            => P_INVENTORY_ITEM_ID,
      P_TREE_MODE                    => L_TREE_MODE,
      P_IS_REVISION_CONTROL          => L_IS_REVISION_CONTROL,
      P_IS_LOT_CONTROL               => L_IS_LOT_CONTROL,
      P_IS_SERIAL_CONTROL            => L_IS_SERIAL_CONTROL,
      P_DEMAND_SOURCE_TYPE_ID        => P_SOURCE_TYPE_ID,
      P_REVISION                     => P_REVISION,
      P_LOT_NUMBER                   => P_LOT_NUMBER,
      P_LOT_EXPIRATION_DATE          => NULL,
      P_SUBINVENTORY_CODE            => P_SUBINVENTORY_CODE,
      P_LOCATOR_ID                   => P_LOCATOR_ID,
      P_ONHAND_SOURCE                => 3,
      X_QOH                          => L_QOH,
      X_RQOH                         => L_RQOH,
      X_QR                           => L_QR,
      X_QS                           => L_QS,
      X_ATT                          => L_ATT,
      X_ATR                          => L_ATR,
      P_LPN_ID                       => P_LPN_ID-- NSRIVAST, INVCONV, START
      ,
      P_GRADE_CODE                   => P_GRADE_CODE,
      X_SQOH                         => X_SQOH,
      X_SATT                         => X_SATT,
      X_SATR                         => X_SATR--       , P_TRANSACTION_TYPE      =>   NULL
      ,
      X_SRQOH                        => X_SRQOH,
      X_SQR                          => X_SQR,
      X_SQS                          => X_SQS,
      P_DEMAND_SOURCE_HEADER_ID      => -1,
      P_DEMAND_SOURCE_LINE_ID        => -1,
      P_DEMAND_SOURCE_NAME           => -1,
      P_TRANSFER_SUBINVENTORY_CODE   => NULL,
      P_COST_GROUP_ID                => NULL,
      P_TRANSFER_LOCATOR_ID          => NULL
   -- NSRIVAST, INVCONV, END
   );

   IF (L_RETURN_STATUS = 'S')
   THEN
      X_LPN_ONHAND := L_QOH;
      X_RESERVABLE_QUANTITY := L_ATR;
   ELSE
      X_RETURN := 'F';
      RAISE QUANTITY_EXCEPTION;
   END IF;

   -- TRANSACT MODE
   L_TREE_MODE := 2;                            --TO GET TRANSACTABLE QUANTITY

   --CALL PUBLIC API
   INV_QUANTITY_TREE_PUB.QUERY_QUANTITIES (
      P_API_VERSION_NUMBER           => 1.0,
      P_INIT_MSG_LST                 => 'F',
      X_RETURN_STATUS                => L_RETURN_STATUS,
      X_MSG_COUNT                    => L_MSG_COUNT,
      X_MSG_DATA                     => L_MSG_DATA,
      P_ORGANIZATION_ID              => P_ORGANIZATION_ID,
      P_INVENTORY_ITEM_ID            => P_INVENTORY_ITEM_ID,
      P_TREE_MODE                    => L_TREE_MODE,
      P_IS_REVISION_CONTROL          => L_IS_REVISION_CONTROL,
      P_IS_LOT_CONTROL               => L_IS_LOT_CONTROL,
      P_IS_SERIAL_CONTROL            => L_IS_SERIAL_CONTROL,
      P_DEMAND_SOURCE_TYPE_ID        => P_SOURCE_TYPE_ID,
      P_REVISION                     => P_REVISION,
      P_LOT_NUMBER                   => P_LOT_NUMBER,
      P_LOT_EXPIRATION_DATE          => NULL,
      P_SUBINVENTORY_CODE            => P_SUBINVENTORY_CODE,
      P_LOCATOR_ID                   => P_LOCATOR_ID,
      P_ONHAND_SOURCE                => 3,
      X_QOH                          => L_QOH,
      X_RQOH                         => L_RQOH,
      X_QR                           => L_QR,
      X_QS                           => L_QS,
      X_ATT                          => L_ATT,
      X_ATR                          => L_ATR,
      P_LPN_ID                       => P_LPN_ID-- NSRIVAST, INVCONV, START
      ,
      P_GRADE_CODE                   => P_GRADE_CODE,
      X_SQOH                         => X_SQOH,
      X_SATT                         => X_SATT,
      X_SATR                         => X_SATR--       , P_TRANSACTION_TYPE      =>   NULL
      ,
      X_SRQOH                        => X_SRQOH,
      X_SQR                          => X_SQR,
      X_SQS                          => X_SQS,
      P_DEMAND_SOURCE_HEADER_ID      => -1,
      P_DEMAND_SOURCE_LINE_ID        => -1,
      P_DEMAND_SOURCE_NAME           => -1,
      P_TRANSFER_SUBINVENTORY_CODE   => NULL,
      P_COST_GROUP_ID                => NULL,
      P_TRANSFER_LOCATOR_ID          => NULL
   -- NSRIVAST, INVCONV, END
   );

   IF (L_RETURN_STATUS = 'S')
   THEN
      X_LPN_ONHAND := L_QOH;
      X_TRANSACTABLE_QUANTITY := L_ATT;
   ELSE
      X_RETURN := 'F';
      RAISE QUANTITY_EXCEPTION;
   END IF;
EXCEPTION
   WHEN QUANTITY_EXCEPTION
   THEN
      DBMS_OUTPUT.PUT_LINE ('Quanity Exception Raised' || SQLERRM);
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.PUT_LINE (SQLERRM);
END GET_LOT_ITEM_QTY;

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

DECLARE
v_lpn_onhand NUMBER;
v_reservable_quantity NUMBER;
v_transactable_quantity NUMBER;
v_sqoh           NUMBER;    
v_satt           NUMBER;    
v_satr           NUMBER;

BEGIN
 get_lot_item_qty(
                p_lpn_id => NULL,
                p_organization_id => 122, --HG5
                p_source_type_id => 8, --Inventory
                p_inventory_item_id => 85703, --HG_Sample_Item
                p_revision => NULL,
                p_locator_id => NULL,
                p_subinventory_code => 'BULK',
                p_lot_number => NULL ,
                p_is_revision_control => 'FALSE',
                p_is_serial_control => 'FALSE',
                p_is_lot_control => 'TRUE',
                x_lpn_onhand => v_lpn_onhand,
                x_reservable_quantity => v_reservable_quantity,
                x_transactable_quantity => v_transactable_quantity,            
                p_grade_code     => NULL,  
                x_sqoh           => v_sqoh ,    
                x_satt           => v_satt ,    
                x_satr           => v_satr      
              -- NSRIVAST, INVCONV, END
          );
        
dbms_output.put_line('v_lpn_onhand :'||v_lpn_onhand);
dbms_output.put_line('v_reservable_quantity :'||v_reservable_quantity);
dbms_output.put_line('v_transactable_quantity :'||v_transactable_quantity);

EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Error: '||SQLERRM);         
END;


Tuesday, February 14, 2012

SQL Queries for checking Profile Option Values

1) Obtain Profile Option values for Profile Option name like ‘%Ledger%’ and  Responsibility name like ‘%General%Ledger%’

SELECT
substr(pro1.user_profile_option_name,1,35) Profile,
decode(pov.level_id,
10001,'Site',
10002,'Application',
10003,'Resp',
10004,'User') Option_Level,
decode(pov.level_id,
10001,'Site',
10002,appl.application_short_name,
10003,resp.responsibility_name,
10004,u.user_name) Level_Value,
nvl(pov.profile_option_value,'Is Null') Profile_option_Value
FROM 
fnd_profile_option_values pov,
fnd_responsibility_tl resp,
fnd_application appl,
fnd_user u,
fnd_profile_options pro,
fnd_profile_options_tl pro1
WHERE
pro1.user_profile_option_name like ('%Ledger%')
and  pro.profile_option_name = pro1.profile_option_name
and  pro.profile_option_id = pov.profile_option_id
and  resp.responsibility_name like '%General%Ledger%' /* comment this line  if you need to check profiles for all responsibilities */
and  pov.level_value = resp.responsibility_id (+)
and  pov.level_value = appl.application_id (+)
and  pov.level_value = u.user_id (+)
order by 1,2;

2) Obtain all Profile Option values setup for a particular responsibility. Replace the responsibility name as per your requirement.

SELECT
substr(pro1.user_profile_option_name,1,35) Profile,
decode(pov.level_id,
10001,'Site',
10002,'Application',
10003,'Resp',
10004,'User') Option_Level,
decode(pov.level_id,
10001,'Site',
10002,appl.application_short_name,
10003,resp.responsibility_name,
10004,u.user_name) Level_Value,
nvl(pov.profile_option_value,'Is Null') Profile_option_Value
FROM 
fnd_profile_option_values pov,
fnd_responsibility_tl resp,
fnd_application appl,
fnd_user u,
fnd_profile_options pro,
fnd_profile_options_tl pro1
WHERE
pro.profile_option_name = pro1.profile_option_name
and  pro.profile_option_id = pov.profile_option_id
and  resp.responsibility_name like '%General%Ledger%'
and  pov.level_value = resp.responsibility_id (+)
and  pov.level_value = appl.application_id (+)
and  pov.level_value = u.user_id (+)
order by 1,2;
 

Drilldown from GL to AR Receiving Transactions

/* Formatted on 2/14/2012 11:48:22 AM (QP5 v5.114.809.3010) */
  SELECT   b.NAME je_batch_name,
           b.description je_batch_description,
           b.running_total_accounted_dr je_batch_total_dr,
           b.running_total_accounted_cr je_batch_total_cr,
           b.status je_batch_status,
           b.default_effective_date je_batch_effective_date,
           b.default_period_name je_batch_period_name,
           b.creation_date je_batch_creation_date,
           u.user_name je_batch_created_by,
           h.je_category je_header_category,
           h.je_source je_header_source,
           h.period_name je_header_period_name,
           h.NAME je_header_journal_name,
           h.status je_header_journal_status,
           h.creation_date je_header_created_date,
           u1.user_name je_header_created_by,
           h.description je_header_description,
           h.running_total_accounted_dr je_header_total_acctd_dr,
           h.running_total_accounted_cr je_header_total_acctd_cr,
           l.je_line_num je_lines_line_number,
           l.ledger_id je_lines_ledger_id,
           glcc.concatenated_segments je_lines_ACCOUNT,
           l.entered_dr je_lines_entered_dr,
           l.entered_cr je_lines_entered_cr,
           l.accounted_dr je_lines_accounted_dr,
           l.accounted_cr je_lines_accounted_cr,
           l.description je_lines_description,
           glcc1.concatenated_segments xla_lines_account,
           xlal.accounting_class_code xla_lines_acct_class_code,
           xlal.accounted_dr xla_lines_accounted_dr,
           xlal.accounted_cr xla_lines_accounted_cr,
           xlal.description xla_lines_description,
           xlal.accounting_date xla_lines_accounting_date,
           xlate.entity_code xla_trx_entity_code,
           xlate.source_id_int_1 xla_trx_source_id_int_1,
           xlate.source_id_int_2 xla_trx_source_id_int_2,
           xlate.source_id_int_3 xla_trx_source_id_int_3,
           xlate.security_id_int_1 xla_trx_security_id_int_1,
           xlate.security_id_int_2 xla_trx_security_id_int_2,
           xlate.transaction_number xla_trx_transaction_number,
           rcvt.transaction_type rcv_trx_transaction_type,
           rcvt.transaction_date rcv_trx_transaction_date,
           rcvt.quantity rcv_trx_quantity,
           rcvt.shipment_header_id rcv_trx_shipment_header_id,
           rcvt.shipment_line_id rcv_trx_shipment_line_id,
           rcvt.destination_type_code rcv_trx_destination_type_code,
           rcvt.po_header_id rcv_trx_po_header_id,
           rcvt.po_line_id rcv_trx_po_line_id,
           rcvt.po_line_location_id rcv_trx_po_line_location_id,
           rcvt.po_distribution_id rcv_trx_po_distribution_id,
           rcvt.vendor_id rcv_trx_vendor_id,
           rcvt.vendor_site_id rcv_trx_vendor_site_id
    FROM   gl_je_batches b,
           gl_je_headers h,
           gl_je_lines l,
           fnd_user u,
           fnd_user u1,
           gl_code_combinations_kfv glcc,
           gl_code_combinations_kfv glcc1,
           gl_import_references gir,
           xla_ae_lines xlal,
           xla_ae_headers xlah,
           xla_events xlae,
           xla.xla_transaction_entities xlate,
           rcv_transactions rcvt
   WHERE       b.created_by = u.user_id
           AND h.created_by = u1.user_id
           AND b.je_batch_id = h.je_batch_id
           AND h.je_header_id = l.je_header_id
           AND l.code_combination_id = glcc.code_combination_id
           AND l.je_header_id = gir.je_header_id
           AND l.je_line_num = gir.je_line_num
           AND gir.gl_sl_link_table = xlal.gl_sl_link_table
           AND gir.gl_sl_link_id = xlal.gl_sl_link_id
           AND xlal.application_id = xlah.application_id
           AND xlal.ae_header_id = xlah.ae_header_id
           AND xlal.code_combination_id = glcc1.code_combination_id
           AND xlah.application_id = xlae.application_id
           AND xlah.event_id = xlae.event_id
           AND xlae.application_id = xlate.application_id
           AND xlae.entity_id = xlate.entity_id
           AND xlate.source_id_int_1 = rcvt.transaction_id
           AND h.je_category = 'Receiving'
           AND b.default_period_name = 'FEB-12'
ORDER BY   h.je_category;

Monday, February 13, 2012

How to complile R12 Form / 10g Form

Telnet

root@ykr12dev # su - appldev
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
You have new mail.
$ pwd
/export/home/appldev


frmcmp_batch module=XYKAITEMCC.fmb userid=apps/apps output_file=XYKAITEMCC.fmx module_type=form compile_all=special batch=yes;