Search This Blog

Tuesday, January 3, 2012

To Check for the available onhand For An Item in a Given Organization Using Inv_Quantity_Tree_Pub API

/*To Check for the available onhand For An Item in a Given Organization Using Inv_Quantity_Tree_Pub API
Inv_Quantity_Tree_Pub API can be used for querying the available Onhand in a given subinventory or organization.
The output of the API inv_quantity_tree_pub.query_quantities will show the Total Available Onhand , Reservations , Suggestions and the Actual Onhand that can be Transacted.
*/
-- R12 - INV - Sample Script to Get Onhand Using INV_Quantity_Tree_PUB API:
DECLARE
l_api_return_status VARCHAR2 (1);
l_qty_oh NUMBER;
l_qty_res_oh NUMBER;
l_qty_res NUMBER;
l_qty_sug NUMBER;
l_qty_att NUMBER;
l_qty_atr NUMBER;
l_msg_count NUMBER;
l_msg_data VARCHAR2 (1000);
v_item VARCHAR2 (250) ;
v_org VARCHAR2 (10) ;
Cursor c_item_info is
SELECT concatenated_segments item, msi.inventory_item_id,msi.organization_id, mp.organization_code
FROM mtl_system_items_kfv msi, mtl_parameters mp
WHERE concatenated_segments = :v_item
AND msi.organization_id = mp.organization_id
AND mp.organization_code = :v_org;
BEGIN
inv_quantity_tree_grp.clear_quantity_cache;
DBMS_OUTPUT.put_line ('Transaction Mode');
For i in c_item_info
LOOP
DBMS_OUTPUT.put_line ('Extracting the Onhand For the Item ===========> ' i.item);
DBMS_OUTPUT.put_line ('Extracting the Onhand For the Organization ======> ' i.organization_code);
apps.inv_quantity_tree_pub.query_quantities
(p_api_version_number => 1.0,
p_init_msg_lst => apps.fnd_api.g_false,
x_return_status => l_api_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_organization_id => i.organization_id,
p_inventory_item_id => i.inventory_item_id,
p_tree_mode => apps.inv_quantity_tree_pub.g_transaction_mode,
p_onhand_source => 3,
p_is_revision_control => FALSE,
p_is_lot_control => FALSE,
p_is_serial_control => FALSE,
p_revision => NULL,
p_lot_number => NULL,
p_subinventory_code => NULL,
p_locator_id => NULL,
x_qoh => l_qty_oh,
x_rqoh => l_qty_res_oh,
x_qr => l_qty_res,
x_qs => l_qty_sug,
x_att => l_qty_att,
x_atr => l_qty_atr);
DBMS_OUTPUT.put_line ('Quantity on hand ======================> ' TO_CHAR (l_qty_oh));
DBMS_OUTPUT.put_line ('Reservable quantity on hand ===============> ' TO_CHAR (l_qty_res_oh));
DBMS_OUTPUT.put_line ('Quantity reserved =====================> ' TO_CHAR (l_qty_res));
DBMS_OUTPUT.put_line ('Quantity suggested ====================> ' TO_CHAR (l_qty_sug));
DBMS_OUTPUT.put_line ('Quantity Available To Transact ==============> ' TO_CHAR (l_qty_att));
DBMS_OUTPUT.put_line ('Quantity Available To Reserve ==============> ' TO_CHAR (l_qty_atr));
END LOOP;
END;
/*
DBMS OUTPUT:
Transaction Mode
Extracting the Onhand For the Item =========> ELXV350ELL121MH12D^NIPPONSCC
Extracting the Onhand For the Organization ====> A66
Quantity on hand =======================> 3400
Reservable quantity on hand ===============> 3400
Quantity reserved =======================> 1000
Quantity suggested ======================> 0
Quantity Available To Transact==============> 2400
Quantity Available To Reserve ==============> 2400*/

Monday, January 2, 2012

Employee Person View for Reports

CREATE OR REPLACE VIEW xx_hr_user_person (user_id,
user_name,
person_id,
employee_number,
full_name,
email_address
)
AS
SELECT fu.user_id, fu.user_name, papf.person_id, papf.employee_number,
papf.full_name, papf.email_address
FROM per_all_people_f papf, fnd_user fu
WHERE papf.person_id = fu.employee_id
AND TRUNC (SYSDATE) BETWEEN papf.effective_start_date
AND papf.effective_end_date

Wednesday, December 28, 2011

Oracle Payroll Run Results Discoverer Report

  SELECT    'Period=>'
          || period_name
          || ': Payroll Action ID =>'
          || ppa.payroll_action_id
          || ': Consolidation Set =>'
          || con_set.consolidation_set_name
          || ': Run Date => '
          || ppa.creation_date pay_action,
          pbg.NAME business_group, papf.business_group_id,
          papf.employee_number || ':' || papf.full_name employee,
          papf.employee_number emp_no, papf.full_name emp_name,
          papf.start_date hiredate, hou.NAME org_name, pp.NAME pos_name,
          paaf.assignment_id assignment_id, paa.assignment_action_id,
          ppa.payroll_action_id, ppa.time_period_id, ppa.action_type,
          ppa.effective_date, ppa.payroll_id, ppf.payroll_name,
          ptp.period_name, ptp.end_date, papf.start_date commencement_date,
          petf.element_name, pec.classification_name,
          DECODE (pec.classification_name,
                  'Voluntary Deductions', -TO_NUMBER (prrv.result_value),
                  TO_NUMBER (prrv.result_value)
                 ) result_value,
          ppg.segment1 power_retailer, ppg.segment2 petty_cash_holder,
          ppg.segment3 direct_indirect
     FROM per_all_people_f papf,
          per_all_assignments_f paaf,
          pay_people_groups ppg,
          hr_all_organization_units hou,
          per_positions pp,
          pay_assignment_actions paa,
          pay_payroll_actions ppa,
          per_time_periods ptp,
          pay_run_results prr,
          pay_element_types_f petf,
          pay_input_values_f pivf,
          pay_run_result_values prrv,
          pay_element_classifications pec,
          per_business_groups pbg,
          pay_payrolls_f ppf,
          pay_consolidation_sets con_set
    WHERE ppa.effective_date BETWEEN papf.effective_start_date
                                 AND papf.effective_end_date
      AND papf.person_id = paaf.person_id
      AND paaf.primary_flag = 'Y'
      AND ppa.effective_date BETWEEN paaf.effective_start_date
                                 AND paaf.effective_end_date
      AND paaf.people_group_id = ppg.people_group_id
      AND paaf.organization_id = hou.organization_id
      AND paaf.position_id = pp.position_id(+)
      AND paaf.assignment_id = paa.assignment_id
      AND paa.payroll_action_id = ppa.payroll_action_id
      AND ppa.action_status = 'C'
      AND ppa.payroll_id = paaf.payroll_id
      AND ppa.time_period_id = ptp.time_period_id
      AND ppa.payroll_id = ptp.payroll_id
      AND paa.assignment_action_id = prr.assignment_action_id
      AND prr.element_type_id = petf.element_type_id
      AND petf.element_type_id = pivf.element_type_id
      AND pivf.input_value_id = prrv.input_value_id
      AND prrv.run_result_id = prr.run_result_id
      AND ptp.end_date BETWEEN petf.effective_start_date
                           AND petf.effective_end_date
      AND ptp.end_date BETWEEN pivf.effective_start_date
                           AND pivf.effective_end_date
      AND petf.classification_id = pec.classification_id
      AND pec.classification_name IN
             ('Earnings', 'Voluntary Deductions', 'Social Insurance',
              'Involuntary Deductions', 'Information')
      AND pivf.NAME = 'Pay Value'
      AND prrv.result_value IS NOT NULL
      AND papf.business_group_id = pbg.business_group_id
      AND ppf.payroll_id = ppa.payroll_id
      AND ppa.consolidation_set_id = con_set.consolidation_set_id;

Tuesday, December 27, 2011

Oracle Organization Hierarchy Query

SELECT
LPAD(' ',10*(LEVEL-1)) || org.name hierarchy,
org.organization_id
FROM
hr_all_organization_units org,
per_org_structure_elements pose
WHERE 1=1
AND porg.organization_id = pose.organization_id_child
AND pose.org_structure_version_id = 61
--and org.name  like '201.Financiale Services'
START WITH
pose.organization_id_parent = 115   -- Orgnization of parent id -- provide the id from which level the downward hierarchy should be displaed
CONNECT BY PRIOR
pose.organization_id_child = pose.organization_id_parent
ORDER SIBLINGS BY
org.location_id,
pose.organization_id_child

Sunday, December 18, 2011

How To Default the Allow Account To Be Searched Check Box to be Checked

Goal

How does you check the Allow Account To Be Searched check box by default and furthermore hide the check box so that no one can change the setting?

Solution

Solution

To implement the solution, please execute the following steps:

1. Ensure that you do not have any personalizations attempting to default the 'Initial Value'
for the 'Allow Account to be Searched' check box.
2. Log into System Administrator.
3. Navigate to Profile > System.
4. Select the responsibility that this is not working in.
5. In the profile region, type in IRC: Visible Preference Default.
6. In the responsibility column, set this to 'Yes.'
7. Save and test.

Thursday, December 15, 2011

Not all rows have been retrieved.Data may be inaccurate Oracle Discoverer

Scenario: I have 12500 records in my table..when using disco, when am fetching all the records it is always displaying only 10,000 records.. and it displays the a/m subjected error and displays only 10k rows..

Solution:
In Discoverer Desktop, Tools -> Options -> Uncheck Limit Retrived Data to.

Test the worksheet. It should work.

Cheeerssss...

Wednesday, December 14, 2011

Master Inventory Items with Category and Sub Category Details

CREATE OR REPLACE FORCE VIEW xx_mtl_master_items_v (organization_id,
                                                         inventory_item_id,
                                                         item_code,
                                                         description,
                                                         item_type,
                                                         category_set_id,
                                                         category_id,
                                                         structure_id,
                                                         CATEGORY,
                                                         sub_category
                                                        )
AS
   SELECT DISTINCT msib.organization_id, msib.inventory_item_id,
                   msib.segment1 item_code, msib.description, msib.item_type,
                   mic.category_set_id, mic.category_id, mcs.structure_id,
                   mc.segment1 CATEGORY, mc.segment2 sub_category
              FROM mtl_system_items_b msib,
                   mtl_parameters mp,
                   org_organization_definitions ood,
                   mtl_item_categories mic,
                   mtl_categories mc,
                   mtl_category_sets mcs
             WHERE msib.organization_id = mp.master_organization_id
               AND mp.organization_id = ood.organization_id
               AND mp.master_organization_id = mp.organization_id
               AND mic.category_id = mc.category_id
               AND mp.organization_id = mic.organization_id
               AND msib.inventory_item_id = mic.inventory_item_id
               AND mic.category_set_id = mcs.category_set_id
               AND mcs.structure_id = mc.structure_id;