8 Replies Latest reply: Dec 1, 2012 1:01 AM by NEWHCM RSS

    Manager Self Service Absence Management

    NEWHCM
      Dear Gurus,
      I have one problem in Manager Self Service Absence Management.

      Here is the requirements:

      I have define a AME rule for HR_LOA_JSP_PRC for employee condition: HR_POSITION_LEVEL : Require approvals up to first position

      When an employee 'X ' creates an absence it goes to his reporting Manager 'Y' which is correct.
      but when a manager creates an absence on behalf of his employee . it goes to reporting manager of 'Y'. which is not needed. It will approve automatically & stop right there.

      please can anyone help me regarding this.

      ex: position hierarchy look likes this

      Employee (IT Engineer) --> reports to (IT Manager) --> reports to (CEO)

      When IT Engineer creates an absence request , it goes to IT Manager for approval which is correct according to AME rule.

      But when IT Manager creates an absence for his employee (behalf) (IT Engineer) It is going to CEO for approval. which i don't want to. I need the absence will approved automatically & stop. when IT Manager creates absence behalf of his employee (IT Engineer).

      but When IT Manager creates his own absence then it will goes to CEO for approval but not for his employee (IT Engineer).


      This will implement in oracle R12.1.2


      Hope you understand my requirements.

      Your solution will be highly appreciated.

      Thank You

      Shariff
        • 1. Re: Manager Self Service Absence Management
          Ayaz
          Hi,

          In ur case approval hierarchy is using the person_id of a person who is initiating the request, what you want is to get the person_id of a person who is selected for the transaction.

          Unfortunately, the seeded AME rules picks up initiator person_id and not the selected person_id (engineer in ur case).

          To resolve this, make ur own AME rule and condition as per ur requirement.

          Regards
          Ayaz
          • 2. Re: Manager Self Service Absence Management
            NEWHCM
            Hi,
            Thanks for reply.. Can u just provide the query for this..

            Thanks & regards
            Mohsin
            • 3. Re: Manager Self Service Absence Management
              Avinash
              Hi,

              Query should look like this:---


              select paaf.supervisor_id
              from apps.per_all_people_f papf
              , apps.per_all_assignments_f paaf
              ,apps.hr_api_transactions hat
              where hat.transaction_id = :Transaction_id
              and hat.selected_person_id = papf.person_id
              and papf.person_id = paaf.person_id
              and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
              and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date


              Thanks,
              Avinash
              • 4. Re: Manager Self Service Absence Management
                akr1967
                Hi,

                You can use this function to get selected user id:

                Please find the required fucntion to be added to our database:



                CREATE OR REPLACE FUNCTION TYR_GET_SUPERVISOR(p_transaction_id IN NUMBER
                )
                /---Returns the person_id of the head of department------/
                RETURN VARCHAR2
                AS
                L_person_id NUMBER(10);
                L_selected_person_id hr_api_transactions.selected_person_id%TYPE;
                L_creator_person_id hr_api_transactions.creator_person_id%TYPE;
                l_business_group_id NUMBER;
                BEGIN
                fnd_profile.get ('PER_BUSINESS_GROUP_ID', l_business_group_id);
                BEGIN
                SELECT selected_person_id,creator_person_id
                INTO L_selected_person_id,L_creator_person_id
                FROM hr_api_transactions
                WHERE transaction_id = p_transaction_id;
                EXCEPTION
                WHEN OTHERS THEN
                RETURN NULL;
                END;

                BEGIN

                SELECT paaf.supervisor_id
                INTO l_person_id
                FROM per_all_people_f papf,
                per_all_assignments_f paaf
                WHERE papf.person_id=paaf.person_id
                and papf.person_id=l_selected_person_id
                AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
                AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date;

                EXCEPTION
                WHEN NO_DATA_FOUND THEN
                l_person_id :=null;
                END;
                IF (L_selected_person_id = L_person_id) OR (l_creator_person_id = l_person_id) THEN
                RETURN NULL;
                ELSE
                RETURN 'PER:'||to_char(L_person_id);
                END IF;
                EXCEPTION
                WHEN OTHERS THEN
                RETURN NULL;
                END TYR_GET_SUPERVISOR;


                Then You can use it like this directly as a dynamic query in approvers group:

                SELECT TYR_GET_SUPERVISOR(:transactionId) FROM DUAL


                BR
                Akram
                • 5. Re: Manager Self Service Absence Management
                  NEWHCM
                  Thank You very much. But I'm not using supervisor hierarchy and assigning any supervisor to any employee,
                  i'm using position hierarchy in AME Rule.then how will i get this.

                  Edited by: NEWHCM on Nov 21, 2012 4:37 PM
                  • 6. Re: Manager Self Service Absence Management
                    NEWHCM
                    I need Position Hieararchy. Not Supervisor hierarchy
                    • 7. Re: Manager Self Service Absence Management
                      892288
                      Try with the below query , u need position id'd , so this query must survive ur purpose

                      SELECT pse.parent_position_id parent_position_id,
                      pse.subordinate_position_id position_id,
                      LEVEL hier_level
                      FROM per_pos_structure_elements pse
                      START WITH pse.parent_position_id = :p_1
                      AND pse.pos_structure_version_id =
                      (SELECT psv.pos_structure_version_id
                      FROM per_pos_structure_versions psv,
                      per_position_structures pps
                      WHERE pps.position_structure_id =
                      psv.position_structure_id
                      AND NVL (pps.primary_position_flag, 'N') = 'Y'
                      AND pps.business_group_id = :p_2
                      AND TRUNC (SYSDATE) BETWEEN psv.date_from
                      AND NVL (
                      psv.date_to,
                      TRUNC (SYSDATE)
                      ))
                      CONNECT BY parent_position_id = PRIOR subordinate_position_id
                      AND pse.pos_structure_version_id =
                      (SELECT psv.pos_structure_version_id
                      FROM per_pos_structure_versions psv,
                      per_position_structures pps
                      WHERE pps.position_structure_id =
                      psv.position_structure_id
                      AND NVL (pps.primary_position_flag, 'N') = 'Y'
                      AND pps.business_group_id = :p_2
                      AND TRUNC (SYSDATE) BETWEEN psv.date_from
                      AND NVL (
                      psv.date_to,
                      TRUNC (SYSDATE)
                      ))