Está en la página 1de 21

How to find the current quantity in Oracle Inventory.

What is
the table and column details?

To get the current balance you would have to write a query like

select sum(transaction_quantity)
from mtl_onhand_quantities
where inventory_item_id=1234
and organization_id=201The short answer is, you can get the
current inventory balance by querying the mtl_onhand_quantities
view.

View all types of request Application wise

SELECT fa.application_short_name,
fcpv.user_concurrent_program_name,
description,
DECODE (fcpv.execution_method_code,
'B', 'Request Set Stage Function',
'Q', 'SQL*Plus',
'H', 'Host',
'L', 'SQL*Loader',
'A', 'Spawned',
'I', 'PL/SQL Stored Procedure',
'P', 'Oracle Reports',
'S', 'Immediate',
fcpv.execution_method_code
) exe_method,
output_file_type, program_type, printer_name,
minimum_width,
minimum_length, concurrent_program_name,
concurrent_program_id
FROM fnd_concurrent_programs_vl fcpv, fnd_application fa
WHERE fcpv.application_id = fa.application_id
ORDER BY description

To find the code

select EXECUTION_FILE_NAME from apps.fnd_executables


where executable_id in
(select executable_id
from apps.fnd_concurrent_programs_vl
where user_concurrent_program_name like '%Name%')
To find the last query

select * from v$sql where hash_value like


(select sql_hash_value from v$session where audsid
like
(select oracle_session_id from
apps.fnd_concurrent_requests where request_id = '403839'))

Program Monitoring query

SELECT
request_id,
program,
status_code,
phase_code,
actual_start_date,
actual_completion_date,
parent_request_id,
LPAD(TRUNC( MOD( (actual_completion_date-
actual_start_date)*24, 24)) ,2,'0') || ':'||
LPAD( TRUNC( MOD( (actual_completion_date-
actual_start_date)*24*60, 60)),2,'0') || ':'||
LPAD( TRUNC( MOD( (actual_completion_date-
actual_start_date)*24*60*60, 60)),2,'0') "RUNTIME",
LPAD( TRUNC( MOD( (SYSDATE - actual_start_date)*24,
24)) ,2,'0') || ':'||
LPAD( TRUNC( MOD( (SYSDATE -
actual_start_date)*24*60, 60)),2,'0') || ':'||
LPAD( TRUNC( MOD( (SYSDATE-
actual_start_date)*24*60*60, 60)),2,'0') "RUNNING",
requestor,
argument_text,
completion_text
FROM APPS.FND_CONC_REQ_SUMMARY_V
WHERE TO_CHAR(ACTUAL_START_DATE,'DD/MON/YYYY') >=
trunc(sysdate-1)
and phase_code like 'R'
and program like '%Name%'
order by actual_start_date desc

To find the active workflow

select * from apps.wf_item_attribute_values


where item_key like '<argument_text from the above query>'
and text_value like '<%plan_id%>'

(or)

SELECT *
FROM wf_item_activity_statuses_v
WHERE activity_status_code = 'ACTIVE'

To Kill the workflow

BEGIN
wf_engine.abortprocess(
itemtype=> 'ODPCYCLE',
itemkey=> 'TI:GL-PlanName-12/10/2011-10:25:35-ODP');
COMMIT;
END;

To find the sessions

select
      daws.owner, vawo.session_id,
      vses.serial# serial,
      daws.aw_name,
      vawo.attach_mode
from dba_aws daws, v$aw_olap vawo , v$session vses
where daws.aw_number = vawo.aw_number and vses.sid =
vawo.session_id
AND daws.aw_name like '%zz%'
and attach_mode like '%WRITE%'

select text_value
from apps.wf_item_attribute_values
where item_key in (
select item_key
from apps.wf_item_activity_statuses
where item_type = 'ODPCYCLE'
and activity_status = 'ACTIVE')
and name = 'DBNAME'
and text_value like '%zz%'

ASCP Plan size

select sum(blocks*8192)/(1024*1024)
from dba_TAB_partitions
WHERE TABLE_OWNER = 'MSC'
and partition_name like '%1033'
and blocks > 0

To Count Module Wise Report


Query to find scenarios
select a.scenario_id, a.scenario_name, sum(quantity)
from apps.msd_dp_scenarios a,
apps.msd_dp_scenario_entries b
where a.demand_plan_id = 27
and a.demand_plan_id = b.demand_plan_id
and a.scenario_id = b.scenario_id
and a.last_revision = b.revision
group by a.scenario_id, a.scenario_name

What Family Patch Levels are on my machine 


SELECT FA.APPLICATION_SHORT_NAME APP,
 FPI.PATCH_LEVEL
 FROM FND_PRODUCT_INSTALLATIONS FPI,
 FND_APPLICATION FA
 WHERE FA.APPLICATION_ID = FPI.APPLICATION_ID;

 SQL> PRINT VERSION

VERSION
----------------------------------------
8.0.4.0.0

SQL> PRINT COMPATIBILITY

COMPATIBILITY
----------------------------------------
8.0.0

SQL to view concurrent request processing time.


SELECT f.request_id , pt.user_concurrent_program_name
user_concurrent_program_name
, f.actual_start_date actual_start_date
, f.actual_completion_date actual_completion_date,
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)
|| ‘ HOURS ‘ ||
floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)
|| ‘ MINUTES ‘ ||
round((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600 -
(floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-
f.actual_start_date)*24*60*60)/3600)*3600)/60)*60) ))
|| ‘ SECS ‘ time_difference
,
DECODE(p.concurrent_program_name,’ALECDC’,p.concurrent_program_name||
’['||f.description||']‘,p.concurrent_program_name) concurrent_program_name
, decode(f.phase_code,’R',’Running’,'C’,'Complete’,f.phase_code) Phase
, f.status_code
FROM apps.fnd_concurrent_programs p
, apps.fnd_concurrent_programs_tl pt
, apps.fnd_concurrent_requests f
WHERE f.concurrent_program_id = p.concurrent_program_id
and f.program_application_id = p.application_id
and f.concurrent_program_id = pt.concurrent_program_id
and f.program_application_id = pt.application_id
AND pt.language = USERENV(‘Lang’)
and f.actual_start_date is not null
ORDER by f.actual_completion_date-f.actual_start_date desc;

USER_CONCURRENT_PROGRAM_NAME
select
fcpt.USER_CONCURRENT_PROGRAM_NAME,
DECODE(fcr.phase_code,
'C','Completed',
'I','Inactive',
'P','Pending',
'R','Running',
fcr.phase_code
) PHASE ,
DECODE(fcr.status_code,
'A','Waiting',
'R','Resuming',
'N','Normal',
'C','Cancelled',
'E','Errored',
'S','Scheduled',
'W','Warning',
'O','On Hold',
'H','Hold',
'N','No Manager',
'K','Standby',
'L','Stand',
'Z','Suspended',
'T','Terminating',
'D','Disabled',
'P','Paused',
'Q','Terminated',
'X','Wait',
fcr.status_code
) STATUS,
count(*)
from apps.fnd_concurrent_programs_tl
fcpt,apps.FND_CONCURRENT_REQUESTs fcr
where fcpt.CONCURRENT_PROGRAM_ID=fcr.CONCURRENT_PROGRAM_ID
and fcpt.language = USERENV('Lang')
group by
fcpt.USER_CONCURRENT_PROGRAM_NAME,fcr.phase_code,fcr.status_code

To get submenus and Function attached to this Main menu


SELECT c.prompt, c.description
FROM apps.fnd_menus_tl a, fnd_menu_entries_tl c
WHERE a.menu_id = c.menu_id AND a.user_menu_name = 'F4 UK
PAY Navigator';

To get responsibility and attached request groups

SELECT responsibility_name responsibility, request_group_name,


frg.description
FROM fnd_request_groups frg, fnd_responsibility_vl frv
WHERE frv.request_group_id = frg.request_group_id
ORDER BY responsibility_name

To get modified profile options


SELECT t.user_profile_option_name, profile_option_value,
v.creation_date,
v.last_update_date,
v.creation_date - v.last_update_date "Change Date",
(SELECT UNIQUE user_name
FROM fnd_user
WHERE user_id = v.created_by) "Created By",
(SELECT user_name
FROM fnd_user
WHERE user_id = v.last_updated_by) "Last Update By"
FROM fnd_profile_options o,
fnd_profile_option_values v,
fnd_profile_options_tl t
WHERE o.profile_option_id = v.profile_option_id
AND o.application_id = v.application_id
AND start_date_active <= SYSDATE
AND NVL (end_date_active, SYSDATE) >= SYSDATE
AND o.profile_option_name = t.profile_option_name
AND level_id = 10001
AND t.LANGUAGE IN (SELECT language_code
FROM fnd_languages
WHERE installed_flag = 'B'
UNION
SELECT nls_language
FROM fnd_languages
WHERE installed_flag = 'B')
ORDER BY user_profile_option_name;

To get Menus Associated with responsibility


SELECT DISTINCT a.responsibility_name, c.user_menu_name
FROM apps.fnd_responsibility_tl a,
apps.fnd_responsibility b,
apps.fnd_menus_tl c,
apps.fnd_menus d,
apps.fnd_application_tl e,
apps.fnd_application f
WHERE a.responsibility_id(+) = b.responsibility_id
AND a.responsibility_id = ‘20538’
AND b.menu_id = c.menu_id
AND b.menu_id = d.menu_id
AND e.application_id = f.application_id
AND f.application_id = b.application_id
AND a.LANGUAGE = 'US';

To get list of responsibilities

SELECT (SELECT application_short_name


FROM fnd_application fa
WHERE fa.application_id = frt.application_id) application,
frt.responsibility_id, frt.responsibility_name
FROM apps.fnd_responsibility_tl frt;

To get assigned responsibility to a user

SELECT UNIQUE u.user_id, SUBSTR (u.user_name, 1, 30) user_name,


SUBSTR (r.responsibility_name, 1, 60) responsiblity,
SUBSTR (a.application_name, 1, 50) application
FROM fnd_user u,
fnd_user_resp_groups g,
fnd_application_tl a,
fnd_responsibility_tl r
WHERE g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
ORDER BY SUBSTR (user_name, 1, 30),
SUBSTR (a.application_name, 1, 50),
SUBSTR (r.responsibility_name, 1, 60);

To register the table

What DB version is on my machine  

SQL> VARIABLE VERSION VARCHAR2(50)

SQL> VARIABLE COMPATIBILITY VARCHAR2(50)

SQL> EXEC DBMS_UTILITY.DB_VERSION(:VERSION,:COMPATIBILITY)

PL/SQL procedure successfully completed.

 select 'execute ad_dd.register_table('||''''||'CUSTOM'||''''||','||''''||


ltrim(rtrim(table_name))||''''||',
'||''''||'T'||''''||','||'8,10,90);' from dba_tab_columns where owner like 'CUSTOM%'
and table_name like 'J07_CHN_REP%' and rownum =1 ;

To register the columns'tovirat@rediffmail.com', -- Passing the Value to the


First Parameter of the report
'51758'
);
COMMIT;
-- Note:- In the above request Run, I have created the Report, which has one
parameter.
IF l_success = 0
THEN
-- fnd_file.put_line (fnd_file.LOG, 'Request submission For this store FAILED' );
DBMS_OUTPUT.PUT_LINE( 'Request submission For this store FAILED' );
ELSE
-- fnd_file.put_line (fnd_file.LOG, 'Request submission for this store
SUCCESSFUL');
DBMS_OUTPUT.PUT_LINE( 'Request submission For this store SUCCESSFUL'
);
END IF;
--Note:- If you are running directly from database, use DBMS API to display. If
you are
-- Running directly from Application, then Use the fnd_file API to write the
message
-- in the log file.
END;

Submit the Concurrent Program from Backend.


Submit Program is the Function. where. we need to pass the Application name,
Program, stage etc.

function FND_SUBMIT.SUBMIT_PROGRAM
(application IN varchar2,
program IN varchar2,
stage IN varchar2,
argument1,...argument100)
return boolean;

PROMPT Submitting the Concurrent Program from backend.


PROMPT
BEGIN
--fnd_global.apps_initialize( user_id => , resp_id => , resp_appl_id => );
l_success := fnd_submit.set_request_set('', '');
IF l_success = TRUZ--Application
,'' -- program
,'' --Stage
,'NEW' -- Arument1
,'10' -Arument2
,'N'
,'N'
,'N');
-- If fail then for the log record.
IF (NOT l_success)
THEN
fnd_file.put_line(
fnd_file.LOG
,'Request submission of stage STAGE FAILED');
ELSE
fnd_file.put_line(
fnd_file.LOG
,'Request submission of stage STAGE10 SUCCESSFUL');
END IF;
l_req_id := fnd_submit.submit_set(NULL, FALSE );
IF (l_req_id <= 0) THEN fnd_file.put_line( fnd_file.LOG ,'REQUEST SET
SUBMISSION FAILED'); ELSE fnd_file.put_line( fnd_file.LOG ,'REQUEST SET
SUBMITTED SUCCESSFULLY: ' || l_req_id); END IF; END IF; END;
Script to list all the trasactions that doesn't have a valid code combination

--  This report list all transactions for the selected gl


 --  dates that does not have a valid code combination.  This
 --  is due to bug in earlier releases with invalid code
 --  combination resulting in out-of-balance journals and not
 --  able to post.
 --
 -- Parameters   : &&1  GL Start Date (Required - format DD-MON-YYYY)
 --    &&2  GL End Date   (Required - format DD-MON-YYYY)
 --    &&3  ORG ID        (Required - not displayed, from profile)
 --
 set newpage 1
 set feedback off
 column today new_value_date NOPRINT
 select to_char(sysdate,'DD-MON-YY HH24:MI:SS') today
   from system.dual
 /
 
 
 set verify off
 set heading on
 TTITLE Left 'Program:XXARNOAPS.sql' -
 Right 'Date: &_date Page: ' SQL.PNO format 99 skip -
 Center 'Custom' skip -
 Center ' Report - ' skip -
 Center 'Completed Invoices With Invalid Code Combinations' skip -
 Center 'For GL Dates &&1 to &&2' skip 2
 column trx_number format a10 heading 'TRX NUMBER'
 column line_number format B9999 heading 'LINE| NUM'
 column item format a20 heading 'PART NUMBER'
 column customer_name format a20 heading 'CUSTOMER NAME' TRUNC
 column customer_number format a8 heading 'CUSTOMER| NUMBER'
 column gl_date format a9 heading 'GL DATE'
 select rct.trx_number, rctl.line_number, msi.segment1||'-'||msi.segment2 item,
        rc.customer_name, rc.customer_number,
        to_char(dist.gl_date, 'DD-MON-YY') gl_date
   from mtl_system_items msi, ra_customers rc,  ra_customer_trx rct,
        ra_customer_trx_lines rctl, ra_cust_trx_line_gl_dist dist
  where dist.account_class = 'REV'
    and dist.gl_date between to_date('&&1','DD-MON-YYYY')
    and to_date('&&2','DD-MON-YYYY')
    and not exists
        (select 'x'
           from gl_code_combinations gcc
          where gcc.code_combination_id = dist.code_combination_id)
    and rctl.customer_trx_line_id = dist.customer_trx_line_id
    and rctl.line_type = 'LINE'
    and rct.customer_trx_id = rctl.customer_trx_id
    and rc.customer_id = rct.bill_to_customer_id
    and msi.inventory_item_id = rctl.inventory_item_id
    and msi.organization_id = &&3
 union
 select NULL, 0, NULL, NULL, NULL, NULL
   from system.dual
  where 1 = 1
  order by 1, 2
 /

Script to display status of all the Concurrent Managers

      set head on


      Column OsId       Format A10
      Column CpId       Format 999999
      Column Opid       Format 999
      Column Manager    Format A30
      Column Status     Format A20
      Column Started_At Format A30
      Column Cpid       Heading 'Concurrent|Process ID'
      Column OsId       Heading 'System|Process ID'
      Column Opid       Heading 'Oracle|Process ID'
      Column Manager    Heading 'Concurrent Manager Name'
      Column Status     Heading 'Status|of Concurrent|Manager'
      Column Started_At Heading 'Concurrent Manager|Started at'
      Column Opid       Justify  Left

      Select distinct Concurrent_Process_Id CpId, PID Opid,


      Os_Process_ID Osid,
      Q.Concurrent_Queue_Name Manager,
      P.process_status_code Status,
      To_Char(P.Process_Start_Date, 'MM-DD-YYYY HH:MI:SSAM') Started_At
      from  Fnd_Concurrent_Processes P, Fnd_Concurrent_Queues Q,
FND_V$Process
      where  Q.Application_Id = Queue_Application_ID
      And (Q.Concurrent_Queue_ID = P.Concurrent_Queue_ID)
      And ( Spid = Os_Process_ID )
      And  Process_Status_Code not in ('K','S')
      Order by Concurrent_Process_ID, Os_Process_Id,
Q.Concurrent_Queue_Name ;
PL/Sql Script to assign responsibilities to Oracle Users

DECLARE
l_user_id NUMBER;
CURSOR cur_rec
IS
SELECT *
FROM fnd_responsibility_vl
WHERE UPPER (responsibility_name) = UPPER ('XXXXX');
BEGIN
SELECT user_id
INTO l_user_id
FROM fnd_user
WHERE user_name = 'XXXX';
FOR rec_cur IN cur_rec
LOOP
fnd_user_resp_groups_api.insert_assignment
(user_id => l_user_id,
responsibility_id => rec_cur.responsibility_id,
responsibility_application_id => rec_cur.application_id,
security_group_id => 0,
start_date => SYSDATE - 1,
end_date => NULL,
description => NULL
);
COMMIT;
END LOOP;
END;

Query used to view the patch level status of all modules

SELECT a.application_name,
DECODE (b.status, 'I', 'Installed', 'S', 'Shared', 'N/A') status,
patch_level
FROM apps.fnd_application_vl a, apps.fnd_product_installations b
WHERE a.application_id = b.application_id;

Query to link a Responsibility to a Set of Books in Oracle


SELECT fr.responsibility_name, fpov.profile_option_value set_of_books_name
FROM fnd_profile_options_vl fpo,
fnd_profile_option_values fpov,
applsys.fnd_responsibility_tl fr
WHERE fpo.user_profile_option_name = 'GL Set of Books Name'
AND fpo.profile_option_id = fpov.profile_option_id
AND fpov.level_value = fr.responsibility_id

Query to find the Responsibility,Attached Menu and Application to the


particular responsibility

SELECT   distinct
                 B.RESPONSIBILITY_ID,
                 A.RESPONSIBILITY_NAME,
                 A.LANGUAGE,
                 B.RESPONSIBILITY_KEY ,
                 B.APPLICATION_ID,
                 C.USER_MENU_NAME,
                 E.APPLICATION_NAME             
  FROM APPS.FND_RESPONSIBILITY_TL A,
       APPS.FND_RESPONSIBILITY B,
           APPS.FND_MENUS_TL C,
       APPS.FND_MENUS D,
       apps.FND_APPLICATION_TL E,
           apps.FND_APPLICATION F
  WHERE A.RESPONSIBILITY_ID(+)=B.RESPONSIBILITY_ID
  AND   B.MENU_ID=C.MENU_ID
  AND   B.MENU_ID=D.MENU_ID
  AND   E.APPLICATION_ID=F.APPLICATION_ID
  AND   F.APPLICATION_ID=B.APPLICATION_ID
  AND   A.LANGUAGE='US'

Query to find the Menus 


SELECT
  B.ROWID ROW_ID,
  B.MENU_ID,
  B.MENU_NAME,
  B.TYPE,
  B.LAST_UPDATE_DATE,
  B.LAST_UPDATED_BY ,
  B.LAST_UPDATE_LOGIN ,
  B.CREATION_DATE ,
  B.CREATED_BY ,
  T.USER_MENU_NAME ,
  T.DESCRIPTION,
  T.LANGUAGE,
  C.SUB_MENU_ID
 FROM
  apps.FND_MENUS_TL T,
  apps.FND_MENUS B,
  apps.FND_MENU_ENTRIES C
 -- (SELECT USER_MENU_NAME,MENU_ID FROM FND_MENUS_TL)SUB
WHERE
  B.MENU_ID = T.MENU_ID
  AND T.LANGUAGE = USERENV('LANG')
  --AND T.USER_MENU_NAME = 'Activity Based Management'
  AND B.MENU_ID=C.MENU_ID
Query that shows all the repsonsibilities and what functions are attached to these
responsibilities.
SELECT DISTINCT faa.application_name application, rtl.responsibility_name,
ffl.user_function_name, ff.function_name, ffl.description,
ff.TYPE
FROM fnd_compiled_menu_functions cmf,
fnd_form_functions ff,
fnd_form_functions_tl ffl,
fnd_responsibility r,
fnd_responsibility_vl rtl,
apps.fnd_application_all_view faa
WHERE cmf.function_id = ff.function_id
AND r.menu_id = cmf.menu_id
AND rtl.responsibility_id = r.responsibility_id
AND cmf.grant_flag = 'Y'
AND ff.function_id = ffl.function_id
AND faa.application_id(+) = r.application_id
AND r.end_date IS NULL
AND rtl.end_date IS NULL
ORDER BY rtl.responsibility_name;
How to retrieve Summary of concurrent Jobs/status/Count in Last 1 hour?
select
fcpt.USER_CONCURRENT_PROGRAM_NAME,
DECODE(fcr.phase_code,
‘C’, ‘Completed’,
‘I’, ‘Inactive’,
‘P’, ‘Pending’,
‘R’, ‘Running’,
fcr.phase_code
) PHASE ,
DECODE(fcr.status_code,
‘A’, ‘Waiting’,
‘B’, ‘Resuming’,
‘C’, ‘Normal’,
‘D’, ‘Cancelled’,
‘E’, ‘Errored’,
‘F’, ‘Scheduled’,
‘G’, ‘Warning’,
‘H’, ‘On Hold’,
‘I’, ‘Normal’,
‘M’, ‘No Manager’,
‘Q’, ‘Standby’,
‘R’, ‘Normal’,
‘S’, ‘Suspended’,
‘T’, ‘Terminating’,
‘U’, ‘Disabled’,
‘W’, ‘Paused’,
‘X’, ‘Terminated’,
‘Z’, ‘Waiting’,
fcr.status_code
) STATUS,
count(*)
from apps.fnd_concurrent_programs_tl
fcpt,apps.FND_CONCURRENT_REQUESTs fcr
where fcpt.CONCURRENT_PROGRAM_ID=fcr.CONCURRENT_PROGRAM_ID
and fcpt.language = USERENV(’Lang’)
and fcr.ACTUAL_START_DATE > sysdate - 1/24
group by
fcpt.USER_CONCURRENT_PROGRAM_NAME,fcr.phase_code,fcr.status_code
/
How to find out which request is handle by which concurrent queue.

a) First find out short_name of a program and then pass it as parameter to below
query.

b) The below query will give you output

 I - Included  - Included in new concurrent queue


 E - excluded from Standard Manager

This way you know now this running program (concurrent request) is handled by
new manager and not part of standard manager.
SELECT A.INCLUDE_FLAG, A.QUEUE_APPLICATION_ID,
C.USER_CONCURRENT_QUEUE_NAME,
 B.CONCURRENT_PROGRAM_NAME
FROM APPLSYS.FND_CONCURRENT_QUEUE_CONTENT A,
APPLSYS.FND_CONCURRENT_PROGRAMS B,
APPS.FND_CONCURRENT_QUEUES_VL C
WHERE type_id = b.concurrent_program_id and b.concurrent_program_name =
‘&SHORT_NAME’ and c.concurrent_queue_id = a.concurrent_queue_id
/

How to find out Summary of Concurrent requests.SELECT


request_id, SUBSTR(requestor,1,25), SUBSTR(program,1,50),
SUBSTR(user_concurrent_program_name,1,100),
TO_CHAR(actual_start_date,’dd/mm/yy :hh24:mi’) start_date,
TO_CHAR(actual_completion_date,’dd/mm/yy :hh24:mi’) completion_date,
FLOOR((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24) “in
Hours”,
(((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24)-
(FLOOR((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24)))*60
“In_Min”
–requestor, program, user_concurrent_program_name
FROM fnd_conc_req_summary_v
WHERE (ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24*60 >10

Query to extract Employee Contact Information

SELECT papf.person_id employee_id, papf.full_name employee_name,


papf.effective_start_date employee_start_date,
papf.effective_end_date employee_end_date,
papf_cont.full_name contact_name, hl.meaning contact_type,
pcr.date_start contact_start_date, pcr.date_end contact_end_date
FROM per_contact_relationships pcr,
per_all_people_f papf,
hr_lookups hl,
per_all_people_f papf_cont
WHERE 1 = 1
AND papf.person_id = pcr.person_id
AND pcr.contact_person_id = papf_cont.person_id
AND NVL (TRUNC (papf.effective_end_date), SYSDATE) >= TRUNC
(SYSDATE)
AND NVL (TRUNC (papf_cont.effective_end_date), SYSDATE) >= TRUNC
(SYSDATE)
AND hl.lookup_type(+) = 'CONTACT'
AND hl.lookup_code(+) = pcr.contact_type

Report processing time

SELECT f.request_id , pt.user_concurrent_program_name


user_concurrent_program_name
, f.actual_start_date actual_start_date
, f.actual_completion_date actual_completion_date,
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)
|| ' HOURS ' ||
floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)
|| ' MINUTES ' ||
round((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600 -
(floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
floor(((f.actual_completion_date-
f.actual_start_date)*24*60*60)/3600)*3600)/60)*60) ))
|| ' SECS ' time_difference
,
DECODE(p.concurrent_program_name,'ALECDC',p.concurrent_program_name||
'['||f.descriptio
n||']',p.concurrent_program_name) concurrent_program_name
, decode(f.phase_code,'R','Running','C','Complete',f.phase_code) Phase
, f.status_code
FROM apps.fnd_concurrent_programs p
, apps.fnd_concurrent_programs_tl pt
, apps.fnd_concurrent_requests f
WHERE f.concurrent_program_id = p.concurrent_program_id
and f.program_application_id = p.application_id
and f.concurrent_program_id = pt.concurrent_program_id
and f.program_application_id = pt.application_id
AND pt.language = USERENV('Lang')
and f.actual_start_date is not null
ORDER by f.actual_completion_date-f.actual_start_date desc;
Problem with Running Bit Map Reports (Formatter Error)
Do the following steps :
 1.  While registering the report set program options to
     VERSION=2.0b.
 2.  Add the following line at the end of
     $ORACLE_HOME/guicommon2/tk23/admin/uiprint.txt file:
     ljcrp1:PostScript:1:The default printer if $PRINTER is not set:default.ppd:
PS: Change ljcrp1 with your network printer name.
Oracle Expense Report (Approval Limits)
Expense reports will fail is the manager does not have approval authority for a
particular cost center, or an appropriate approval level for the cost center of the
employee submitting the expense report.

The query to show the employee approval limits are as follows:

SELECT b.full_name, a.cost_center, a.org_id, c.NAME org_name, a.signing_limit


FROM ap_web_signing_limits_all a,
per_all_people_f b,
hr_organization_units c
WHERE a.employee_id = b.person_id
AND a.org_id = c.organization_id
AND b.effective_start_date = (SELECT MAX (effective_start_date)
FROM apps.per_all_people_f
WHERE person_id = b.person_id)
AND a.document_type = 'APEXP'

The navigation to check/update the approval limits for an expense report of an


employee is as follows:

                                        Payables Manager -> Employees -> Signing Limits

Making the custom reports Oracle Applications compliant


Before moving the reports to application do the following to make sure that the
report is Oracle Applications compliant.
1. Remove the '_all' tables from the FROM clause.  For instance instead of using
PA_PROJECTS_ALL table use PA_PROJECTS (view).
2. Add a User Parameter P_CONC_REQUEST_ID. The datatype of this
parameter is Number , Size is 15, initial value is 0
3. In the BEFORE REPORT Trigger add this piece of code to set the
environment variables.
     SRW.USER_EXIT('FND SRWINIT');
4. In the AFTER REPORT trigger add this piece of code to reset the environment
variables.
    SRW.USER_EXIT('FND SRWEXIT');

Vendor Extraction Query

select
  d.vendor_name
, d.segment1 GSL_NUmber
, e.vendor_site_code
, e.address_line1
, e.address_line2
, e.address_line3
, e.city
, e.state
, e.zip
, e.province
, e.country
, substr(e.attribute14,1,3)
, d.last_update_date
, d.last_updated_by
, d.creation_date
, d.created_by
, d.set_of_books_id
,e.vendor_site_code
,e.vendor_site_code_alt
,e.purchasing_site_flag
,e.pay_site_flag
,e.address_line1
,e.address_lineS_alt
,e.address_line2
,e.address_line3
,e.city
,e.state
,e.zip
,e.province
,e.country
,e.phone
,e.customer_num
,e.ship_to_location_id
,e.bill_to_location_id
,e.ship_via_lookup_code
,e.freight_terms_lookup_code
,e.payment_method_lookup_code
,e.terms_date_basis
,e.accts_pay_code_combination_id
,e.prepay_code_combination_id
,e.payment_priority
,e.termS_id
,e.invoice_amount_limit
,e.pay_date_basis_lookup_code
,e.invoice_currency_code
,e.payment_currency_code
,e.hold_unmatched_invoices_flag
,e.ap_tax_rounding_rule
,e.auto_tax_calc_flag
,e.auto_tax_calc_override
,e.address_line4
,e.county
,e.match_option
FROM PO.po_vendors D
    ,PO.PO_VENDOR_SITES_ALL E
WHERE E.vendor_id = D.vendor_id
AND org_id in (2265)
 -- Initializing the default values from System Parameters
    -- Get default values from Payable Options                                                   
                                                                                                 
                                                     
    BEGIN
      SELECT auto_tax_calc_flag,
             auto_tax_calc_override,
             amount_includes_tax_flag,
             pay_date_basis_lookup_code,
             hold_unmatched_invoices_flag 
      FROM   ap_system_parameters_all
      WHERE  set_of_books_id = l_sob_id
      AND    org_id = l_org_id;     
           -- Get default values from Financial Options (DFT02) 
    
     BEGIN
       SELECT match_option,
              ship_to_location_id,
              bill_to_location_id,
              ship_via_lookup_code,
              freight_terms_lookup_code,
              tax_rounding_rule
       FROM financials_system_params_all
       WHERE set_of_books_id = l_sob_id
       AND  org_id =  l_org_id;  
          
      

select 'EXECUTE ad_dd.register_column('||''''||'CUSTOM'||''''||','||''''||


ltrim(rtrim(table_name))||''''||','||
''''||ltrim(rtrim(column_name))||''''||','||to_char(column_id,'999')||','||''''||
ltrim(rtrim(data_type))||''''||','||to_char(data_length,'999')||','||''''||nullable||''''||','||''''||'N'||''''||');'
from dba_tab_columns where owner like 'CUSTOM%' and
table_name like 'A00_CHN%' order by column_id

Pl/Sql way of submitting Concurrent program

BEGIN
--APPS.fnd_global.apps_initialize( user_id => 19300, resp_id => 55962, resp_appl_id =>
20003);
APPS.fnd_global.apps_initialize(19300,55962,20003);

-- If you are directly running from the database using the TOAD, SQL-NAVIGATOR or
--SQL*PLUS etc. Then you need to
--Initialize the Apps. In this case use the above API to
--Initialize the APPS. If you are using same code in some procedure and running directly
--from application then you don't need to initalize.
--Then you can comment the above API.

l_success :=fnd_request.submit_request
('CAGCUS', -- Application Short name of the Concurrent Program.
'CCGL_OB_DUP_PARENT', -- Program Short Name.
'List of duplicates for Op Unit / Account requested', -- Description of the Program.
SYSDATE, -- Submitted date. Always give the SYSDATE.
FALSE, -- Always give the FLASE.
'ccgl_parent_extract',
SELECT fa.application_short_name,
DECODE (fcpv.execution_method_code,
'B', 'Request Set Stage Function',
'Q', 'SQL*Plus',
'H', 'Host',
'L', 'SQL*Loader',
'A', 'Spawned',
'I', 'PL/SQL Stored Procedure',
'P', 'Oracle Reports',
'S', 'Immediate',
fcpv.execution_method_code
) exe_method,
COUNT (concurrent_program_id) COUNT
FROM fnd_concurrent_programs_vl fcpv, fnd_application fa
WHERE fcpv.application_id = fa.application_id
GROUP BY fa.application_short_name, fcpv.execution_method_code
ORDER BY 1;

To get form Id from database

SELECT FUNCTION_ID, USER_FUNCTION_NAME FROM


FND_FORM_FUNCTIONS_TL
You can also use
SELECT FUNCTION_ID, FUNCTION_NAME FROM FND_FORM_FUNCTIONS

También podría gustarte