Thursday, 27 June 2019

Query to get project details in oracle apps

SELECT ppa.segment1              "Project Number", 
       ppa.name                  "Project Name", 
       pt.task_name              "Task Name", 
       pei.expenditure_type      "Expenditure Type", 
       pei.expenditure_item_date "Expenditure Item Date", 
       pv.amount                 "Amount", 
       gcc1.concatenated_segments "Credit Account", 
       gcc2.concatenated_segments "Debit Account" 
FROM   pa_projects_all ppa, 
       pa_tasks pt, 
       pa_expenditure_items_all pei, 
       pa_cost_distribution_lines_all pv, 
       gl_code_combinations_kfv gcc1, 
       gl_code_combinations_kfv gcc2, 
       hr_organization_units hr 
WHERE  1 = 1
       AND ppa.project_id = pt.project_id 
       AND ppa.project_id = pv.project_id 
       AND pv.task_id = pt.task_id 
       AND pei.expenditure_item_id = pv.expenditure_item_id 
       AND ppa.project_id = pei.project_id 
       AND pt.task_id = pei.task_id 
       AND pv.cr_code_combination_id = gcc1.code_combination_id 
       AND pv.dr_code_combination_id = gcc2.code_combination_id 
       AND ppa.carrying_out_organization_id = hr.organization_id;

Tuesday, 18 June 2019

Query to Find System Cost Calculation Of Inventory Items In Oracle Apps R12

SELECT msi.segment1                                       item_code, 
       msi.organization_id                                org, 
       (SELECT name 
        FROM   hr_organization_units hou 
        WHERE  hou.organization_id = msi.organization_id) organization_name, 
       transaction_costed_date, 
       transaction_date, 
       primary_quantity, 
       actual_cost, 
       new_quantity, 
       new_cost, 
       prior_costed_quantity, 
       prior_cost, 
       transaction_type, 
       cost_group_id, 
       actual_material_overhead, 
       actual_resource, 
       actual_outside_processing, 
       actual_overhead, 
       new_material, 
       new_material_overhead, 
       new_resource, 
       new_outside_processing, 
       new_overhead, 
       prior_material, 
       prior_material_overhead, 
       prior_resource, 
       prior_outside_processing, 
       prior_overhead 
FROM   cst_cg_cost_history_v xx, 
       mtl_system_items_b msi, 
       mtl_parameters mt 
WHERE  xx.inventory_item_id = msi.inventory_item_id 
       AND xx.organization_id = msi.organization_id 
       AND xx.organization_id = mt.organization_id 
       AND xx.cost_group_id = mt.default_cost_group_id 
       AND msi.organization_id = <<Inventory_Organization_ID>>
       AND xx.inventory_item_id IN ( <<List_Of_Inventory_Item_IDs>> )
       AND transaction_date >= To_date ('2018/04/01 00:00:00', 
                               'YYYY/MM/DD HH24:MI:SS') 
       AND transaction_date <= To_date ('2019/03/31 23:59:59', 
                               'YYYY/MM/DD HH24:MI:SS'); 

Query to Find List Of Those Suppliers For Those We Didn't Create MRN/GRN SInce Given Date

SELECT segment1    Supplier_Number, 
       vendor_name Supplier_Name 
FROM   ap_suppliers a, 
       (SELECT vendor_id 
        FROM   rcv_transactions 
        WHERE  transaction_type = 'RECEIVE' 
               AND transaction_date > '01-APR-2018' 
        GROUP  BY vendor_id) b 
WHERE  a.vendor_id = b.vendor_id(+) 
       AND b.vendor_id IS NULL 
       AND Nvl (a.enabled_flag, 'Y') = 'Y' 
       AND end_date_active IS NULL; 

--Query to Verify Output 
SELECT * 
FROM   rcv_shipment_headers 
WHERE  creation_date >= To_date ('2018/04/01 00:00:00', 'YYYY/MM/DD HH24:MI:SS') 
       AND vendor_id IN (SELECT a.vendor_id 
                         FROM   ap_suppliers a, 
                                (SELECT vendor_id 
                                 FROM   rcv_transactions 
                                 WHERE  transaction_type = 'RECEIVE' 
                                        AND transaction_date > '01-APR-2018' 
                                 GROUP  BY vendor_id) b 
                         WHERE  a.vendor_id = b.vendor_id(+) 
                                AND b.vendor_id IS NULL 
                                AND Nvl (a.enabled_flag, 'Y') = 'Y' 
                                AND end_date_active IS NULL);