Queries1 SQL
Queries1 SQL
);
--
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
--
BBadmin_PW.epw
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;
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;
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
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
-----------------------------
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';
--Logs
--eBTax%Debug%
/
--Unaccounted AR Transactions
--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 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
/
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
-----------------------------------------------------------------------------------
--------------------
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
-----------------------------------------------------------------------------------
--------------------
-----------------------------------------------------------------------------------
--------------------
-- 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