API’s to Create Approver Group and
its Config
DECLARE
l_approval_group_name VARCHAR2 (500) := 'Item Approval Group';
l_approval_group_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
l_start_date DATE := NULL;
l_end_date DATE := NULL;
l_application_name VARCHAR2 (500)
:= 'Item Creation Custom Approval';
l_application_id NUMBER := NULL;
l_voting_regime VARCHAR2 (100) := NULL;
l_obj_object_version_number NUMBER := NULL;
l_obj_start_date DATE := NULL;
l_obj_end_date DATE := NULL;
l_process VARCHAR2 (1) := 'N';
BEGIN
fnd_global.
apps_initialize (user_id => 1130, --XXH_MIGRATION
resp_id => 50797, -- XXH HRMS Super User
resp_appl_id => 800 -- Human Resources
);
BEGIN
ame_approver_group_api.
create_ame_approver_group (
p_validate => FALSE,
p_name => l_approval_group_name,
p_description => l_approval_group_name,
p_is_static => 'Y',
p_query_string => NULL,
p_approval_group_id => l_approval_group_id,
p_start_date => l_start_date,
p_end_date => l_end_date,
p_object_version_number => l_object_version_number);
DBMS_OUTPUT.
put_line (
l_approval_group_id
|| ' --> '
|| l_approval_group_name
|| ' --> created successfully !!!');
l_process := 'Y';
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Approval Group Load API Excep:
' || SQLERRM);
END;
IF l_process = 'Y'
THEN
-- Voting Regime
SELECT lookup_code
INTO
l_voting_regime
FROM fnd_lookups
WHERE lookup_type = 'AME_APG_VOTING_REGIME'
AND UPPER (meaning) = 'SERIAL';
SELECT application_id
INTO
l_application_id
FROM
ame_calling_apps
WHERE application_name = l_application_name
AND SYSDATE BETWEEN start_date AND end_date;
ame_approver_group_api.
create_approver_group_config (
p_validate => FALSE,
p_approval_group_id => l_approval_group_id,
p_application_id => l_application_id,
p_voting_regime => l_voting_regime,
p_order_number => NULL,
p_object_version_number => l_obj_object_version_number,
p_start_date => l_obj_start_date,
p_end_date => l_obj_end_date);
COMMIT;
DBMS_OUTPUT.
put_line (
l_approval_group_name
|| ' second level has been created successfully !!!');
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);
END;
--SELECT *
-- FROM ame_approval_groups
-- WHERE approval_group_id IN
(23001, 23004)
--SELECT * from ame_approval_group_config where
approval_group_id in (23001,23004) and SYSDATE between start_date and end_date
API’s to Create Approver Group Item
DECLARE
l_approval_group_name VARCHAR2 (500) := 'Item Approval Group';
l_approval_group_id NUMBER := NULL;
l_parameter_name VARCHAR2 (50) := 'wf_roles_name';
l_parameter VARCHAR2 (50) := 'RPANDE';
l_order_number NUMBER := 1;
l_approval_group_item_id NUMBER := NULL;
l_object_version_number NUMBER := NULL;
l_start_date DATE := NULL;
l_end_date DATE := NULL;
BEGIN
fnd_global.
apps_initialize (user_id => 1130, --XXH_MIGRATION
resp_id => 50797, -- XXH HRMS Super User
resp_appl_id => 800 -- Human Resources
);
SELECT approval_group_id
INTO
l_approval_group_id
FROM
ame_approval_groups
WHERE name = l_approval_group_name
AND SYSDATE BETWEEN start_date AND end_date;
ame_approver_group_api.
create_approver_group_item (
p_validate => FALSE,
p_approval_group_id => l_approval_group_id,
p_parameter_name => l_parameter_name,
p_parameter => l_parameter,
p_order_number => l_order_number,
p_approval_group_item_id => l_approval_group_item_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 (
'Approval Group Item : ' || l_parameter || ' has been added !!');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Main Exception: ' || SQLERRM);
END;
--select * from ame_approval_group_items where
approval_group_id = 15005
No comments:
Post a Comment