Testing AME approvals via PL/SQL
Oracle E-Business Suite (EBS) offers a powerful and flexible Approval Management Engine (AME) that enables organizations to define, manage, and execute approval processes tailored to their business needs. However, testing these AME approval setups can sometimes be challenging, especially when dealing with complex approval hierarchies and conditions.
In this blog post, we'll explore how you can streamline the testing of AME approvals by leveraging PL/SQL scripts.
Example (/start) script to test AME approvals. The example tests for a Purchase Requisition Approval.
Modify at your own leasure.
declare
g_ame_approvers ame_approvers_list;
function test_trx(p_trx_id in number) return ame_approvers_list is
l_ame_approvers ame_approvers_list;
l_approvers_string varchar2(4000);
l_count number := 0;
l_error VARCHAR2(100);
begin
ame_test_utility_pkg.getApprovers(applicationIdIn => -223, -- PO, Purchase Requisition Approval
transactionIdIn => p_trx_id,
isRealTransaction => 'Y',
approverListStageIn => 6,
approversOut => l_ame_approvers,
errString => l_error);
if l_ame_approvers.count > 0 then
for i in l_ame_approvers.first .. l_ame_approvers.last loop
l_count := l_count + 1;
l_approvers_string := to_char(l_ame_approvers(i).approver_order_number, '990') || ' ' || l_ame_approvers(i).name || ' (' || l_ame_approvers(i).source_Desc || ')';
dbms_output.put_line(l_approvers_string);
--dbms_output.put_line('Approver: ' || l_ame_approvers(i).name || ' | ' || l_ame_approvers(i).group_or_chain_id);
end loop;
end if;
return l_ame_approvers;
end;
begin
for l_rt in (select 540537 trx_id -- use an existing requisition id
from dual)
loop
g_ame_approvers := test_trx(p_trx_id => l_rt.trx_id);
dbms_output.put_line('Count: ' || g_ame_approvers.count);
end loop;
end;
/
To determine what AME applications you are using try this query:
select fa.application_id fnd_appl_id,
fa.application_short_name fnd_short_name,
fav.application_name fnd_appl_name,
aa.application_name ame_appl_name,
aa.application_id ame_appl_id
from ame_calling_apps aa
join fnd_application fa
on aa.fnd_application_id = fa.application_id
join fnd_application_vl fav on fa.application_id = fav.application_id
where exists (select 1 from ame_trans_approval_history h where h.application_id = aa.application_id)
and sysdate between aa.start_date and aa.end_date
order by 2, 3;
Subscribe to my newsletter
Read articles from Mark directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by