0% found this document useful (0 votes)
28 views

Queries1 SQL

Uploaded by

Thiruva Rangan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Queries1 SQL

Uploaded by

Thiruva Rangan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 18

Queries

exception when others then


null;
end;
end loop;
UPDATE IBY_EXTERNAL_PAYEES_ALL
SET REMIT_ADVICE_EMAIL=NULL;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;

--To add program to request GROUP


DECLARE
l_program_short_name VARCHAR2 (200);
l_program_application VARCHAR2 (200);
l_request_group VARCHAR2 (200);
l_group_application VARCHAR2 (200);
l_check VARCHAR2 (2);
--
BEGIN
--
l_program_short_name := 'XXPP_MYX_ARRCPTRECONREP';
l_program_application := 'Product Partners Application';
l_request_group := 'Receivables Reports Only';
l_group_application := 'Receivables';
--
--Calling API to assign concurrent program to a reqest group
--
apps.fnd_program.add_to_group (program_short_name => l_program_short_name,
program_application => l_program_application,
request_group => l_request_group,
group_application => l_group_application

);
--
COMMIT;
--
BEGIN
--
--To check whether a paramter is assigned to a Concurrent Program or not
--
SELECT 'Y'
INTO l_check
FROM fnd_request_groups frg,
fnd_request_group_units frgu,
fnd_concurrent_programs fcp
WHERE frg.request_group_id = frgu.request_group_id
AND frg.application_id = frgu.application_id
AND frgu.request_unit_id = fcp.concurrent_program_id
AND frgu.unit_application_id = fcp.application_id
AND fcp.concurrent_program_name = 'XXPP_MYX_ARRCPTRECONREP'
AND rownum=1;
--
dbms_output.put_line ('Adding Concurrent Program to Request Group Succeeded');
--
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line ('Adding Concurrent Program to Request Group Failed');
END;
END;
--End of script to add program to request GROUP

--

--To search Tangible ID with Order#


SELECT ooh.order_number,t.tangibleid,arm.name, iby_core.REFERENCECODE,
acrh.receipt_number, acrh.cash_receipt_id,
CC.*
--T.*
FROM apps.iby_creditcard cc,
apps.IBY_FNDCPT_TX_EXTENSIONS ifx,
apps.IBY_PMT_INSTR_USES_ALL ipi,
apps.oe_payments op,
apps.oe_order_headers_all ooh,
iby_creditcard ic--,
,apps.iby_trxn_summaries_all t,
apps.iby_fndcpt_tx_operations o,
iby_trxn_core iby_core ,
ar_receipt_methods arm,
ra_customer_trx_all rct,
ar_payment_schedules_all aps,
AR_RECEIVABLE_APPLICATIONS_ALL ARP,
ar_cash_receipt_history_all acrh,
ar_cash_receipts_all acr
WHERE cc.instrid = ipi.INSTRUMENT_ID
AND ipi.ext_pmt_party_id = ifx.ext_payer_id
and ipi.INSTRUMENT_PAYMENT_USE_ID = ifx.INSTR_ASSIGNMENT_ID
and ifx.trxn_extension_id = op.trxn_extension_id
and op.header_id = ooh.header_id
and ic.instrid=ipi.instrument_id
AND t.transactionid=o.transactionid
AND o.trxn_extension_id = ifx.trxn_extension_id
and ooh.order_number in (227891374)
and iby_core.trxnmid=t.trxnmid
and arm.receipt_method_id=op.receipt_method_id
and rct.interface_header_attribute1(+)=to_char(ooh.order_number)
and aps.customer_trx_id(+)=rct.customer_trx_id
and arp.applied_customer_trx_id(+)=rct.customer_trx_id
and acrh.cash_receipt_id(+)=arp.cash_receipt_id
and acr.cash_receipt_id(+)=acrh.cash_receipt_id
and acrh.current_record_flag(+)='Y'
order by t.creation_date desc;

BBadmin_PW.epw

-- Resp Name with Concurrent PGM Name


SELECT frt.responsibility_name, frg.request_group_name,
frgu.request_unit_type,frgu.request_unit_id,
fcpt.user_concurrent_program_name
FROM fnd_Responsibility fr, fnd_responsibility_tl frt,
fnd_request_groups frg, fnd_request_group_units frgu,
fnd_concurrent_programs_tl fcpt
WHERE frt.responsibility_id = fr.responsibility_id
AND frg.request_group_id = fr.request_group_id
AND frgu.request_group_id = frg.request_group_id
AND fcpt.concurrent_program_id = frgu.request_unit_id
AND frt.LANGUAGE = USERENV('LANG')
AND fcpt.LANGUAGE = USERENV('LANG')
AND fcpt.user_concurrent_program_name = :conc_prg_name
ORDER BY 1,2,3,4

--List of responsibilities assigned to a user


select fu.user_name,
frt.responsibility_name,
furg.start_date,
furg.end_date
from fnd_user fu ,
fnd_user_resp_groups_direct furg ,
fnd_responsibility_vl frt
where fu.user_id = furg.user_id
and frt.responsibility_id = furg.responsibility_id
and frt.application_id = furg.responsibility_application_id
and nvl(furg.end_date,sysdate+1) > sysdate
and nvl(frt.end_date,sysdate +1) > sysdate
and fu.user_name = :p_user_name
--and fu.user_name = :p_userid;
;

exec ad_zd_table.upgrade('XXPP', 'XXPP_SALES_REGISTER_DETAILS'); -- For New Table


/
exec ad_zd_table.patch('XXPP', 'XXPP_CONV_AP_SUPPLIER_STG'); --For Modifying
Existing table. Table name in CAPS

XXPP_BD_VOLUME_LINE_INFO

--Recent Orders
SELECT ic.instrid,
ic.ccnumber,
ic.card_issuer_code,
ooh.order_number,
ooh.PAYMENT_AMOUNT,
arm.name,
CC.ATTRIBUTE1,
ooh.request_date,
hca.cust_account_id,
hca.account_number,
oOh.FLOW_STATUS_CODE,
ott.name order_type,
ooh.ordered_date,
ooh.creation_date,
ooh.open_flag,
ooh.payment_type_code,
t.*
FROM apps.iby_creditcard cc,
apps.IBY_FNDCPT_TX_EXTENSIONS ifx,
apps.IBY_PMT_INSTR_USES_ALL ipi,
apps.oe_payments op,
apps.oe_order_headers_all ooh,
iby_creditcard ic,
oe_transaction_types_tl ott,
ar_receipt_methods arm,
hz_cust_accounts hca,
apps.iby_trxn_summaries_all t,
apps.iby_fndcpt_tx_operations o
WHERE cc.instrid = ipi.INSTRUMENT_ID
AND ipi.ext_pmt_party_id = ifx.ext_payer_id
and ipi.INSTRUMENT_PAYMENT_USE_ID = ifx.INSTR_ASSIGNMENT_ID
and ifx.trxn_extension_id = op.trxn_extension_id
and op.header_id = ooh.header_id
and ic.instrid=ipi.instrument_id
and ooh.creation_date > sysdate -10 and ooh.org_id=102
and ott.transaction_type_id=ooh.order_type_id
--AND oeh.FLOW_STATUS_CODE<>'CLOSED'
and ott.name not like '%CONTINUITY%'
and arm.receipt_method_id=op.receipt_method_id
--AND ooh.created_by=41747
and hca.cust_account_id=ooh.sold_to_org_id
AND t.transactionid(+)=o.transactionid
AND o.trxn_extension_id(+) = ifx.trxn_extension_id;

--onhand quantities
SELECT
msib.segment1 item_code ,
moqd.SUBINVENTORY_CODE
,moqd.LOCATOR_ID
,SUM(moqd.TRANSACTION_QUANTITY) onhand_quantity ,
milkfv.CONCATENATED_SEGMENTS LOCATORS
FROM APPS.MTL_SYSTEM_ITEMS_B msib,
APPS.MTL_ONHAND_QUANTITIES_DETAIL moqd ,
APPS.mtl_item_locations_kfv milkfv
WHERE 1=1
and msib.organization_id = 567
and msib.INVENTORY_ITEM_ID = moqd.INVENTORY_ITEM_ID
AND MSIB.ORGANIZATION_ID =MOQD.ORGANIZATION_ID
and moqd.SUBINVENTORY_CODE = :P_SUBINVENTORY
AND milkfv.INVENTORY_LOCATION_ID = moqd.LOCATOR_ID
AND MSIB.SEGMENT1 = :P_ITEM
GROUP BY
MSIB.SEGMENT1,MOQD.SUBINVENTORY_CODE,MILKFV.CONCATENATED_SEGMENTS;

--PP US Refund-Remittance Creation Set


--PP Remittance Creation Multithread

--Query for monitoring critical jobs

select
frt.responsibility_name,
--fcp_top.user_concurrent_program_name parent_request_set,
--hier_level,
to_char(reqset.top_requested_start_date,'DD-MON-YYYY HH24:MM:SS'),
LPAD(' ',(reqset.hier_level-1)*2)||fcp.user_concurrent_program_name
user_concurrent_program_name,
top_phase.meaning top_phase,
--top_status.meaning top_status,
phase.meaning phase,
status.meaning status,
to_char(reqset.top_actual_start_date,'DD-MON-YYYY HH24:MM:SS'),
FLOOR((reqset.top_actual_COMPLETION_date-reqset.top_actual_start_date)*24)
duration_in_hrs,
MOD(ROUND((reqset.top_actual_COMPLETION_date-
reqset.top_actual_start_date)*24*60),60) duration_in_mins,
--reqset.top_actual_COMPLETION_date,
--reqset.top_last_update_date,
to_char(reqset.actual_start_date,'DD-MON-YYYY HH24:MM:SS'),
to_char(reqset.actual_COMPLETION_date,'DD-MON-YYYY HH24:MM:SS'),
--reqset.last_update_date,
top_request_id,
request_id
from
(
select
CONNECT_BY_ROOT fcr.requested_start_date top_requested_start_date,
CONNECT_BY_ROOT fcr.actual_start_date top_actual_start_date,
CONNECT_BY_ROOT fcr.actual_COMPLETION_date top_actual_COMPLETION_date,
CONNECT_BY_ROOT fcr.last_update_date top_last_update_date,
CONNECT_BY_ROOT fcr.request_id top_request_id,
CONNECT_BY_ROOT fcr.concurrent_program_id top_concurrent_program_id,
CONNECT_BY_ROOT fcr.phase_code top_phase_code,
CONNECT_BY_ROOT fcr.status_code top_status_code,
fcr.request_id, --request ID for autinvoice import
fcr.parent_request_id, --Request ID for autoinovice master,
fcr.responsibility_id,
fcr.requested_start_date,
fcr.actual_start_date,
fcr.actual_COMPLETION_date,
fcr.last_update_date,
fcr.concurrent_program_id,
fcr.phase_code,
fcr.status_code,
level hier_level
from fnd_concurrent_requests fcr
start with fcr.concurrent_program_id IN (
SELECT concurrent_program_id
FROM FND_CONCURRENT_PROGRAMS_TL fcp
WHERE
fcp.user_concurrent_program_name in ('Request Set PP Adjustment and CM Refund
Multithread',
'Request Set PP-Invoice-Receipt-Remittance Creation-UK-Non-Mlt-Thrd',
'Request Set PP-Invoice-Receipt-Remittance Creation-Canada-Mlt-Thrd',
'Request Set PP Invoice-Receipt Creation Multithread',
'Request Set PP UK Refund-Remittance Creation Set-Non-Mlt-Thrd',
'Request Set PP US Refund-Remittance Creation Set',
'Request Set PP Canada Refund-Remittance Creation Set-Mlt-Thrd',
'Request Set PP Remittance Creation Multithread'
))
connect by prior fcr.request_id=fcr.parent_request_id
AND fcr.concurrent_program_id NOT IN (SELECT CONCURRENT_PROGRAM_ID FROM
FND_CONCURRENT_PROGRAMS_TL WHERE USER_CONCURRENT_PROGRAM_NAME in ('Request Set PP
Adjustment and CM Refund Multithread',
'Request Set PP-Invoice-Receipt-Remittance Creation-UK-Non-Mlt-Thrd',
'Request Set PP-Invoice-Receipt-Remittance Creation-Canada-Mlt-Thrd',
'Request Set PP Invoice-Receipt Creation Multithread',
'Request Set PP UK Refund-Remittance Creation Set-Non-Mlt-Thrd',
'Request Set PP US Refund-Remittance Creation Set',
'Request Set PP Canada Refund-Remittance Creation Set-Mlt-Thrd',
'Request Set PP Remittance Creation Multithread')
))reqset,
fnd_concurrent_programs_tl fcp_top,
fnd_concurrent_programs_tl fcp,
fnd_responsibility_tl frt,
fnd_lookups top_phase,
fnd_lookups phase,
fnd_lookups top_status,
fnd_lookups status
WHERE
fcp_top.concurrent_program_id=reqset.top_concurrent_program_id
and fcp.concurrent_program_id=reqset.concurrent_program_id
and frt.responsibility_id=reqset.responsibility_id
and top_phase.lookup_type='CP_PHASE_CODE'
and phase.lookup_type='CP_PHASE_CODE'
and top_status.lookup_type='CP_STATUS_CODE'
and status.lookup_type='CP_STATUS_CODE'
AND top_phase.lookup_code = reqset.top_phase_code
AND phase.lookup_code = reqset.phase_code
AND top_status.lookup_code = reqset.top_status_code
AND status.lookup_code = reqset.status_code
and reqset.hier_level=NVL(:hier_level,reqset.hier_level)
AND lower(top_phase.meaning)=lower(NVL(:reqset_phase,top_phase.meaning))
AND lower(phase.meaning)=lower(NVL(:child_phase,phase.meaning))
ORDER BY reqset.top_actual_start_date desc, reqset.top_request_id,
reqset.parent_request_id;

--This is for getting GL details summarized by PSON and capture/refund type for
CyberSource transactions.
SELECT
PAYMENT_SYSTEM_ORDER_NUMBER,GL_DATE,
type||PAYMENT_SYSTEM_ORDER_NUMBER KEY,
SUM(AMOUNT) AMOUNT
FROM
(
select
acrh.GL_DATE,
acr.receipt_number,
IFX.PAYMENT_SYSTEM_ORDER_NUMBER,
CASE acr.type WHEN 'CASH' THEN 'ics_bill' ELSE 'ics_credit' END type,
acrh.amount
from ar_cash_receipts acr,
apps.IBY_FNDCPT_TX_EXTENSIONS ifx,
ar_cash_receipt_history_all acrh,
ar_receipt_methods arm
where
acrh.gl_date between to_date('&&FROM_DATE','MM/DD/YYYY') AND
to_date('&&TO_DATE','MM/DD/YYYY')
AND ACRH.CURRENT_RECORD_FLAG='Y'
AND ACRH.STATUS='REMITTED'
AND ACR.CASH_RECEIPT_ID=ACRH.CASH_RECEIPT_ID
and arm.receipt_method_id=acr.receipt_method_id
and lower(arm.name) not like '%vindicia%'
and lower(arm.name) not like '%7177%'
and ifx.trxn_extension_id=acr.PAYMENT_TRXN_EXTENSION_ID
)
GROUP BY PAYMENT_SYSTEM_ORDER_NUMBER,
type||PAYMENT_SYSTEM_ORDER_NUMBER,GL_DATE;

--Including FlexPay Receipts


SELECT
GL_DATE,
SUM(AMOUNT) AMOUNT
FROM
(
select
acrh.GL_DATE,
acr.receipt_number,
CASE acr.type WHEN 'CASH' THEN 'ics_bill' ELSE 'ics_credit' END type,
acrh.amount
from ar_cash_receipts acr,
ar_cash_receipt_history_all acrh,
ar_receipt_methods arm
where
acrh.gl_date between to_date('&&FROM_DATE','MM/DD/YYYY') AND
to_date('&&TO_DATE','MM/DD/YYYY')
AND ACRH.CURRENT_RECORD_FLAG='Y'
AND ACRH.STATUS in ('REMITTED','CLEARED')
AND ACR.CASH_RECEIPT_ID=ACRH.CASH_RECEIPT_ID
and arm.receipt_method_id=acr.receipt_method_id
--and lower(arm.name) not like '%vindicia%'
--and lower(arm.name) not like '%7177%'
)
GROUP BY GL_DATE
ORDER BY GL_DATE;

BEGIN
APPS.MO_GLOBAL.SET_POLICY_CONTEXT('S',226);
END;

Inbound:
--PP Re-processing Receipts Awaiting Remittance --xxpp_rcpt_awaiting_remittance
--PP Update IBY Data --XXPP_FINANCE_UTIL.PP_UPD_IBY_DATA_MAIN

Outbound:
--PP Re-processing Receipts Awaiting Remittance --xxpp_rcpt_awaiting_remittance

--Modified Query for Tangible ID with Receipt NUMBER


SELECT distinct ooh.order_number,t.tangibleid, t.trxnmid,t.reqtype,
arm.name receipt_method_name, iby_core.REFERENCECODE,
acr.receipt_number, acr.cash_receipt_id
FROM apps.iby_creditcard cc,
apps.IBY_FNDCPT_TX_EXTENSIONS ifx,
apps.IBY_PMT_INSTR_USES_ALL ipi,
apps.oe_payments op,
apps.oe_order_headers_all ooh,
iby_creditcard ic,
apps.iby_trxn_summaries_all t,
apps.iby_fndcpt_tx_operations o,
iby_trxn_core iby_core ,
ar_receipt_methods arm,
ra_customer_trx_all rct,
ar_payment_schedules_all aps,
AR_RECEIVABLE_APPLICATIONS_ALL ARP,
ar_cash_receipt_history_all acrh,
ar_cash_receipts_all acr
WHERE cc.instrid = ipi.INSTRUMENT_ID
AND ipi.ext_pmt_party_id = ifx.ext_payer_id
and ipi.INSTRUMENT_PAYMENT_USE_ID = ifx.INSTR_ASSIGNMENT_ID
and ifx.trxn_extension_id = op.trxn_extension_id
and op.header_id = ooh.header_id
and ic.instrid=ipi.instrument_id
AND t.transactionid=o.transactionid
AND o.trxn_extension_id = ifx.trxn_extension_id
--and ooh.order_number in (227891374)
and iby_core.trxnmid=t.trxnmid
and arm.receipt_method_id=op.receipt_method_id
and rct.interface_header_attribute1(+)=to_char(ooh.order_number)
and aps.customer_trx_id(+)=rct.customer_trx_id
and arp.applied_customer_trx_id(+)=rct.customer_trx_id
and acrh.cash_receipt_id(+)=arp.cash_receipt_id
and acr.cash_receipt_id(+)=acrh.cash_receipt_id
and acr.receipt_number in ('93846232')
and acrh.current_record_flag(+)='Y';

---Query to check Authorization in Cybersource using order#


select distinct ooh.order_number, itsa.tangibleid as pson_number
from
apps.oe_order_headers_all ooh,
apps.oe_payments op,
apps.iby_fndcpt_tx_operations ifto,
apps.IBY_FNDCPT_TX_EXTENSIONS ifte,
apps.iby_trxn_summaries_all itsa
where 1=1
and ooh.header_id = op.header_id
and op.trxn_extension_id = ifte.trxn_extension_id
and ifte.trxn_extension_id = ifto.trxn_extension_id
and ifto.transactionid = itsa.transactionid
and ooh.order_number='148321662';

select distinct ooh.order_number, itsa.tangibleid as pson_number


from
apps.oe_order_headers_all ooh,
apps.oe_payments op,
apps.iby_fndcpt_tx_operations ifto,
apps.IBY_FNDCPT_TX_EXTENSIONS ifte,
apps.ar_cash_receipts_all acr,
apps.iby_trxn_summaries_all itsa
where 1=1
and ooh.header_id = op.header_id
and ifto.trxn_extension_id = acr.payment_trxn_extension_id
and op.trxn_extension_id = ifte.trxn_extension_id
and ifte.trxn_extension_id = ifto.trxn_extension_id
and ifto.transactionid = itsa.transactionid
and acr.cash_receipt_id in (152645492, 152644962 ,152643359)
and ooh.order_number='148321662';

--Receipt Number and PSON Join


select distinct itsa.tangibleid as pson_number, acr.receipt_number
from
apps.iby_fndcpt_tx_operations ifto,
apps.IBY_FNDCPT_TX_EXTENSIONS ifte,
apps.ar_cash_receipts_all acr,
apps.iby_trxn_summaries_all itsa
where 1=1
and ifto.trxn_extension_id = acr.payment_trxn_extension_id
and ifte.trxn_extension_id = ifto.trxn_extension_id
and ifto.transactionid = itsa.transactionid
--and acr.cash_receipt_id in (152645492, 152644962 ,152643359)
--and ooh.order_number='148321662';
and itsa.tangibleid='STORE_601273292';

--MISC Receipt Columns

APPLICATION_REF_TYPE = 'MISC_RECEIPT'
APPLICATION_REF_ID = MISC Receipt id
APPLICATION_REF_NUM = MISC Receipt Number
in ar_receivable_applications_all

SELECT
distinct acr.receipt_number, acr.cash_receipt_id,
itsa.tangibleid,itsa.trxnmid,itsa.reqtype,acr.type
FROM
apps.iby_trxn_summaries_all itsa,
apps.iby_fndcpt_tx_operations ifto,
ar_cash_receipts_all acr,
ar_cash_receipt_history_all acrh,
apps.IBY_FNDCPT_TX_EXTENSIONS ifx
WHERE
itsa.transactionid = ifto.transactionid
AND ifto.trxn_extension_id = acr.payment_trxn_extension_id
AND acr.cash_receipt_id = acrh.cash_receipt_id
AND reqtype='ORAPMTRETURN'
AND ifto.trxn_extension_id = ifx.trxn_extension_id
AND itsa.tangibleid='ONT326230447';

----Open Invoice

select aps.*
FROM ra_customer_trx_all ra,
ra_customer_trx_lines_all rl,
ar_payment_schedules_all aps,
ra_cust_trx_types_all rt,
hz_cust_accounts hc,
hz_parties hp,
hz_cust_acct_sites_all hcasa_bill,
hz_cust_site_uses_all hcsua_bill,
hz_party_sites hps_bill,
ra_cust_trx_line_gl_dist_all rct
WHERE 1 = 1
AND ra.customer_trx_id = rl.customer_trx_id
AND ra.customer_trx_id = aps.customer_trx_id
AND ra.org_id = aps.org_id
AND rct.customer_trx_id = aps.customer_trx_id
AND rct.customer_trx_id = ra.customer_trx_id
AND rct.customer_trx_id = rl.customer_trx_id
AND rct.customer_trx_line_id = rl.customer_trx_line_id
AND ra.complete_flag = 'Y'
AND rl.line_type IN ('FREIGHT', 'LINE')
AND ra.cust_trx_type_id = rt.cust_trx_type_id
AND ra.bill_to_customer_id = hc.cust_account_id
AND hc.status = 'A'
AND hp.party_id = hc.party_id
AND hcasa_bill.cust_account_id = ra.bill_to_customer_id
AND hcasa_bill.cust_acct_site_id = hcsua_bill.cust_acct_site_id
AND hcsua_bill.site_use_code = 'BILL_TO'
AND hcsua_bill.site_use_id = ra.bill_to_site_use_id
AND hps_bill.party_site_id = hcasa_bill.party_site_id
AND hcasa_bill.status = 'A'
AND hcsua_bill.status = 'A'
AND aps.amount_due_remaining <> 0
AND aps.status = 'OP'
and hc.cust_account_id=21924

--------------------------------Query to identify TSP


orders---------------------------------------------

select order_number ,a.ORIG_SYS_DOCUMENT_REF, name, a.creation_Date, ordered_item ,


unit_selling_price
from oe_order_headers_all a , oe_order_lines_all ol, oe_transaction_types_tl tl
where a.creation_Date > to_date('02-05-2023','MM-DD-YYYY')
AND ol.header_id = a.header_id
and a.order_type_id = transaction_type_id
and XXPP_PRICING_UTIL_PKG.IS_TSP_ORDER(a.header_id) = 'Y'
AND EXISTS (SELECT 1
FROM mtl_item_categories_v micv
WHERE UPPER (micv.category_set_name) = UPPER ('Entitlements')
AND micv.inventory_item_id = ol.inventory_item_id
AND micv.organization_id = ol.ship_from_org_id
AND micv.segment7 IS NOT NULL) ;

select distinct order_number from xxpp_sales_register_details where order_number in


(
select order_number --,a.ORIG_SYS_DOCUMENT_REF, name, a.creation_Date, ordered_item
, unit_selling_price, a.last_update_date
from oe_order_headers_all a , oe_order_lines_all ol, oe_transaction_types_tl tl
where a.creation_Date > to_date('02-05-2023','MM-DD-YYYY')
AND ol.header_id = a.header_id
and a.order_type_id = transaction_type_id
and XXPP_PRICING_UTIL_PKG.IS_TSP_ORDER(a.header_id) = 'Y'
AND EXISTS (SELECT 1
FROM mtl_item_categories_v micv
WHERE UPPER (micv.category_set_name) = UPPER ('Entitlements')
AND micv.inventory_item_id = ol.inventory_item_id
AND micv.organization_id = ol.ship_from_org_id
AND micv.segment7 IS NOT NULL) );

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

select a.STATUS, a.BEPMESSAGE, a.REQDATE, a.tangibleid--count(1)--a.STATUS,


a.BEPMESSAGE, a.REQDATE, a.tangibleid
from iby_trxn_summaries_all a
where a.reqdate >= to_date('06/15/2021 00:00:00','MM/DD/YYYY HH24:MI:SS') --
between to_date('06/15/2021 00:00:00','MM/DD/YYYY HH24:MI:SS') AND
to_date('06/15/2021 23:59:59','MM/DD/YYYY HH24:MI:SS')
AND a.TRXNTYPEID=8
and a.status = 10
and a.bepmessage='Communication error. The payment system, the processor, or
iPayment electronic commerce servlet is not available/accessible. Please make sure
you have the correct system set up and resubmit the request at a later time.'
and not exists (select 1 from iby_trxn_summaries_all b
where b.tangibleid=a.tangibleid
and b.TRXNTYPEID=8
and b.status=0 );

SELECT
distinct acr.receipt_number, acr.cash_receipt_id,
itsa.tangibleid,itsa.trxnmid,itsa.reqtype
FROM
apps.iby_trxn_summaries_all itsa,
apps.iby_fndcpt_tx_operations ifto,
ar_cash_receipts_all acr,
ar_cash_receipt_history_all acrh
WHERE
itsa.transactionid = ifto.transactionid
AND ifto.trxn_extension_id = acr.payment_trxn_extension_id
AND acr.cash_receipt_id = acrh.cash_receipt_id
AND acr.cc_error_code = 'IBY_0001'
AND acrh.status = 'CONFIRMED'
AND acr.creation_date > (sysdate-p_no_of_days)
AND acr.cc_error_flag='Y'
AND acr.status NOT IN ('CCRR','REV','CC_CHARGEBACK_REV')
AND acr.type = 'CASH'
AND acrh.current_record_flag = 'Y'
AND itsa.status = 10
AND itsa.reqtype = 'ORAPMTCAPTURE';

--AR Receipt Distribution Query


SELECT glcc.segment1 co, glcc.segment2 loc, glcc.segment3 cc,
glcc.segment4 acct, glcc.segment5 prod, glcc.segment6 chan,
glcc.segment7 proj, '' "CODECOMBO desc", xal.accounting_date,
gjh.je_source, gjh.je_category CATEGORY, gjb.NAME batch,
gjh.NAME "JOURNAL name", '' "JE SEQ name", '' "JE SEQ NUM",
gjl.je_line_num "JE LINE", gjl.description "JE LINE DESCR",
gjl.accounted_cr gl_cr, gjl.accounted_dr gl_dr, '' "VENDOR/CUSTOMER",
acra.receipt_number "TRANSACTION NUM",
xal.accounting_class_code "TRANSACTION TYPE", xal.accounted_cr xla_cr,
xal.accounted_dr xla_dr, gjh.period_name period,
(gb.begin_balance_dr - gb.begin_balance_cr) begin_balance,
( gb.period_net_dr
- gb.period_net_cr
+ gb.project_to_date_dr
- gb.project_to_date_cr
) end_balance,
gl.NAME ledger_name
FROM apps.gl_je_headers gjh,
apps.gl_je_batches gjb,
apps.gl_balances gb,
apps.gl_ledgers gl,
apps.gl_je_lines gjl,
apps.gl_import_references gir,
apps.gl_code_combinations glcc,
apps.xla_ae_lines xal,
apps.xla_ae_headers xah,
apps.xla_distribution_links xdl,
apps.ar_distributions_all ada,
apps.ar_cash_receipt_history_all acrha,
apps.ar_cash_receipts_all acra
WHERE 1 = 1
AND gjh.ledger_id = gl.ledger_id
AND gjh.je_batch_id = gjb.je_batch_id
AND gjl.je_header_id = gjh.je_header_id
AND gjl.je_header_id = gir.je_header_id
AND gjl.je_line_num = gir.je_line_num
AND gjl.code_combination_id = glcc.code_combination_id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.gl_sl_link_table = xal.gl_sl_link_table
AND xal.ae_header_id = xah.ae_header_id
AND xal.ae_header_id = xdl.ae_header_id
AND xal.application_id = xah.application_id
AND xal.ae_line_num = xdl.ae_line_num
AND xal.application_id = xdl.application_id
AND xdl.source_distribution_type(+) = 'AR_DISTRIBUTIONS_ALL'
AND xdl.source_distribution_id_num_1(+) = ada.line_id
AND ada.source_id = acrha.cash_receipt_history_id
AND acrha.cash_receipt_id = acra.cash_receipt_id
AND gb.code_combination_id = glcc.code_combination_id
AND gb.period_name = gjh.period_name
AND gb.currency_code = gl.currency_code
AND glcc.segment4 = '13010'
AND gjh.period_name = 'OCT-14'
AND gl.NAME = 'Amazon.com, Inc.'
AND gjh.je_source = 'Receivables'
--and gjh.je_category = 'Receipts'
--and GJH.name = 'OCT-14 Receipts USD';

--Logs

SELECT log.module , log.message_text message


FROM fnd_log_messages log, fnd_log_transaction_context con
WHERE con.transaction_id = '&request_id'
AND con.transaction_type = 'REQUEST'
AND con.transaction_context_id = log.transaction_context_id
ORDER BY log.log_sequence;

--eBTax%Debug%
/
--Unaccounted AR Transactions

SELECT xlt.source_id_int_1 id,


xlt.security_id_int_1 org_id,
xe.*
FROM apps.xla_events xe,
xla.xla_transaction_entities xlt
WHERE xe.entity_id = xlt.entity_id
AND xe.application_id =xlt.application_id
AND xlt.source_application_id = 222
AND xlt.ledger_id = &ledger_id
AND xe.event_date between to_date('&from_gl_date','DD-MON-YYYY')
and to_date('&to_gl_date','DD-MON-YYYY')
AND xe.process_status_code <> 'P'
AND xe.event_status_code <> 'P'
order by xe.event_date;
/

--Alert Name:
XXPP_AP_VENDOR_BANK_UPDATE_AUDIT

BEGIN
fnd_global.apps_initialize (user_id => 48848,
resp_id => 52873, --'US MYX RECEIVABLES
SUPER USER'
resp_appl_id => 222);
END;
/

--Ledger-NAME

select mo_utils.get_ledger_name(fnd_profile.value('ORG_ID')) from dual;


/

begin apps.MO_GLOBAL.SET_POLICY_CONTEXT('S',226); end;


select
NVL(cr.decision,'REJECT') CYBERSOURCE_STATUS,
acr.cash_receipt_id||',' cash_receipt_id,
hou.name org_name,
acr.type receipt_type,
acrv.REMIT_BANK_NAME,
acrv.PAYMENT_METHOD_DSP,
acr.receipt_number,
summ.tangibleid,
summ.trxnmid,
acr.receipt_date,
acrh.status receipt_status,
acr.amount,
acr.CC_ERROR_FLAG,
acr.CC_ERROR_CODE,
acr.CC_ERROR_TEXT,
summ.BEPMESSAGE,
summ.reqtype,
summ.status,
summ.currencynamecode,
summ.updatedate,
summ.reqdate,
summ.trxntypeid
from ar_cash_receipts_all acr,
ar_cash_receipt_history_all acrh,
ar_cash_receipts_v acrv,
apps.IBY_FNDCPT_TX_EXTENSIONS ifx,
iby_trxn_summaries_all summ,
hr_operating_units hou
,xxpp.cys_response cr
where
1=1
--and acr.cash_receipt_id=129718177
and acrh.cash_receipt_id=acr.cash_receipt_id
AND acrh.GL_DATE > SYSDATE -30
AND acrh.current_record_flag(+)='Y'
AND acrh.status='CONFIRMED'
AND acr.type='MISC'
and acrv.cash_receipt_id=acr.cash_receipt_id
and ifx.TRXN_EXTENSION_ID(+)=acr.PAYMENT_TRXN_EXTENSION_ID
and summ.tangibleid(+)=ifx.payment_system_order_number
and summ.reqtype(+)='ORAPMTRETURN'
and hou.organization_id=acr.org_id
and cr.order_id(+)=summ.tangibleid
and cr.decision(+)='ACCEPT'
and cr.action_id(+)=5
ORDER BY 1, 6

select bug_number,creation_date
from ad_bugs
where bug_number in
('26287764');
/
SELECT ad_patch.is_patch_applied('R12',-1,&patch_number) "IS PATCH ALREADY
APPLIED?"
from dual
/

--Check request run time in minutes


select ROUND((a.actual_completion_date-a.actual_start_date)*1440, 2)time_elapsed,
(select user_concurrent_program_name
from fnd_concurrent_programs_tl where
concurrent_program_id=a.concurrent_program_id)
from fnd_concurrent_requests a where a.requested_by=19528
and a.actual_start_date>sysdate-1/24;

--Autoinvoice Interface Lines Stats


select * from ra_interface_lines_all
where org_id = 102
and nvl(interface_status,'X') <> 'P'
select count(*), request_id, batch_source_name from ra_interface_lines_all
where org_id = 102
--and request_id in (187399151,187399150)--187387955
--and batch_source_name='Order Management'
and nvl(interface_status,'X') <> 'P' and creation_date>sysdate-1
group by request_id, batch_source_name;

--Check tax calls being made


select external_company_id,IS_AUDITED, count(1) from apps.sabrix_invoice
partition(SYS_P74564) --take latest partition name
where calling_system_number=222 and external_company_id in ('PP') group by
external_company_id, IS_AUDITED;

--GL Account Description


SELECT gcc.CONCATENATED_SEGMENTS,
gl_flexfields_pkg.get_concat_description( gcc.chart_of_accounts_id,
gcc.code_combination_id) acc_description
FROM gl_code_combinations_kfv gcc;

SHKBAG2011US03
------------------------------------------------------
--Query to check concurrent program from request ID
------------------------------------------------------
SELECT
distinct user_concurrent_program_name,
responsibility_name,
request_date,
argument_text,
request_id,
phase_code,
status_code,
logfile_name,
outfile_name,
output_file_type,
hold_flag,
user_name
FROM
fnd_concurrent_requests fcr,
fnd_concurrent_programs_tl fcp,
fnd_responsibility_tl fr,
fnd_user fu
WHERE
fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
and fcr.responsibility_id = fr.responsibility_id
and fcr.requested_by = fu.user_id
and fcp.concurrent_program_id=33734
--and user_concurrent_program_name in ('Active Users')
--and Phase_code='P'
--and fcr.request_id=<>
ORDER BY REQUEST_DATE DESC;

------------------------------------------------------
--Query to check SQL running in Request ID
------------------------------------------------------
SELECT C.sql_text
--c.sql_fulltext,
--C.module
FROM APPS.fnd_concurrent_requests A
,V$SESSION B
,v$sqltext C
WHERE A.oracle_session_id = B.audsid
AND B.sql_hash_value = C.hash_value
AND A.request_id =184816292
order by piece;

-----------------------------------------------------------------------------------
--------------------
-- Vindicia PSON Conversion
-----------------------------------------------------------------------------------
--------------------
/* Formatted on 9/8/2023 8:12:25 AM (QP5 v5.396) */
SELECT DISTINCT
order_number oracle_order_number,
reverse (SELECT_TRANSACTION_ID) merchant_order_number
FROM apps.xxpp_vindicia_bill_trx_stg
WHERE action_code = 'ORDER'
AND SELECT_TRANSACTION_ID IN
(reverse ('00719751YBB'),
reverse ('01699351YBB'),
reverse ('01699351YBB'),
reverse ('01699351YBB'),
)
ORDER BY reverse (SELECT_TRANSACTION_ID) ASC;

-----------------------------------------------------------------------------------
--------------------
-- Bank Alert Query
-----------------------------------------------------------------------------------
--------------------

--Alert Name: XXPP_AP_VENDOR_BANK_AUDIT_NEW


--Find Exceptions in History
SELECT
asp.segment1 vendor_num,
asp.vendor_name,
(SELECT NAME
FROM apps.hr_operating_units hou
WHERE 1=1
AND hou.organization_id = asa.org_id
) ou_name,
asa.vendor_site_code,
ieb.country_code,
cbbv.bank_name,

cbbv.bank_branch_name,
cbbv.branch_number,
cbbv.eft_swift_code,
xsbaa.OLD_MASKED_ACCT_NUM,
xsbaa.NEW_MASKED_ACCT_NUM,
xsbaa.old_masked_iban,
xsbaa.new_masked_iban,
xsbaa.user_action_type,
fu.user_name,
xsbaa.OLD_BANK_ACCOUNT_NUM,
xsbaa.NEW_BANK_ACCOUNT_NUM,
xsbaa.old_iban,
xsbaa.new_iban
FROM apps.iby_pmt_instr_uses_all instrument,
apps.iby_account_owners owners,
apps.iby_external_payees_all payees,
apps.iby_ext_bank_accounts ieb,
apps.ap_supplier_sites_all asa,
apps.ap_suppliers asp,
apps.ce_bank_branches_v cbbv,
apps.XXPP_SUPPLIER_BANK_ACCT_AUDIT xsbaa,
fnd_user fu
WHERE 1=1
AND TRUNC(xsbaa.update_date)>=TO_DATE('02/27/2024','MM/DD/YYYY')
--AND xsbaa.update_date >= sysdate-(1/1440*10)
AND ieb.ext_bank_account_id=xsbaa.ext_bank_account_id
AND owners.ext_bank_account_id = ieb.ext_bank_account_id
AND owners.ext_bank_account_id = instrument.instrument_id
AND payees.ext_payee_id = instrument.ext_pmt_party_id
AND payees.payee_party_id = owners.account_owner_party_id
AND payees.supplier_site_id = asa.vendor_site_id(+)
AND payees.payee_party_id = asp.party_id
AND cbbv.branch_party_id(+) = ieb.branch_id
AND xsbaa.NEW_BANK_id IS NOT NULL
AND xsbaa.new_branch_id IS NOT NULL
AND fu.user_id=xsbaa.updated_by;

-----------------------------------------------------------------------------------
--------------------
-- Concurrent Program Stats
-----------------------------------------------------------------------------------
--------------------

select user_concurrent_program_name, responsibility_name, fcr.requested_start_date,


(select user_name from fnd_user where user_id = fcr.requested_by) requested_by,
fcr.*
from fnd_concurrent_requests fcr, fnd_responsibility_tl fr,
fnd_concurrent_programs_vl fcpv
where 1=1
and fcr.responsibility_id = fr.responsibility_id
and fcr.concurrent_program_id = fcpv.concurrent_program_id
and upper(fcpv.user_concurrent_program_name) like ''
--and fcr.request_id in (203604708,203604669,203604575,203601217, 203599281);

-----------------------------------------------------------------------------------
--------------------
-- Cybersource Audit Table
-----------------------------------------------------------------------------------
--------------------
--xxpp_ords_cybersource_audit_tbl
--XXPP_CYBER_SOURCE_TRX_DATA

-----------------------------------------------------------------------------------
--------------------
-- GL to AR Receipt Drilldown Query
-----------------------------------------------------------------------------------
--------------------
C:\Users\tvedantham\OneDrive - BODi\Desktop\Tickets\GL to AR Receipt Drilldown
Query.sql

-----------------------------------------------------------------------------------
--------------------
-- Concur Tables
-----------------------------------------------------------------------------------
--------------------

XXPP_EMPEXP_GL_INTF_HDR

XXPP_EMPEXP_GL_INTF_LINE

0000190256.250105.d.B254.dfr

_1ji0ofqSiE_yK49v.ppd0

/Interfaces/PAYMENTTECH/DFR/inbound

https://beachbody.atlassian.net/browse/DBA-28511

You might also like