AME Setup
Posted: December 1, 2013 in Purchasing
1
Assign AME Roles and Responsibilities
1. Navigate to User Management Responsibility->Users and search for the user to whom you wish to grant AME
roles. (Can navigate from any user which has Security Administrator Role or from SYSADMIN user).
2. Click on Update icon across the user name and in the update user page, click on Assign Role button.
3. Search for “Approval%” and select the Roles: Approvals Management Administrator & Approvals Management
Business Analyst.
4. Specify justification and relevant dates for the newly assigned roles, and click Apply to assign the roles to the user.
Grant Transaction Type Access to Users
1. Navigate to Functional Administrator->Security->Grants and click on Create Grants button.
2. Create a grant with the following information:
Name
Grantee Type = ALL User
Object = AME Transaction Types
You can also set Grantee Type as Specific User and set the your user name as Grantee
3. Click Next button and select the Object Data Context as All Rows.
4. Click Next to define the object parameters and Select Set as AME Calling Applications
5. Click Next, review the setups and then Finish the process
Create new transaction Type
1. Navigate to Approvals Management Administrator responsibility->Admin Dashboard and click on Create
Transaction Type button(Responsibility will be available because of the roles assigned)
We are going to create new transaction type in reference with seeded Purchase Requisition Approval transaction
type.
2. Select the application and enter Transaction Type key & Transaction Type Name.Then Click Next button.
3. In the drop down,select Line Item and click on Go button.Another row for Line Item will be created.
Change the order number to 2 and then enter the SQL query in Query window.Click on Validate button and click on
Apply button.
4. Click Next button and enter the details as in below screenshot.(Click Validate button after entering each query).
5. Click Next and then Finish button.
AME Setup
1. Navigate to Approvals Management Business Analyst Responsibility->Business Analyst Dashboard (Responsibility
will be available because of the role assigned)
2. Use the Transaction Type LOV to search and select the transaction type.We are using the newly created transaction
type “GOV Purchase Requisition Approval“.
Seeded Transaction types available for Purchase Requisitions are Purchase Requisition Approval, Internal
Requisition Approval and Requester Change Order Approval.
Attributes:
1. Select Attributes icon and click on Use Existing Attribute.
2. Under Search, select options as in below screenshot.After selecting REQUISITION_TOTAL and click on continue.
3. Select usage type as Dynamic. Enter the query,validate and click finish.
4. Similarly add ITEM_CATEGORY attribute also.
5 Also add below mentioned Attributes as its required for selecting some basic Action types
TRANSACTION_REQUESTOR_PERSON_ID(Required for Supervisory level Action Type)
ALLOW_EMPTY_APPROVAL_GROUPS(Required for approval-group chain of authority Action Type)
Condition:
1. Click on Conditions icon under setup tab.By default there are some conditions available.Still we can create new
condition by clicking Create button.
2. Select the Attribute,enter the String value/Requisition Total and then click Apply button.
Condition for ITEM_CATEGORY
Condition for REQUISITION_TOTAL
Another condition for REQUISITION_TOTAL
3. You can see the newly created condition along with existing conditions
Action Types:
1. Click on Action Types icon under setup tab and then click on “Use Existing Action Type” button.
2. Select below mentioned types and click on Continue Button.
Supervisory level
approval-group chain of authority
3. Then click Finish button.
Approver Groups:
1. Click on Approver Groups icon under setup tab and then click on Create button.
2. Enter the Group Name,Description,Order Number and select the Voting method.Also add the approvers and click
apply button.
3. Similarly create the remaining Approval Groups.
Rules Setup:
1. Click on Rules Tab and then on Create button.
2. Enter the Rule Name,select the Rule Type and click on Next button.
3. Add the Conditions using the Add Conditions button and click next button.
4. Click on Add Actions button to add actions,click next and then Finish.
5. Similarly create all rules.
AME_MANAGER
AME_CATEGORY
Enable AME for Requisition Approval
1. Navigate to Purchasing Super User->Setup->Purchasing->Document Types
2. Click update button against Purchase Requisition Document Type
3. Assign newly created transaction type to Approval Transaction Type
Testing
Requisition with total amount 900 USD (Less than 10000 USD)
Requisition with total amount 13500 USD(Greater than 10000 USD and less than 1000000 USD)
Requisition with total amount 1000 USD and using category “204.53”
AME Setup
Steps for AP Invoice Approval AME setup
Step 1: Navigation to Profile options
System Administrator Profile system
Setup 2 : Enter Application and Profile details and Press Find Button.
Step 3 : Change the AME Installed Value to YES as shown below
Step 4 : Change to Payables Responsibilty and Navigate to Payables Options
Step 5 : Enter the Operating Unit Name.
Step 6 : Navigate to Approval Tab and Enable ‘Use Invoice Approval Workflow ‘ as shown below
Step 7: Switch to Approvals Management Business Analyst Responsibility .
Step 8 : Enter the Transaction Type as ‘ Payables Invoice Approval ’
Step 9: Press the Approval Groups Button as shown above Screen shot.
Create the Approval Group with the Below Values
In the Query I have written the function which will return the Accounting Manager in the Test instance.
Step 10: Navigate to Action Types Button.
And select Action type as Pre Chain of Authority Approvals as shown below
You will get the Action value as ‘Require pre-approval from OSD Account Manager Approval’
Step 11 : Create a Rule by following below Steps ,
a) Enter the Name of the Rule Example : osd Approval Management Approval,Rule type : Combination
: List Creation, Item Class : Header as shownbelow
a) As there are no Conditions , press the next button.
b) Select the Action Type as ‘Pre Chain of Authority Approvals’ and Action as ‘pre-approval from OSD
Account Manager Approval’ .
Step 4 : Finish
Completion of AME Setup
Step 12 : Navigate to Payables Manager
Create An invoice by Entering the Header and line Information.
Entering the Line Information.
Now By Pressing the Distribution Button.
Enter the Distribution Level details as shown below screen shot.
Once the Account is Generated.
Navigate to Invoice page Actions .
Enable the Check box Validate and press OK button
Create the Account by Enabling the Create Accounting check box and Final and press OK from the
Above Screen.
Once the Account is Generated Run the ‘Invoice Approval Workflow’ .
Navigation : view Requests
Parameters :
Supplier Name ,Invoice Num .
Once the Program complete successfully, follow the below steps
Navigate : Reports View Invoice Approval History
You will get the Account Manager details for the Invoice and the notification will be sent to the
Approver.
CREATE OR REPLACE FUNCTION XX_GET_APPROVER( p_invoice_id IN NUMBER )
RETURN VARCHAR
IS
l_person_id NUMBER := 0 ;
l_count NUMBER := 0;
V_OPERATING_UNIT VARCHAR2(2000):=NULL;
V_ORG_ID NUMBER := 0;
l_return_val VARCHAR2(200) := NULL;
BEGIN
BEGIN
SELECT COUNT(*)
INTO l_count
FROM ap_invoices_all ail,
ap_suppliers aps
-- po_lookup_codes plc
Where Ail.Vendor_Id = Aps.Vendor_Id
And NVL(Aps.Vendor_Type_Lookup_Code,'XYZ') <>'OUTSOURCING'
-- AND aps.vendor_type_lookup_code <>'OUTSOURCING'
-- and aps.vendor_type_lookup_code = plc.lookup_code
AND ail.invoice_type_lookup_code IN ('PREPAYMENT', 'STANDARD','MIXED')
AND ail.invoice_id = p_invoice_id;
-- and plc.lookup_type <> 'VENDOR TYPE' ;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Invoice does not exist :');
END;
DBMS_OUTPUT.PUT_LINE('Invoice does not exist l_count :'||l_count);
IF l_count >= 1 THEN
BEGIN
SELECT org_id
INTO V_ORG_ID
FROM ap_invoices_ALL
WHERE invoice_id=p_invoice_id;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Invoice orgid does not exist :');
END;
DBMS_OUTPUT.PUT_LINE('Org id Value :'||v_org_id);
BEGIN
SELECT name
INTO V_OPERATING_UNIT
FROM hr_operating_units
WHERE organization_id=v_org_id;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('operating unit does not exist :');
END;
DBMS_OUTPUT.PUT_LINE('Org id Value :'||V_OPERATING_UNIT);
BEGIN
IF v_operating_unit LIKE 'operations' THEN
SELECT paf1.person_id
INTO l_person_id
FROM HR_ALL_POSITIONS_F HAPF,
PER_JOBS PJB ,
PER_ALL_PEOPLE_F PAF1,
FND_USER FU ,
PER_ALL_ASSIGNMENTS_F PAAF
WHERE SUBSTR(HAPF.name,INSTR(HAPF.name,'.',1)+1,15)='Account Manager'
AND PJB.NAME ='Manager'
AND PAAF.PERSON_ID =PAF1.PERSON_ID
AND HAPF.JOB_ID = PJB.JOB_ID
AND PAAF.JOB_ID =PJB.JOB_ID
AND PAAF.POSITION_ID =HAPF.POSITION_ID
AND (sysdate BETWEEN PAAF.EFFECTIVE_START_DATE AND PAAF.EFFECTIVE_END_DATE)
AND (sysdate BETWEEN paf1.effective_start_date AND paf1.effective_end_date)
AND PAAF.JOB_ID =HAPF.JOB_ID
AND FU.EMPLOYEE_ID =PAF1.PERSON_ID
AND rownum =1
AND SUBSTR(HAPF.name,1,2) IN
(SELECT FLEX_VALUE
FROM FND_FLEX_VALUE_SETS FFVS,
FND_FLEX_VALUES FFV ,
FND_FLEX_VALUES_TL FFVT
WHERE FFVS.FLEX_VALUE_SET_ID=FFV.FLEX_VALUE_SET_ID
AND FFV.FLEX_VALUE_ID =FFVT.FLEX_VALUE_ID
AND FFVT.LANGUAGE ='US'
AND FLEX_VALUE_SET_NAME ='operations_Company'
AND FFVT.DESCRIPTION ='Operations'
);
elsif v_operating_unit='glass' THEN
SELECT paf1.person_id
INTO l_person_id
FROM HR_ALL_POSITIONS_F HAPF,
PER_JOBS PJB ,
PER_ALL_PEOPLE_F PAF1,
FND_USER FU ,
PER_ALL_ASSIGNMENTS_F PAAF
WHERE SUBSTR(HAPF.name,INSTR(HAPF.name,'.',1)+1,15)='Account Manager'
AND PJB.NAME ='Accountant' --'Manager'
AND PAAF.PERSON_ID =PAF1.PERSON_ID
AND HAPF.JOB_ID = PJB.JOB_ID
AND PAAF.JOB_ID =PJB.JOB_ID
AND PAAF.POSITION_ID =HAPF.POSITION_ID
AND (sysdate BETWEEN PAAF.EFFECTIVE_START_DATE AND PAAF.EFFECTIVE_END_DATE)
AND (sysdate BETWEEN paf1.effective_start_date AND paf1.effective_end_date)
AND PAAF.JOB_ID =HAPF.JOB_ID
AND FU.EMPLOYEE_ID =PAF1.PERSON_ID
AND rownum =1
AND SUBSTR(HAPF.name,1,2) IN
(SELECT FLEX_VALUE
FROM FND_FLEX_VALUE_SETS FFVS,
FND_FLEX_VALUES FFV ,
FND_FLEX_VALUES_TL FFVT
WHERE FFVS.FLEX_VALUE_SET_ID=FFV.FLEX_VALUE_SET_ID
AND FFV.FLEX_VALUE_ID =FFVT.FLEX_VALUE_ID
AND FFVT.LANGUAGE ='US'
AND FLEX_VALUE_SET_NAME ='Company'
AND FFVT.DESCRIPTION ='glass'
);
Elsif v_operating_unit LIKE 'suretech' THEN
SELECT paf1.person_id
INTO l_person_id
FROM HR_ALL_POSITIONS_F HAPF,
PER_JOBS PJB ,
PER_ALL_PEOPLE_F PAF1,
FND_USER FU ,
PER_ALL_ASSIGNMENTS_F PAAF
WHERE SUBSTR(HAPF.name,INSTR(HAPF.name,'.',1)+1,15)='Account Manager'
AND PJB.NAME ='Manager'
AND PAAF.PERSON_ID =PAF1.PERSON_ID
AND HAPF.JOB_ID = PJB.JOB_ID
AND PAAF.JOB_ID =PJB.JOB_ID
AND PAAF.POSITION_ID =HAPF.POSITION_ID
AND (sysdate BETWEEN PAAF.EFFECTIVE_START_DATE AND PAAF.EFFECTIVE_END_DATE)
AND (sysdate BETWEEN paf1.effective_start_date AND paf1.effective_end_date)
AND PAAF.JOB_ID =HAPF.JOB_ID
AND FU.EMPLOYEE_ID =PAF1.PERSON_ID
AND rownum =1
AND SUBSTR(HAPF.name,1,2) IN
(SELECT FLEX_VALUE
FROM FND_FLEX_VALUE_SETS FFVS,
FND_FLEX_VALUES FFV ,
FND_FLEX_VALUES_TL FFVT
WHERE FFVS.FLEX_VALUE_SET_ID=FFV.FLEX_VALUE_SET_ID
AND FFV.FLEX_VALUE_ID =FFVT.FLEX_VALUE_ID
AND FFVT.LANGUAGE ='US'
AND FLEX_VALUE_SET_NAME ='child_Company'
And Ffvt.Description ='child'
);
Elsif v_operating_unit='master' THEN
SELECT paf1.person_id
INTO l_person_id
FROM HR_ALL_POSITIONS_F HAPF,
PER_JOBS PJB ,
PER_ALL_PEOPLE_F PAF1,
FND_USER FU ,
PER_ALL_ASSIGNMENTS_F PAAF
WHERE SUBSTR(HAPF.name,INSTR(HAPF.name,'.',1)+1,15)='Account Manager'
AND PJB.NAME ='Manager'
AND PAAF.PERSON_ID =PAF1.PERSON_ID
AND HAPF.JOB_ID = PJB.JOB_ID
AND PAAF.JOB_ID =PJB.JOB_ID
AND PAAF.POSITION_ID =HAPF.POSITION_ID
AND (sysdate BETWEEN PAAF.EFFECTIVE_START_DATE AND PAAF.EFFECTIVE_END_DATE)
AND (sysdate BETWEEN paf1.effective_start_date AND paf1.effective_end_date)
AND PAAF.JOB_ID =HAPF.JOB_ID
AND FU.EMPLOYEE_ID =PAF1.PERSON_ID
AND rownum =1
AND SUBSTR(HAPF.name,1,2) IN
(SELECT FLEX_VALUE
FROM FND_FLEX_VALUE_SETS FFVS,
FND_FLEX_VALUES FFV ,
FND_FLEX_VALUES_TL FFVT
WHERE FFVS.FLEX_VALUE_SET_ID=FFV.FLEX_VALUE_SET_ID
AND FFV.FLEX_VALUE_ID =FFVT.FLEX_VALUE_ID
AND FFVT.LANGUAGE ='US'
AND FLEX_VALUE_SET_NAME ='master_Company'
AND FFVT.DESCRIPTION ='master'
);
ELSE
l_person_id:=0;
END IF;
EXCEPTION
WHEN OTHERS THEN
l_person_id :=0;
END;
DBMS_OUTPUT.PUT_LINE('person id Value :'||l_person_id);
ELSE
l_person_id :=0;
END IF;
DBMS_OUTPUT.PUT_LINE('Invoice does not exist l_person_id :'||l_person_id);
l_return_val := 'person_id:' ||TO_CHAR(l_person_id);
RETURN (l_return_val);
EXCEPTION
WHEN OTHERS THEN
l_person_id :=0;
Return (L_Return_Val);
End XX_Get_Approver;
ORACLE APPROVALS MANAGEMENT
(AME) SETUPS AND TEST CASES IN 11I
Oracle Approvals Management or AME, as it is called in general, is a module of Oracle Applications that contains
the hierarchy list for all seeded/standard workflows. We can configure individual approval lists for each workflow in
this module. To enable the workflows to use AME hierarchy list a profile option, AME: Installed, has to be set. Just
like any profile option it can be set at any of the flowing levels,
Site
Responsibility
Application
User
AME profile option
Demonstration of setup and usage of AME
We shall look at setting up the AP Invoice Approval hierarchy in AME. This hierarchy has not been used in the
instance as the customer does not use AME for AP.
Responsibility: Approvals Management Business Analyst
Navigation: Business Analyst Dashboard
Enter %invoice% and press tab
Attributes
Click on Attributes
We are selecting Attribute, SUPPLIER_INVOICE_AMOUNT. Click Next on the attributes are to find the this attribute
Clicking on this attribute gives the details of the attribute,
You can see how Oracle derives the value of the attribute. Let us go back to the Attributes screen by clicking Return
to Attributes link at the bottom left of the screen.
If you want to modify the logic that Oracle uses on this attribute you can click on Update icon (the pencil icon) for
this attribute.
Note the input parameter for the query. The condition, ai.invoice_id = :transactionId, means that the input to the
AME rule will be validated against the invoice_id from the ap_invoices_all table. Thus the input into AME rule for
this transaction will be invoice_id. We shall use this for testing AME later on. Make the change to the query and
press Apply button.
ConditionsWe shall now add a condition. Click on Conditions.
Click on Create button and select,
Condition Type: Ordinary
Attribute: SUPPLIER_INVOICE_AMOUNT
Let’s add the condition that an invoice should be sent to 1 selected approver if the invoice amount is between AED
1000 and AED 5000.
Use the drop down lists to create the condition. Click Apply.
You can see the confirmation message on top that the condition has been added to the list.
Action Types
Now we have created a condition, we have to create an Action Type. Click on Action Types link on the top menu.
We will select an existing Action Type. Click Use Existing Action Type button.
Click on the Next button until you see “Supervisory level“. Select this Action Type
Click on Continue button.
Click Finish button.
Rules
The Action Type is now created. We now need to create a Rule. Click on the Rules tab to the top right menu.
Click on Create button to create a new rule.
Enter a new name,
Name: Invoice test rule
Rule Type: List Creation is defaulted
Start Date: today’s date is defaulted
End Date: Defaulted as 31-Dec-4712
Click on Next
Click on Add Conditions button. Now we get to select which conditions are to be added to this rule.
Let us select the condition we created named, “SUPPLIER_INVOICE_AMOUNT is greater than 1000 and less than or
equal to 5000,AED“. Select this condition and click Continue button.
Check the details and click on Next
Action Type is populated automatically as this is the Action Type that was selected earlier for this transaction type.
Select an Action from the list of values. Select the Action from the List of Values.
We select “Requires approvals up to the first two superiors“
Click Next
Review and click Finish
Now the rule is ready to be tested and deployed.
Test the AME setup
Let us test the rule before we start using it in the transaction.
First we shall create a test invoice for testing the AME rule.
Navigation: Payables Administrator
Navigation: Invoices > Entry > Invoices
We have put a condition in AME for currency, AED, and amount between 1000 and 5000. Hence we have created
an invoice with the following details,
Invoice number: TEST-AME
Invoice currency: AED
Invoice amount: 1500
Go to back to Business Analyst Dashboard in Approvals Management Business Analyst responsibility.
Click on Test icon corresponding to Payables Invoice Approval transaction type.
Click on Run Real Transaction Test.
Enter the transaction id 720374. This is the invoice_id from the ap_invoices_all table (explained in Attributes
section above). The invoice amount is between AED 1000 and AED 5000, (AED1500 for the invoice we have
created) i.e. as per the condition we have set in AME.
Click Go
Now the AME transaction data is shown on this page. We also have a warning message from Oracle. The message
is “The Line Item attribute SUPPLIER_INVOICE_DISTRIBUTION_ASSETS_TRACKING_FLAG has invalid usage
for item 278866“. Approver listmay not be generated if this attribute used in conditions”.
We need to look into the attribute SUPPLIER_INVOICE_DISTRIBUTION_ASSETS_TRACKING_FLAG.
Let us check this attribute.
Click on Setup tab on the top menu. Then click on Attributes underneath the top menu. Select the attribute
by entering the name in Search form in the middle of the form.
Click Update
Select the query from the Value field and paste it in SQL.
1 SELECT assets_tracking_flag
FROM ap_invoice_distributions_all
2 WHERE invoice_id = :transactionid AND invoice_distribution_id IN (SELECT
3 invoice_distribution_id
4 FROM
5 ap_invoice_distributions_all
WHERE invoice_i
6 :transactionid)
ORDER BY invoice_distribution_id
Execute the sql and pass the invoice_id, 130384 (that was being used for the AME test).
The output is ‘Y’. If you notice the Attribute Data Type in the Attribute screen in AME, it is Number. Hence there is
a mismatch.
Let us change this query to return only 1. Change the query to the following and paste it on the Value field in the
Attribute form in AME.
SELECT 1
1 FROM ap_invoice_distributions_all
2 WHERE invoice_id = :transactionId AND invoice_distribution_id IN (SELECT
3 invoice_distribution_id
FROM
4 ap_invoice_distributions_all
5 WHERE invoice_i
6 :transactionId)
ORDER BY invoice_distribution_id
Click on Validate button to validate the query
The message on top shows that the query is valid. Click on Apply. Go back to the Test Workbench page by clicking
on Test Workbench tab on the top right menu. Click on Run Real Transaction Test (1) button.
Enter the same transaction Id, 130384, and click on Go.
Click on Run Test Case (2) button.
Oracle throws an error, “This transaction’s requestor lacks a person ID, so AME cannot locate the requestor’s
supervisor to begin the chain of authority“. This means the requester_id field has to be populated in the table.
Let us populate the requester_id field for this invoice. For demonstration we shall perform this action using an
update statement. Go back to the AP invoices form and query for the invoice. Click on Folder > Show field. Query
for Re%
Select Requester from the value set.
Set the value for Requester. This can be any active employee. The hierarchy of this employee will be used up to
2 levels.
Save the form. Go back to Test Workbench in AME. Enter Transaction Id: 720374. Click on Run Test Case
(1) button.
Now click on Run Test Case (2) button
Now the approver list comes up for AME as the requester has been set for the invoice.
We can get AME rule details by clicking on the + or Show buttons.
We get to see the AME rule information. Now by clicking Show button for the 2 nd approver, i.e. the approver on
top.
Now check the 1st approver
The AME rule is now setup. Once the Invoice is sent for approval after setting the requester name the flow will be
similar to what we tested now. The same logic applies to all AME approval rules.
We have used a very simple example to illustrate setting up AME rules. The same method is used to create AME
rules for all transactions. Certain setup options have not been used, like Approval Groups, etc. Once AME setup is
clear using the extra options will be very easy.
We have tested the approval list for the AP invoice workflow through AME. Once we send the invoice for approval,
the workflow will be executed and the approval notifications will be sent in the same hierarchy.