Sei sulla pagina 1di 3

-- The following query could be used to get the Order Header Id

FOR the problematic Sales ORDER NUMBER.


SELECT header_id Header_id
FROM oe_order_headers_all
WHERE order_number = &order_number;
----------------------------------------------------mmt
select *
from mtl_material_transactions b
where trx_source_line_id in (select line_id from oe_order_lines_all
where header_id=&header_id or reference_header_id=&header_id);
--mta2
select *
from mtl_transaction_accounts
where transaction_id in
(select transaction_id
from mtl_material_transactions
where trx_source_line_id in (select line_id from oe_order_lines_all
where header_id=&header_id or reference_header_id=&header_id));
--oola
select * from oe_order_lines_all
where header_id=&header_id
or reference_header_id=&header_id;
--ooha
select * from oe_order_headers_all
where header_id in
(select header_id from oe_order_lines_all
where header_id=&header_id
or reference_header_id=&header_id);
--rctla
SELECT *
FROM ra_customer_trx_lines_all rctl
WHERE rctl.interface_line_context = 'ORDER ENTRY'
AND TO_NUMBER(rctl.interface_line_attribute1) IN
(select order_number from oe_order_headers_all
where header_id in
(select header_id from oe_order_lines_all
where header_id=&header_id
or reference_header_id=&header_id));
--rcta
SELECT *
FROM ra_customer_trx_all rct
WHERE customer_trx_id IN
(SELECT customer_trx_id
FROM ra_customer_trx_lines_all rctl
WHERE rctl.interface_line_context = 'ORDER ENTRY'
AND TO_NUMBER(rctl.interface_line_attribute1)IN
(select order_number from oe_order_headers_all
where header_id in
(select header_id from oe_order_lines_all
where header_id=&header_id

or reference_header_id=&header_id)));
--rctlgd
SELECT *
FROM ra_cust_trx_line_gl_dist_all rctlgd
WHERE rctlgd.customer_trx_line_id IN
(SELECT rctl.customer_trx_line_id
FROM ra_customer_trx_lines_all rctl
WHERE rctl.interface_line_context = 'ORDER ENTRY'
AND TO_NUMBER(rctl.interface_line_attribute1) IN
(select order_number from oe_order_headers_all
where header_id in
(select header_id from oe_order_lines_all
where header_id=&header_id
or reference_header_id=&header_id)));
--cms
SELECT * FROM cst_margin_summary
WHERE header_id IN (select header_id from oe_order_lines_all
where header_id=&header_id
or reference_header_id=&header_id);
--cmb
SELECT * FROM cst_margin_build
WHERE build_id IN
( SELECT DISTINCT build_id
FROM cst_margin_summary
WHERE header_id IN (select header_id from oe_order_lines_all
where header_id=&header_id
or reference_header_id=&header_id));
--msi
SELECT costing_enabled_flag, INVENTORY_ASSET_FLAG,
inventory_item_id, organization_id
FROM mtl_system_items
WHERE organization_id = &organization_id
AND inventory_item_id IN
(SELECT inventory_item_id
FROM mtl_material_transactions mmt
WHERE mmt.transaction_source_type_id in (2,8)
and mmt.transaction_action_id <> 28
AND mmt.trx_source_line_id IN
(SELECT line_id
FROM oe_order_lines_all
WHERE header_id = &header_id
OR reference_header_id=&header_id));
--pkg
SELECT text
FROM all_source
WHERE NAME='CSTPMRGL'
AND TYPE='PACKAGE BODY'
ORDER BY line;
--pkgobj
SELECT object_name,object_type,status
FROM all_objects
WHERE object_name='CSTPMRGL';

Additional queries if R12 Release ===================================


--crcml
select * from cst_revenue_cogs_match_lines
where cogs_om_line_id in (select line_id from oe_order_lines_all
where header_id=&header_id);
--cce
select * from cst_cogs_events
where cogs_om_line_id in (select line_id from oe_order_lines_all
where header_id=&header_id);
--crrl
select * from cst_revenue_recognition_lines
where revenue_om_line_id in (select revenue_om_line_id from cst_revenue_cogs_ma
tch_lines
where cogs_om_line_id in (select line_id from oe_order_lines_all
where header_id=&header_id));
--mta_cce
select *
from mtl_transaction_accounts
where transaction_id in
(select mmt_transaction_id
from cst_cogs_events
where cogs_om_line_id in (select line_id from oe_order_lines_all
where header_id=&header_id));

Potrebbero piacerti anche