Sunday, September 6, 2015

API to Delete Approver Group Config

DECLARE
   l_approval_group_name     VARCHAR2 (500) := 'AZHD AP Approval';
   l_approval_group_id       NUMBER := NULL;
   l_application_id          NUMBER := NULL;
   l_object_version_number   NUMBER := NULL;
   l_start_date              DATE := NULL;
   l_end_date                DATE := NULL;
BEGIN
   SELECT a.approval_group_id, b.object_version_number, b.application_id
     INTO l_approval_group_id, l_object_version_number, l_application_id
     FROM ame_approval_groups a, ame_approval_group_config b
    WHERE     a.name = l_approval_group_name
          AND a.approval_group_id = b.approval_group_id
          AND SYSDATE BETWEEN a.start_date AND a.end_date
          AND SYSDATE BETWEEN b.start_date AND b.end_date;

   ame_approver_group_api.
    delete_approver_group_config (
      p_validate                => FALSE,
      p_approval_group_id       => l_approval_group_id,
      p_application_id          => l_application_id,
      p_object_version_number   => l_object_version_number,
      p_start_date              => l_start_date,
      p_end_date                => l_end_date);

   COMMIT;

   DBMS_OUTPUT.put_line (l_approval_group_id || ' config has been deleted ');
END;


--select * from ame_approval_groups where  name = 'Testing with Actual API';

--SELECT *
--  FROM ame_approval_group_config

-- WHERE approval_group_id = 23006

No comments:

Post a Comment