Total Pageviews

Search This Blog

Wednesday, February 19, 2014

Approval in OTL (Oracle Time and Labor)

>Approval in OTL, 1) Created or modify existing fast formula, And create Time Entry Rules, OTL Application Developer => Time Entry Rules
2) Now Create Approval Style, OTL Application Developer => Approval => Approval Style
Formulas, Approver Finder Formulas, OA Custom OTL Time Entry Approval for Line Manager /* ****************************************************************** Formula Name : HXC_OVERRIDE_APPROVER_WF_PERSON Description : Implement approval workflow person Contexts : None Explanation : Formula gets the override approver based on the timecard id and ovn. Change History: Date Author Comments ------------ -------------- ------------------------------------ */ /***************************************************************** Initialise Variables which can be null ******************************************************************/ default for formula_status is 'S' default for formula_message is 'NO MESSAGE' /* ****************************************************************** READ IN INPUT VARIABLES ****************************************************************** */ INPUTS ARE timecard_bb_id (number) , timecard_bb_ovn (number) , application_period_bb_id (number) , application_period_bb_ovn (number) , time_recipient_id (number) , resource_id (number) , resource_type (text) /* **************************************************************** Processing **************************************************************** */ approval_mechanism = 'PERSON' approval_mechanism_id = XXTEST_GET_LINEMGR_ID ( resource_id,timecard_bb_id, timecard_bb_ovn ) /* **************************************************************** RETURN VARIABLE **************************************************************** */ RETURN approval_mechanism , approval_mechanism_id , formula_status , formula_message OA Custom OTL Time Entry Approval for TK /* ****************************************************************** Formula Name : HXC_OVERRIDE_APPROVER_WF_PERSON Description : Implement approval workflow person Contexts : None Explanation : Formula gets the override approver based on the timecard id and ovn. Change History: Date Author Comments ------------ -------------- ------------------------------------ */ /***************************************************************** Initialise Variables which can be null ******************************************************************/ default for formula_status is 'S' default for formula_message is 'NO MESSAGE' /* ****************************************************************** READ IN INPUT VARIABLES ****************************************************************** */ INPUTS ARE timecard_bb_id (number) , timecard_bb_ovn (number) , application_period_bb_id (number) , application_period_bb_ovn (number) , time_recipient_id (number) , resource_id (number) , resource_type (text) /* **************************************************************** Processing **************************************************************** */ approval_mechanism = 'PERSON' approval_mechanism_id = XXTEST_GET_TIMEKEEPER_ID ( resource_id,timecard_bb_id, timecard_bb_ovn ) /* **************************************************************** RETURN VARIABLE **************************************************************** */ RETURN approval_mechanism , approval_mechanism_id , formula_status , formula_message Time Entry Rule Fast Formula, OA Approval - approval maximum test (Custom) /******************************************************************* Formula Name : HXC_APPROVAL_MAXIMUM Description : Implements simple hours test for approvals Contexts : None Explanation : The formula is passed a resource id, period start and period end and maximum hours. Period start and end are the application period start and end dates. If the maximum hours is less than the number of hours over the period specified then the formula returns TO APPROVE equal to Y to initiate the approval process *********************************************************************/ /* Change History: Date Author Comments ------------ -------------- ------------------------------------ 04-Nov-2013 Sameer Patil */ /***************************************************************** Initialise Variables which can be null ******************************************************************/ default for db_pre_period_start is ' ' default for db_pre_period_end is ' ' default for db_post_period_start is ' ' default for db_post_period_end is ' ' default for db_ref_period_start is ' ' default for db_ref_period_end is ' ' default for reference_period is 1 default for duration_in_days is 1 default for period is 1 default for timecard_hrs is 0 default for period_maximum is 0 /* ****************************************************************** READ IN INPUT VARIABLES ****************************************************************** */ INPUTS ARE resource_id (number) , submission_date (text) , period (number) , period_maximum (number) , reference_period (number) , db_pre_period_start (text) , db_pre_period_end (text) , db_post_period_start (text) , db_post_period_end (text) , db_ref_period_start (text) , db_ref_period_end (text) , duration_in_days (number) , timecard_hrs (number) /* **************************************************************** Processing **************************************************************** */ IF ( xxtest_period_max (resource_id, submission_date, period_maximum, period, reference_period, db_pre_period_start, db_pre_period_end, db_post_period_start, db_post_period_end, db_ref_period_start, db_ref_period_end, duration_in_days, timecard_hrs ) = 1 ) THEN to_approve = 'Y' ELSE to_approve = 'N' /* **************************************************************** RETURN VARIABLE **************************************************************** */ RETURN to_approve "Team Work" More We Less Me.

Tuesday, October 22, 2013

Not able to change the password for user – Oracle Apps
Solution: System Administrator => Profile => System => At user level query for Applications SSO Login Types profile => Change the value from SSO to Both => Save => Retest
"Team Work" More We Less Me.

Sunday, October 13, 2013

Pseudo code - Batch Element Entry Process From Backend

      IF l_msg <> 'E' AND retcode <> 2
      THEN
         fnd_file.put_line (fnd_file.LOG, 'Creating Batch Header : ');

         BEGIN
            pay_batch_element_entry_api.create_batch_header
               (p_session_date               => TRUNC (SYSDATE),
                p_batch_name                 => l_batch_name,
                p_business_group_id          => fnd_profile.VALUE
                                                      ('PER_BUSINESS_GROUP_ID'),
                p_action_if_exists           => 'I',
                p_batch_id                   => l_batch_id,
                p_object_version_number      => l_object_version_number
               );
            COMMIT;
         EXCEPTION
            WHEN OTHERS
            THEN
               retcode := 2;
               fnd_file.put_line
                  (fnd_file.LOG,
                      'Error while creating Batch header.Please contact your support administrator. - '
                   || SQLERRM
                  );
               l_msg := 'E';
         END;
      END IF;

      fnd_file.put_line (fnd_file.LOG,
                            'Location 2 l_msg  : '
                         || l_msg
                         || ' Retcode '
                         || retcode
                        );
      fnd_file.put_line (fnd_file.LOG,
                            'Batch Header Created, Batch id : '
                         || l_batch_id
                         || ' OVN '
                         || l_object_version_number
                        );
      v_batch_id := l_batch_id;
      v_object_version_number := l_object_version_number;

      IF l_msg <> 'E' AND retcode <> 2
      THEN
         fnd_file.put_line (fnd_file.LOG, 'Creating Batch Lines: ');

         BEGIN
            FOR i IN
               csr_get_ot_off_data
                            (p_sbu,
                             p_dept,
                             p_sect,
                             p_tk_group_id,
                             p_person_id,
                             TRUNC (fnd_date.canonical_to_date (p_start_date)),
                             TRUNC (fnd_date.canonical_to_date (p_end_date))
                            )
            LOOP
               fnd_file.put_line (fnd_file.LOG,
                                     'Creating Batch For : '
                                  || i.assignment_number
                                 );
               l_count := l_count + 1;

               BEGIN
                  pay_batch_element_entry_api.create_batch_line
                     (p_session_date               => TRUNC (SYSDATE),
                      p_batch_id                   => v_batch_id,
                      p_assignment_id              => i.assignment_id,
                      p_assignment_number          => i.assignment_number,
                      p_date_earned                => i.punch_date,
                      p_effective_date             => i.punch_date,
                      p_effective_start_date       => i.punch_date,
                      -- p_effective_end_date         => v_eff_end_date,
                      p_element_name               => v_csr_get_lement_details.element_name,
                      p_element_type_id            => v_csr_get_lement_details.element_type_id,
                      p_value_1                    => (i.total_hours),
                      p_batch_line_id              => v_batch_line_id,
                      p_object_version_number      => v_batch_object_version_number
                     );
               EXCEPTION
                  WHEN OTHERS
                  THEN
                     retcode := 2;
                     fnd_file.put_line
                        (fnd_file.LOG,
                            'Error while creating Batch Line for Assignments.Please contact your support administrator. - '
                         || i.assignment_number
                         || ' '
                         || SQLERRM
                        );
                     l_msg := 'E';
                     EXIT;
               END;
            END LOOP;
         EXCEPTION
            WHEN OTHERS
            THEN
               retcode := 2;
               fnd_file.put_line
                  (fnd_file.LOG,
                      'Error while creating Batch Lines outer layout.Please contact your support administrator. - '
                   || SQLERRM
                  );
               l_msg := 'E';
         END;

         BEGIN
            SELECT responsibility_id, application_id
              INTO l_responsibility_id, l_resp_appl_id
              FROM fnd_responsibility_tl
             WHERE responsibility_name LIKE 'OA HQ HRMS Manager'
               AND LANGUAGE = 'US';
         EXCEPTION
            WHEN OTHERS
            THEN
               retcode := 2;
               fnd_file.put_line
                  (fnd_file.LOG,
                      'Error while fetching responsibility details.Please contact your support administrator. - '
                   || SQLERRM
                  );
               l_msg := 'E';
         END;
      END IF;

      fnd_file.put_line (fnd_file.LOG,
                            'Location 3 l_msg  : '
                         || l_msg
                         || ' Retcode '
                         || retcode
                        );
      fnd_file.put_line (fnd_file.LOG, 'Creating Batch Lines Completes : ');
      fnd_file.put_line (fnd_file.LOG,
                         'Number Of Batch Lines l_count: ' || l_count
                        );

      IF l_count = 0
      THEN
         fnd_file.put_line
                       (fnd_file.LOG,
                           'Tracker v_batch_id and v_object_version_number: '
                        || v_batch_id
                        || ' '
                        || v_object_version_number
                       );

         BEGIN
            pay_batch_element_entry_api.delete_batch_header
                          (p_validate                   => FALSE,
                           p_batch_id                   => v_batch_id,
                           p_object_version_number      => v_object_version_number
                          );
            COMMIT;
         EXCEPTION
            WHEN OTHERS
            THEN
               retcode := 2;
               fnd_file.put_line
                  (fnd_file.LOG,
                      'Error while trying to delete Batch Header,Hence exit with retcode 2.Please contact your support administrator. - '
                   || SQLERRM
                  );
               l_msg := 'E';
         END;

         retcode := 2;
         fnd_file.put_line
            (fnd_file.LOG,
                'They are no lines to be proceesed in Validate and Transfer,Hence exit with retcode 2.Please contact your support administrator. - '
             || SQLERRM
            );
         l_msg := 'E';
      END IF;

      /* Launching Validate BEE batch once it is created*/
      IF l_count > 0
      THEN
         IF l_msg <> 'E' AND retcode <> 2
         THEN
            fnd_file.put_line
               (fnd_file.LOG,
                '*******************************Validate of BEE Start ************************************ '
               );
            fnd_file.put_line (fnd_file.LOG,
                               'Launching Batch Process - Validate : '
                              );

            BEGIN
               fnd_global.apps_initialize (fnd_profile.VALUE ('USER_ID'),
                                           l_responsibility_id,
                                           l_resp_appl_id
                                          );
               --mo_global.init ('S');
               --v_notify_user := fnd_request.add_notification ('USER_NAME');
               v_request_id1 :=
                  fnd_request.submit_request
                                        (application      => 'PER',
                                         program          => 'PAYLINK(VALIDATE)',
                                         description      => 'Validates BEE batch',
                                         start_time       => SYSDATE,
                                         sub_request      => FALSE,
                                         argument1        => 'BATCHEE',
                                         argument2        => 'VALIDATE',
                                         argument3        => v_batch_id
                                        );
               COMMIT;

               -- COMMIT;
               IF v_request_id1 > 0
               THEN
                  fnd_file.put_line
                     (fnd_file.LOG,
                         'Launched Batch Process - Validate, Request Id v_request_id1 : '
                      || v_request_id1
                     );

                  LOOP
                     lv_req_return_status1 :=
                        fnd_concurrent.wait_for_request (v_request_id1,
                                                         60,
                                                         0,
                                                         lv_req_phase,
                                                         lv_req_status,
                                                         lv_req_dev_phase,
                                                         lv_req_dev_status,
                                                         lv_req_message
                                                        );
                     EXIT WHEN UPPER (lv_req_phase) = 'COMPLETED'
                           OR UPPER (lv_req_status) IN
                                         ('CANCELLED', 'ERROR', 'TERMINATED');
                  END LOOP;

                  IF     UPPER (lv_req_phase) = 'COMPLETED'
                     AND UPPER (lv_req_status) = 'ERROR'
                  THEN
                     fnd_file.put_line
                        (fnd_file.LOG,
                            'In BEE Validate Batch Request @ Wait for request Stage.Contact System Administrotor - '
                         || SQLERRM
                        );
                     retcode := 2;
                     l_msg := 'E';
                  END IF;

                  fnd_file.put_line
                      (fnd_file.LOG,
                          'BEE Validate Batch Request submitted.Request id - '
                       || v_request_id1
                      );
               ELSE
                  fnd_file.put_line
                     (fnd_file.LOG,
                         'BEE Validate Batch Request submitted.Request id not submitted.Contact System Administrotor - '
                      || SQLERRM
                     );
                  retcode := 2;
                  l_msg := 'E';
               END IF;
            EXCEPTION
               WHEN OTHERS
               THEN
                  retcode := 2;
                  fnd_file.put_line
                     (fnd_file.LOG,
                         'Error while validating the batch Batch Lines outer layout.Please contact your support administrator. - '
                      || SQLERRM
                     );
                  l_msg := 'E';
            END;

            fnd_file.put_line
                       (fnd_file.LOG,
                           'Batch Process - Validate Completes with Status : '
                        || lv_req_status
                        || v_request_id1
                       );
            fnd_file.put_line
               (fnd_file.LOG,
                '*******************************Validate of BEE Ends ************************************ '
               );
         END IF;
      END IF;

      BEGIN
         SELECT NVL (COUNT (batch_line_status), 0)
           INTO l_error_count
           FROM pay_batch_lines
          WHERE batch_line_status = 'E' AND batch_id = v_batch_id;
      EXCEPTION
         WHEN OTHERS
         THEN
            retcode := 2;
            fnd_file.put_line
               (fnd_file.LOG,
                   'Error while fetching Batch error count.Please contact your support administrator. - '
                || SQLERRM
               );
            l_msg := 'E';
      END;

      IF l_error_count > 0
      THEN
         retcode := 2;
         fnd_file.put_line
            (fnd_file.LOG,
                'Error while validating batch As error count crossed 0.Please contact your support administrator. - '
             || SQLERRM
            );
         l_msg := 'E';
      END IF;

      fnd_file.put_line
         (fnd_file.LOG,
             'Validate Batch Process - Completes and Error count for assignments in Batch while validating is : '
          || l_error_count
         );

      /* Launching Transfer BEE batch once it is validated*/
      IF     l_msg <> 'E'
         AND retcode <> 2
         AND l_error_count = 0
         AND v_request_id1 IS NOT NULL
      THEN
         --   END IF;
         fnd_file.put_line
            (fnd_file.LOG,
             '*******************************Transfer of BEE Starts ************************************ '
            );
         fnd_file.put_line (fnd_file.LOG, 'Transfer Batch Process - Launched');

         BEGIN
            fnd_global.apps_initialize (fnd_profile.VALUE ('USER_ID'),
                                        l_responsibility_id,
                                        l_resp_appl_id
                                       );
            --mo_global.init ('S');
            --v_notify_user := fnd_request.add_notification ('USER_NAME');
            v_request_id2 :=
               fnd_request.submit_request
                                        (application      => 'PER',
                                         program          => 'PAYLINK(TRANSFER)',
                                         description      => 'Transfers BEE batch',
                                         start_time       => SYSDATE,
                                         sub_request      => FALSE,
                                         argument1        => 'BATCHEE',
                                         argument2        => 'TRANSFER',
                                         argument3        => v_batch_id
                                        );
            COMMIT;

            IF v_request_id2 > 0
            THEN
               fnd_file.put_line
                     (fnd_file.LOG,
                         'BEE Transfer Batch Request submitted.Request id - '
                      || v_request_id2
                     );

               LOOP
                  lv_req_return_status2 :=
                     fnd_concurrent.wait_for_request (v_request_id2,
                                                      60,
                                                      0,
                                                      lv_req_phase1,
                                                      lv_req_status1,
                                                      lv_req_dev_phase1,
                                                      lv_req_dev_status1,
                                                      lv_req_message1
                                                     );
                  EXIT WHEN UPPER (lv_req_phase1) = 'COMPLETED'
                        OR UPPER (lv_req_status1) IN
                                         ('CANCELLED', 'ERROR', 'TERMINATED');
               END LOOP;
            ELSE
               fnd_file.put_line
                  (fnd_file.LOG,
                      'BEE Transfer Batch Request submitted.Request id not submitted.Contact System Administrotor - '
                   || SQLERRM
                  );
               retcode := 2;
               l_msg := 'E';
            END IF;
         EXCEPTION
            WHEN OTHERS
            THEN
               retcode := 2;
               fnd_file.put_line
                  (fnd_file.LOG,
                      'Error while validating the batch Batch Lines outer layout.Please contact your support administrator. - '
                   || SQLERRM
                  );
               l_msg := 'E';
         END;

         fnd_file.put_line
            (fnd_file.LOG,
             '*******************************Transfer of BEE Ends ************************************ '
            );
      END IF;

      --  END IF;
      fnd_file.put_line (fnd_file.LOG,
                            'Location 4 l_msg  : '
                         || l_msg
                         || ' Retcode '
                         || retcode
                        );

      IF l_msg = 'E'
      THEN
         ROLLBACK;
      ELSE
         COMMIT;
      END IF;


"Team Work" More We Less Me.