Queries
Queries
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.
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
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
(or)
SELECT *
FROM wf_item_activity_statuses_v
WHERE activity_status_code = 'ACTIVE'
BEGIN
wf_engine.abortprocess(
itemtype=> 'ODPCYCLE',
itemkey=> 'TI:GL-PlanName-12/10/2011-10:25:35-ODP');
COMMIT;
END;
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%'
select sum(blocks*8192)/(1024*1024)
from dba_TAB_partitions
WHERE TABLE_OWNER = 'MSC'
and partition_name like '%1033'
and blocks > 0
VERSION
----------------------------------------
8.0.4.0.0
COMPATIBILITY
----------------------------------------
8.0.0
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
function FND_SUBMIT.SUBMIT_PROGRAM
(application IN varchar2,
program IN varchar2,
stage IN varchar2,
argument1,...argument100)
return boolean;
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;
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;
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'
a) First find out short_name of a program and then pass it as parameter to below
query.
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
/
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;
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;