Monday, 5 August 2019

Oracle WMS Exception Report

This query is for finding the users who has raised the exception while completing a task.


SELECT oodt.organization_code,
       milt.subinventory_code,
       milt.concatenated_segments,
       msit.segment1 item_number,
       mtr.reason_name,
       ppf.full_name
  FROM apps.wms_exceptions we,
       apps.mtl_item_locations_kfv milt,
       apps.org_organization_definitions oodt,
       apps.mtl_system_items_b msit,
       apps.mtl_transaction_reasons mtr,
       per_people_f ppf
 WHERE     1 = 1
       AND ppf.person_id = we.person_id
       AND ppf.effective_end_date > SYSDATE
       AND mtr.reason_id = we.reason_id
       AND msit.inventory_item_id = we.inventory_item_id
       AND msit.organization_id = we.organization_id
       AND oodt.organization_id = we.organization_id
       AND we.creation_date LIKE SYSDATE
       AND milt.organization_id = we.organization_id
       AND milt.subinventory_code = we.subinventory_code
       AND milt.inventory_location_id = we.inventory_location_id
       AND oodt.organization_code = :organization_code
       AND mtr.reason_name IN ('ZERO PICK',
                               'PARTIAL PICK',
                               'LOC BLOCKED',
                               'END PICK')
ORDER BY full_name, 3;

Tuesday, 30 July 2019

HR: Query for HR Assignment Form

This query is for Person information regarding his assignment.  
Navigation
Human Resource-> HR-> People-> Enter and Maintain-> More-> Assignment


  SELECT ppf.full_name,
         pap.name position_name,
         pj.name job_name,
         psf.full_name supervisor_name,
         assignment_number,
         gcct.concatenated_segments,
         pbg.name business_group,
         gsb.name ledger_name
    FROM per_assignments_f paf,
         per_people_f ppf,
         per_jobs pj,
         per_all_positions pap,
         per_people_f psf,
         apps.gl_code_combinations_kfv gcct,
         per_business_groups pbg,
         gl_sets_of_books gsb
   WHERE     1 = 1
         AND ppf.person_id = paf.person_id
         AND pj.job_id = paf.job_id
         AND pap.position_id = paf.position_id
         AND psf.person_id = paf.supervisor_id
         AND paf.default_code_comb_id = gcct.code_combination_id
         AND pbg.business_group_id = paf.business_group_id
         AND paf.effective_end_date > SYSDATE
         AND ppf.effective_end_date > SYSDATE
         AND psf.effective_end_date > SYSDATE
         AND gsb.set_of_books_id = paf.set_of_books_id
ORDER BY 1;

Wednesday, 3 July 2019

Query: RA Transaction Type Form Query

This query is for RA Transaction Type form. 
Navigation
Receivables-> Setup-> Transactions-> Transaction Types



 
SELECT haout.name operating_unit,
xep.name legal_entity,
rctt.name,
rctt.description,
tt_class.meaning class,
tt_sign.meaning creation_sign,
tt_its.meaning transaction_status,
tt_ipo.meaning printing_option,
inv_type.name invoice_type,
credit_type.name credit_memo_type,
aars.description application_rule_set,
rtv.name terms,
rctt.start_date,
rctt.end_date,
rctt.accounting_affect_flag open_receivable,
NVL (rctt.adj_post_to_gl, 'N') allow_adjustment_posting,
rctt.post_to_gl,
rctt.allow_freight_flag,
rctt.natural_application_only_flag natural_application_only,
rctt.tax_calculation_flag default_tax_classification,
rctt.exclude_from_late_charges exclude_from_late_charges,
rctt.allow_overapplication_flag,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_rec)
receivable_account,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_freight)
freight_account,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_rev)
revenue_account,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_clearing)
clearning_account,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_unbilled)
unbilled_account,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_unearned)
unearned_account,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_tax)
tax_account,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_unpaid_rec)
unpaid_bills_receivable,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_remittance)
remitted_bill_receivable,
(SELECT concatenated_segments
FROM apps.gl_code_combinations_kfv gcct
WHERE 1 = 1 AND gcct.code_combination_id = rctt.gl_id_factor)
factored_bills_receivable,
rctt.signed_flag,
rctt.drawee_issued_flag,
app.friendly_name format_program_name,
DECODE (rctt.allocate_tax_freight,
'Y', 'Lines, Tax and Freight',
'Lines Only')
allocation_basis
FROM apps.hr_all_organization_units haout,
fnd_lookup_values_vl tt_class,
fnd_lookup_values_vl tt_sign,
fnd_lookup_values_vl tt_its,
fnd_lookup_values_vl tt_ipo,
ra_cust_trx_types_all inv_type,
ra_cust_trx_types_all credit_type,
ra_terms_vl rtv,
xle_entity_profiles xep,
ar_app_rule_sets aars,
ap_payment_programs app,
ra_cust_trx_types_all rctt
WHERE     1 = 1
AND rctt.legal_entity_id = xep.legal_entity_id(+)
AND rctt.format_program_id = app.program_id(+)
AND tt_class.lookup_type IN ('INV/CM')
AND tt_class.lookup_code = rctt.TYPE
AND tt_sign.lookup_type IN ('SIGN')
AND tt_sign.lookup_code = rctt.creation_sign
AND tt_its.lookup_type IN ('INVOICE_TRX_STATUS')
AND tt_its.lookup_code = rctt.default_status
AND tt_ipo.lookup_type IN ('INVOICE_PRINT_OPTIONS')
AND tt_ipo.lookup_code = rctt.default_printing_option
AND rctt.subsequent_trx_type_id = inv_type.cust_trx_type_id(+)
AND rctt.org_id = inv_type.org_id(+)
AND rctt.credit_memo_type_id = credit_type.cust_trx_type_id(+)
AND rctt.org_id = credit_type.org_id(+)
AND rctt.default_term = rtv.term_id(+)
AND rctt.rule_set_id = aars.rule_set_id(+)
AND rctt.org_id = haout.organization_id
ORDER BY 1;

Sunday, 13 July 2014

Query: Oracle Employee Supervisor Hierarchy

This Query is about linking Employee record to their immediate Supervisor and their Supervisor's. This come handy mostly in the case of Workflow Approval process where we have to see who this notification should be going for approval.


SELECT LEVEL, a.*
FROM (SELECT a.full_name employee_name,
supervisor_id,
c.full_name supervisor_name
FROM per_people_f a, per_assignments_f b, per_people_f c
WHERE 1 = 1
AND a.effective_end_date > SYSDATE
AND c.effective_end_date > SYSDATE
AND a.person_id = b.person_id
AND b.effective_end_date > SYSDATE
AND c.person_id = b.supervisor_id) a
START WITH employee_name LIKE '%' || :employee_name || '%'
CONNECT BY PRIOR supervisor_name = employee_name
ORDER BY 1


Thursday, 3 July 2014

Query: Link Between PO and Requisition

This Query is a link between PO Requisition and Purchase Order. It will the list of all those PO's which are created via Requisition.
 SELECT prh.segment1 pr_number,  
  ph.segment1 po_number,  
  ph.comments po_comments,  
  ph.ship_to_location_id,  
  ph.bill_to_location_id,  
  ph.terms_id,  
  ph.currency_code,  
  ph.revision_num,  
  he.full_name buyer,  
  ph.type_lookup_code po_document_type,  
  prh.description pr_description,  
  prh.authorization_status pr_status,  
  prh.type_lookup_code,  
  prl.line_num req_line_num,  
  pl.line_num,  
  pll.shipment_num,  
  msi.segment1 item_name,  
  mc.segment1 || '.' || mc.segment2 category_code,  
  prl.destination_context,  
  prl.suggested_vendor_name,  
  oodt.organization_code receving_org,  
  prl.need_by_date,  
  gcct.segment1  
  || '.'  
  || gcct.segment2  
  || '.'  
  || gcct.segment3  
  || '.'  
  || gcct.segment4  
  || '.'  
  || gcct.segment5  
  || '.'  
  || gcct.segment6  
  || '.'  
  || gcct.segment7  
  || '.'  
  || gcct.segment8 gl_code_combination,  
  prl.quantity req_qty,  
  prl.unit_price,  
  pl.unit_price,  
  pl.list_price_per_unit,  
  pl.unit_meas_lookup_code uom,  
  pd.quantity_ordered po_qty,  
  pd.quantity_delivered,  
  pd.quantity_billed,  
  pd.quantity_cancelled,  
  pd.amount_billed,  
  pd.amount_delivered,  
  pd.amount_cancelled,  
  pll.taxable_flag,  
  ph.closed_code po_status,  
  pl.closed_code line_status,  
  pll.closed_code line_location_status,  
  prl.destination_context  
  FROM po_requisition_headers prh,  
  po_requisition_lines prl,  
  po_req_distributions prd,  
  gl_code_combinations gcct,  
  po_distributions pd,  
  po_line_locations pll,  
  po_headers ph,  
  po_lines pl,  
  mtl_system_items_b msi,  
  org_organization_definitions oodt,  
  mtl_categories mc,  
  hr_employees he  
  WHERE 1 = 1  
  AND prh.requisition_header_id = prl.requisition_header_id  
  AND prd.requisition_line_id = prl.requisition_line_id  
  AND pd.req_distribution_id(+) = prd.distribution_id  
  AND ph.po_header_id = pl.po_header_id  
  AND pl.po_line_id = pll.po_line_id  
  AND pl.po_header_id = pll.po_header_id  
  AND pd.po_header_id = ph.po_header_id  
  AND pd.po_line_id = pl.po_line_id  
  AND pd.line_location_id = pll.line_location_id  
  AND msi.inventory_item_id(+) = prl.item_id  
  AND msi.organization_id(+) = prl.destination_organization_id  
  AND oodt.organization_id = prl.destination_organization_id  
  AND gcct.code_combination_id = prd.code_combination_id  
  AND prl.category_id = mc.category_id  
  AND prh.segment1 = NVL (:requisition_name, prh.segment1)  
  AND he.employee_id = ph.agent_id  
  AND ph.segment1 = NVL (:po_number, ph.segment1)  
  AND prh.type_lookup_code ='PURCHASE'  
  AND ph.authorization_status =  
  DECODE (:po_authorization_status,  
  'A', 'APPROVED',  
  'R', 'REQUIRES REAPPROVAL',  
  'P', 'IN PROCESS',  
  'I', 'INCOMPLETE',  
  'X', 'REJECTED',  
  ph.authorization_status  
  )  
  AND prh.authorization_status =  
  DECODE (:pr_status,  
  'A', 'APPROVED',  
  'P', 'IN PROCESS',  
  'I', 'INCOMPLETE',  
  prh.authorization_status  
  )  
  AND prl.destination_context =  
  DECODE (:req_line_type,  
  'I', 'INVENTORY',  
  'E', 'EXPENSE',  
  prl.destination_context  
  )  
  AND NVL (ph.closed_code, 'OPEN') =  
  DECODE (:po_status,  
  'O', 'OPEN',  
  'C', 'CLOSED',  
  'F', 'FINALLY CLOSED',  
  NVL (ph.closed_code, 'OPEN')  
  )  
  AND NVL (pl.closed_code, 'OPEN') =  
  DECODE (:line_status,  
  'O', 'OPEN',  
  'C', 'CLOSED',  
  'F', 'FINALLY CLOSED',  
  NVL (pl.closed_code, 'OPEN')  
  )  
  AND NVL (pll.closed_code, 'OPEN') =  
  DECODE (:line_location_status,  
  'O', 'OPEN',  
  'C', 'CLOSED',  
  'F', 'FINALLY CLOSED',  
  NVL (pll.closed_code, 'OPEN')  
  )  
  AND prh.creation_date > SYSDATE - NVL (:months, 12) * 30  
 ORDER BY prh.segment1, prl.line_num, pl.line_num, pll.shipment_num