You are on page 1of 3

Page 1 of 3

">

How to Use Dynamic Queries To Determine Approvers for iProcurement Requisitions - Example Based on Requisition Line Requester? [ID 960944.1] Modified 22-JUN-2011 In this Document Goal Solution References Type HOWTO Status PUBLISHED

Applies to:
Oracle iProcurement - Version: 12.0.6 and later [Release: 12 and later ] Information in this document applies to any platform.

Goal
Can AME be used to generate approvers based on the REQUESTER of the requisition line items, rather than based on the PREPARER of the requisition?

Solution
This type of functionality requires customization which is not completely covered in this answer, but the information contained here should be helpful in understanding some of the capability and some options to consider. AME provides Dynamic Query functionality that may be used to generate approvers based on the line level REQUESTER or other requisition header or line level values. As an Example, use the following Dynamic Query to generate an Approval group based on the requisition line level REQUESTER (Note: Additional logic may be needed if there are 2 or more different requesters specified on the requisition lines. If all the lines on the requisition have the same requester, then this should work fine.) 1. Please review the following EXAMPLE 1 for details about a new ATTRIBUTE, CONDITION, and RULE that can be created. The ATTRIBUTE returns a true or false value. If all of the requesters on the requisition lines are the same as the preparer of the requisition, then the attribute returns as true. If one or more of the requesters on the requisition lines is different than the preparer of the requisition, then the attribute returns as false. Then the RULE checks the CONDITION and adds an additional approver (using an Approver Group) if the ATTRIBUTE is false - (false in this case means at least one requester is different than the preparer) EXAMPLE 1 1. Navigate to AME responsibility 2. Choose Setup for Purchase Requisition Approval transaction type 3. Create a new Attribute Attribute Name Attribute Description Category Usage Type Item Class Data Type REQUESTERS_SAME_AS_PREPARER True if All Requesters On Req Lines Are Same As Preparer on Req Header Others Dynamic Header Boolean Query used for the new attribute is as follows: select min(myvalue) from (select decode(prla.to_person_id, prha.preparer_id,'true','false') myvalue from po_requisition_headers_all prha, po_requisition_lines_all prla where prla.requisition_header_id = prha.requisition_header_id AND prha.requisition_header_id = :transactionId ) 4. Create a new Condition based on the above new Attribute REQUESTERS_SAME_AS_PREPARER is False 5. Create a new Rule that uses the above new Condition based on the new Attribute Item is Dave-Germany-001 and Requester Not Preparer - if REQUESTERS_SAME_AS_PREPARER is False (i.e., if at least one of the requests is not the same as the preparer of the requisition) - then add an additional post list approver from a specific approval group defined previously

6. Test the issue - Create a new requisition in iProcurement Vision Germany - Specify the requester the same as the preparer - checkout step 2 of 3 (see the approval list does not include the additional post list approver) - go back to checkout step 1 of 3 - change the requester to be different than the preparer - checkout step 2 of 3 (see the approval list DOES include the ADDITIONAL post list approver)

2. To augment the Example 1 further, Example 2 below shows some modifications which retrieves all the Supervisors above the Requester, and adds all these supervisors to the approval list. This example creates multiple approver groups which each return a single approver in the supervisor approver hierarchy above the requester. EXAMPLE 2 Requester --> Supervisor 1 (approver group 1)--> Supervisor 2 (approver group 2) --> Supervisor 3 (approver group 3) ... Supervisor 10 (approver group) Setup Approver groups 1-10 where each approver group is based on a dynamic query that returns the supvisor corresponding to that supervisor level (up to 10 levels). (or up to 20 if you will ever have 20 supervisors above the requester) Below is the query to use (for Supervisor 2 level). You just need to modify the rownum value in the last line of the query to specify the supervisor level for each corresponding supervisor level / approver group definition. Supervisor Level 1 1 1 2 2 2 ... Approver Group rownum

https://support.oracle.com/CSP/main/article?cmd=show& type=NOT& doctype=HOW... 02/04/2012

Page 2 of 3

10

10

10

select x.myameid from ( select 'PERSON_ID:'||pecx.employee_id myameid, rownum myrownum From FND_USER fndu, per_employees_current_x pecx, ( SELECT PERA.SUPERVISOR_ID FROM PER_ASSIGNMENTS_F PERA WHERE EXISTS (SELECT '1' FROM PER_PEOPLE_F PERF, PER_ASSIGNMENTS_F PERA1 WHERE TRUNC(SYSDATE) BETWEEN PERF.EFFECTIVE_START_DATE AND PERF.EFFECTIVE_END_DATE AND PERF.PERSON_ID = PERA.SUPERVISOR_ID AND PERA1.PERSON_ID = PERF.PERSON_ID AND TRUNC(SYSDATE) BETWEEN PERA1.EFFECTIVE_START_DATE AND PERA1.EFFECTIVE_END_DATE AND PERA1.PRIMARY_FLAG = 'Y' AND PERA1.ASSIGNMENT_TYPE = 'E' AND EXISTS (SELECT '1' FROM PER_PERSON_TYPES PPT WHERE PPT.SYSTEM_PERSON_TYPE IN ('EMP','EMP_APL') AND PPT.PERSON_TYPE_ID = PERF.PERSON_TYPE_ID) ) START WITH PERA.PERSON_ID = (select min(prla.to_person_id) from po_requisition_headers_all prha, po_requisition_lines_all prla where prla.to_person_id <> prha.preparer_id AND prla.requisition_header_id = prha.requisition_header_id AND prha.requisition_header_id = :transactionId) AND TRUNC(SYSDATE) BETWEEN PERA.EFFECTIVE_START_DATE AND PERA.EFFECTIVE_END_DATE AND PERA.PRIMARY_FLAG = 'Y' AND PERA.ASSIGNMENT_TYPE = 'E' CONNECT BY PRIOR PERA.SUPERVISOR_ID = PERA.PERSON_ID AND TRUNC(SYSDATE) BETWEEN PERA.EFFECTIVE_START_DATE AND PERA.EFFECTIVE_END_DATE AND PERA.PRIMARY_FLAG = 'Y' AND PERA.ASSIGNMENT_TYPE = 'E' )c where fndu.employee_id = c.supervisor_id and pecx.employee_id = c.supervisor_id )x where myrownum = 2 Then create a RULE that uses actions of 1) require approval from ... approver group 1; 2) require approval from ... approver group 2; ... etc - The single RULE will require approval from all 10 of the approver groups. (if there are only 5 supervisors above the requester, then only the first five approver group queries will return a value, and only 5 supervisors will be in the approval list. )

3. Example 3 shows how to check whether a certain user is the Nth supervisor above the preparer. EXAMPLE 3: Check whether a certain person / user is the 1st (or Nth) supervisor above the preparer of the requisition Define attribute [ XX Supervisor is Casey Brown ] based on a dynamic query like the following (this will check if the person associated to username 'CBROWN' is the 1st supervisor above the Preparer of the requisition.) select NVL('true','false') from ( select 'PERSON_ID:'||pecx.employee_id myameid, rownum myrownum From FND_USER fndu, per_employees_current_x pecx, ( SELECT PERA.SUPERVISOR_ID FROM PER_ASSIGNMENTS_F PERA WHERE EXISTS (SELECT '1' FROM PER_PEOPLE_F PERF, PER_ASSIGNMENTS_F PERA1 WHERE TRUNC(SYSDATE) BETWEEN PERF.EFFECTIVE_START_DATE AND PERF.EFFECTIVE_END_DATE AND PERF.PERSON_ID = PERA.SUPERVISOR_ID AND PERA1.PERSON_ID = PERF.PERSON_ID AND TRUNC(SYSDATE) BETWEEN PERA1.EFFECTIVE_START_DATE AND PERA1.EFFECTIVE_END_DATE AND PERA1.PRIMARY_FLAG = 'Y' AND PERA1.ASSIGNMENT_TYPE = 'E' AND EXISTS (SELECT '1' FROM PER_PERSON_TYPES PPT WHERE PPT.SYSTEM_PERSON_TYPE IN ('EMP','EMP_APL') AND PPT.PERSON_TYPE_ID = PERF.PERSON_TYPE_ID) ) START WITH PERA.PERSON_ID = (select preparer_id from po_requisition_headers_all prha where prha.requisition_header_id = :transactionId) AND TRUNC(SYSDATE) BETWEEN PERA.EFFECTIVE_START_DATE AND PERA.EFFECTIVE_END_DATE AND PERA.PRIMARY_FLAG = 'Y' AND PERA.ASSIGNMENT_TYPE = 'E' CONNECT BY PRIOR PERA.SUPERVISOR_ID = PERA.PERSON_ID AND TRUNC(SYSDATE) BETWEEN PERA.EFFECTIVE_START_DATE AND PERA.EFFECTIVE_END_DATE AND PERA.PRIMARY_FLAG = 'Y' AND PERA.ASSIGNMENT_TYPE = 'E' )c where fndu.employee_id = c.supervisor_id and pecx.employee_id = c.supervisor_id and fndu.user_name = 'CBROWN' )x where myrownum = 1 Define a Condition based on the above CUSTOM attribute: XX Supervisor is Casey Brown = true Define a Rule that uses the above condition and adds approvers as required based on this condition

https://support.oracle.com/CSP/main/article?cmd=show& type=NOT& doctype=HOW... 02/04/2012

Page 3 of 3

This is not a comprehensive example, but is offered as a starting point for using dynamic query capability in AME to achieve custom approval list functionality. Please contact Oracle Consulting for additional options and further customization required to achieve specific functionality depending on the business needs.

<e>> FOLDER:EBS.Mfg.Procurement.iProcurement TOPIC:AME:Approval Management Engine DOCUMENT-ID:960944.1 ALIAS: SOURCE:AWIZ 7774798.992 DOCUMENT-TYPE:HOWTO ZCXTECH TITLE:How to Use Dynamic Queries To Determine Approvers for iProcurement Requisitions Example Based on Requisition Line Requester? IMPACT:LOW SKILL-LEVEL:NOVICE STATUS:REVIEW_READY DISTRIBUTION:EXTERNAL ZCXCURRENT AUTHOR:DFELTON.US KEYWORD:FND_USER KEYWORD:EMPLOYEE_ID KEYWORD:PREPARER KEYWORD:APPROVAL~LIST KEYWORD:PER_EMPLOYEES_CURRENT_X KEYWORD:AME KEYWORD:PURCHASE~REQUISITION KEYWORD:IPROCUREMENT PRODID-398 COMPONENT:APPROVALS.AME MINVER:12.0.6 MAXVER: PORTID-0 FDRSEG-324 FDRSEG-307 FDRSEG-263 FDRSEG-16

References
BUG:2638127 - BASE APPROVAL OFF OF REQUESTOR BUG:3117789 - NEED APPROVAL CONCEPT BASED ON REQUESTER INSTEAD OF PREPARER Related

Products Oracle E-Business Suite > Procurement > Procurement > Oracle iProcurement Keywords AME; APPROVAL LIST; EMPLOYEE_ID; FND_USER; IPROCUREMENT; PER_EMPLOYEES_CURRENT_X; PREPARER; REQUISITION

Back to top Copyright (c) 2007, 2010, Oracle. All rights reserved. Legal Notices and Terms of Use | Privacy Statement

https://support.oracle.com/CSP/main/article?cmd=show& type=NOT& doctype=HOW... 02/04/2012

You might also like