Approval Limits Count Query

We have job titles, and job titles have approval limit attached to them.
Approval limits work against document types - so that for example, job title 'Extended Services Strategy Manager::CA:CB:46' might be able to approve:
1. Standard Purchase Orders
2. Purchase Requisitions
3. Internal Requisitions
This is a sample SQL to show how tables are joined:
The following SQL details how the tables are joined
SELECT   pj.NAME
  2         , pcf.control_function_name
  3         , pcga.control_group_name control_group
  4         , pcr.amount_limit
  5      FROM po.po_position_controls_all ppca
  6         , po.po_control_groups_all pcga
  7         , po.po_control_functions pcf
  8         , po.po_control_rules pcr
  9         , hr.per_jobs pj
10     WHERE ppca.job_id = pj.job_id
11       AND pcga.control_group_id = ppca.control_group_id
12       AND pcf.control_function_id = ppca.control_function_id
13       AND pcr.control_group_id = ppca.control_group_id
14       AND pcr.object_code = 'DOCUMENT_TOTAL'
15       AND pj.NAME IN
16              ('6th Form Admin and Cover Officer::AA:AE:5031'
17             , 'Acc Asst/Auditor:G:KB::')
18  ORDER BY pj.NAME;
NAME                                                               CONTROL_FUNCTION_NAME             CONTROL_GROUP   AMOUNT_LIMIT
6th Form Admin and Cover Officer::AA:AE:5031                       Approve Purchase Requisitions     GG £5000                5000
6th Form Admin and Cover Officer::AA:AE:5031                       Approve Standard Purchase Orders  GG £5000                5000
6th Form Admin and Cover Officer::AA:AE:5031                       Approve Purchase Requisitions     GH £5000                5000
6th Form Admin and Cover Officer::AA:AE:5031                       Approve Standard Purchase Orders  GH £5000                5000
6th Form Admin and Cover Officer::AA:AE:5031                       Approve Purchase Requisitions     GJ £5000                5000
6th Form Admin and Cover Officer::AA:AE:5031                       Approve Standard Purchase Orders  GJ £5000                5000
Acc Asst/Auditor:G:KB::                                            Approve Purchase Requisitions     AC £10000              10000
Acc Asst/Auditor:G:KB::                                            Approve Standard Purchase Orders  AC £10000              10000
Acc Asst/Auditor:G:KB::                                            Approve Internal Requisitions     AC £10000              10000
9 rows selected.
SQL>Each of the 'CONTROL_GROUPS', stored in the po.po_control_groups_all table hold the name of a Control Group - e.g. GG £5000.
Each CONTROL_GROUP has a rule attached to it (stored in the po.po_control_rules table).
The rule has an approval value attached to it (abount_limit).
The 'CONTROL_GROUP' is also attached to a control_function_name, which is just a document type. So we can say, for example, that against a job title, a user can approve Standard Purchase Orders, and Purchase Requisitions, for the GG Service Segment, for a value of £5000.
Our policy states that the abount_limit against a job title should always be the same. As you can see above - the amount_limit for the 6th Form Admin and Cover Officer::AA:AE:5031 is only ever set to £5000.
However, there are job titles where the amount_limit value contains 2 or more different values against a job title.
I need a way to identify these job titles, but I cannot work out how to do it.
I could do a count of CONTROL_GROUPS against a job title, but that doesn't help a lot:
SELECT   pj.NAME
  2         , COUNT(*) ct
  3      FROM po.po_position_controls_all ppca
  4         , po.po_control_rules pcr
  5         , hr.per_jobs pj
  6     WHERE ppca.job_id = pj.job_id
  7       AND pcr.control_group_id = ppca.control_group_id
  8       AND SYSDATE BETWEEN ppca.start_date AND NVL(ppca.end_date, SYSDATE + 1)
  9       AND pcr.object_code = 'DOCUMENT_TOTAL'
10       AND pj.NAME IN
11              ('6th Form Admin and Cover Officer::AA:AE:5031'
12             , 'Acc Asst/Auditor:G:KB::')
13  GROUP BY pj.NAME
14  ORDER BY 2 DESC;
NAME
6th Form Admin and Cover Officer::AA:AE:5031                                              6
Acc Asst/Auditor:G:KB::                                                                   3
SQL>Because I can see now that there are 6 rules attached to the first job title. Ideally, what would be great would be to find a way to modify the Counbt SQL statement above, to include a 3rd column which did a distinct count of how many different 'amount_limits' were also attached to the job title.
That is where I am very stuck.
Any help much appreciated.
Sorry for writing so much. Seems easier to write too much, than not enough. I can provide desc outputs for the tables as well, but haven't done right away, because it'd make this post even longer...

Hi Colin,
thanks for your reply.
Sorry for asking a silly question - I'm not familiar with what DDL and DML are - would that be the same as me doing something like:
desc table_name;
And supplying the table structures of the tables in question?
Just checked on Google, and found:
http://www.orafaq.com/faq/what_are_the_difference_between_ddl_dml_and_dcl_commands
But I'm still not too sure what you would like me to supply...
Sorry.

Similar Messages

  • Approval Limits Report

    Hi,
    I am trying to create a report for giving the approval limits based on the organisation that employees work for however have hit a problem I think possibly with the way the data is set up in our organization but I can't seem to find a way around it. The report needs to display the employee (from per_all_people_f), their job (from per_jobs), their approval limit (from po_control_rules) and the name of the control group (from po_control_groups_all). You need to go through the table 'po_position_controls_all' in order to link per_jobs to po_control_rules and its this table I think which is causing the issue because of a one-many relationship between jobs and control groups.
    The below SQL:
    select PJ.JOB_ID, PJ.name, PPCA.CONTROL_GROUP_ID, PPCA.ORG_ID, PCR.AMOUNT_LIMIT, PCGA.CONTROL_GROUP_NAME, PCGA.ORG_ID
    from APPS.PER_JOBS PJ
    inner join APPS.PO_POSITION_CONTROLS_ALL PPCA on PPCA.JOB_ID = PJ.JOB_ID
    inner join APPS.PO_CONTROL_RULES PCR on PCR.CONTROL_GROUP_ID = PPCA.CONTROL_GROUP_ID
    inner join APPS.PO_CONTROL_GROUPS_ALL PCGA on PCGA.CONTROL_GROUP_ID = PPCA.CONTROL_GROUP_ID
    where 1=1
    and PJ.name = 'Job A'
    and PPCA.CONTROL_FUNCTION_ID = 1
    and PCR.OBJECT_CODE = 'DOCUMENT_TOTAL'
    and PCGA.ENABLED_FLAG = 'Y'
    Gives a result like this: (I have simplified the data and note that there are many jobs and UP TO 3 approval groups per job (as we have 3 organisations but there may be one or 2))
    JOB_ID | NAME | CONTROL_GROUP_ID | ORG_ID | AMOUNT_LIMIT | CONTROL_GROUP_NAME | ORG_ID_1
    1 | Job A | 11 | 1 | 100 | Approval Level 100 | 1
    1 | Job A | 12 | 2 | 200 | Approval Level 200 | 2
    1 | Job A | 13 | 3 | 300 | Approval Level 300 | 3
    Now I am guessing although haven't looked in to it yet that the way it works in the application when approving a PO it will see which org the PO is for (a column in the PO tables) so cross referencing that with the job id of the approver it will be able to get a single "amount limit" they can approve up to however in the report I don't have this context so if I have some employee data like this:
    Employee Name | JOB_ID | Who they approve PO's for (org)
    Bob | 1 | 1,2
    Paul | 1 | 1
    Harry | 1 | 3
    Terry | 1 | 2
    If i write a query for my report no matter what "org_id" I supply it (for PPCA or PCGA) it will always return all 4 employees, however I want to be able to get back that for org 1 Bob and Paul approve them (with a limit of 100) and for org 2 Bob and Terry approve (with a limit of 200) and for org 3 Harry approves (with a limit of 300)
    Edited by: pnj on 15-Nov-2012 07:17

    Hi pskumar, thanks for your reply. Unfortunately the orgnaization_id in per_all_assignments_f is populated by the business unit which the 3 different organisations are under. Basically (other than looking at a person's responsbilities which doesnt have an organization_id on either) there doesn't seem to be way of establishing who works for each organization. I've seen some trends, like their address, or their cost centre but it isn't accurate enough.
    Thanks

  • Buyer Approval Limits - r12

    Hello
    This is on r12.1.3
    I have a requirement where, I need to generate listing / report that meet following criteria.
    1. Employees who are buyers
    2. Buyers with their approval limits
    3. Buyers/Employees and their reporting manager
    4. Buyers/Employees and their job title.
    We do not use RBAC.
    Please advise if there is such report or query handy to deliver above output.
    Thanks,
    Darsh

    Hi Darsh,
    You may check out the following documents from Metallink:
    How To Query Approval Group and Approval Assignment Details For iProcurement And Purchasing Users (Doc ID 382899.1)
    How To Query Approval Group and Approval Assignment Details For iProcurement And Purchasing Users (Doc ID 382899.1)
    James

  • IExpense Approval limits

    Hi ,
    We are implementing iExpense for our client which has an employee count of 2300 and they don't have a proper approval limits with appropriate signing limits defined so can any one post me some leading practice implemented by clients which would be feasible by an organization which has an employee count of 2300.

    One workaround is to enable AME for iexpenses and then write your custom rule in AME to simply look at the PO approval groups.
    Look at
    http://apps2fusion.com/at/49-cp/289-iexpense-implementation-steps
    The other approach is to write custom code for inserting records into ap_web_signing_limits. I don't think there is an api for this.
    Also you have to keep it in sync with the po approval data. It will not be easy because you have to update ap_web_signing_limits every time approval groups are modified, approval assignments are modified, employee positions are changed, employees are end-dated etc.
    Hope this helps,
    Sandeep Gandhi

  • Doing a Trace on the ARXADLMT Approval Limits form No Select statement i

    Hi I want to see the all the SQL statements executed when I open the AR Approval Limits form(ARXADLMT). So I enabled the TRACE from the Menu(supplying password) , then opened then form and did a Query-> Execute. (The base table for the block is AR_APPROVAL_USER_LIMITS.Then I turned off the trace exited applications and went to the USER_DUMP_DEST directory of the database. From here tkprofed the latest trace file .When I look at the output file I cant see any Select statements at all. At least I should be seeing a select on the base table AR_APPROVAL_USER_LIMITS. Maybe I havent understood this process well enough- what am I doing wrong.Why is the trace not containing the select statement?
    Edited by: [email protected] on 13/06/2010 03:18

    >
    ... From here tkprofed the latest trace file ...
    >
    Pl post details of your OS and EBS versions. The latest trace file may not be the correct one. Pl search the trace files for "AR_APPROVAL_USER_LIMITS" to find the right trace file.
    How To Trace From Form, Report, Program And Others In Oracle Applications (Doc ID 130182.1)
    https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=130182.1&h=Y
    HTH
    Srini

  • Credit memo (CM) Approval limits set are not being checked in CM creation

    Hi,
    Customer: ARROW ELECTRONICS INC
    SR: 6502816.993
    Customer has set the approval limits for credit memo in Receivables
    He has set the approval limit as -500 to 0 for a user X.
    Created an invoice for 550 $
    Gone to Ireceivables and created a dispute for the complete amount (-550$) of the invoice.
    Find that the notification is going to the user X even when the amount is not within the approval limits set.
    He is able to approve the notification and it is going to the next level approval.
    Once that is done the credit memo is getting created.
    Checked the packages involved in this.
    ARWCMWFB.pls
    Find that there is no checking of the approval limits in the package.
    Please help me in knowing on whether this is an intended functionality.
    Thanks and regards,
    Hareesh

    Hareesh
    Using HR Hierarchy
    1. Define three approvers A, B, C for the same reason code and with different approval limits (as this is credit memo the guy with highest negative amount has is the final approver).
    2. A reports to B and B reports to C
    3. A is approval limit is from -100 to -500, B can approve from -500 to -1000 and C can approve from -1000 to -1500 (all of them have same reason code and currency code).
    4. Make sure all of them are employees.
    5. Make sure you **DO NOT** check the flag Primary Approver for any of these approval limits in the approval limits screen.
    6. In the employees -- Assignments For A, enter supervisor as B, and For B enter Supervisor as C.
    7.No enter an invoice for 1200 and complete it.
    8. Request for credit from iReceivables for the same invoice for -1200.
    9. Now you can see that the notification will go to B and C for approval.
    Using Approval Limits hierarchy:
    If you do not want to use the employee setup, they can always, use the primary check box. With the same example as above, check the primary check box for A, B and C.
    When you request for credit, first A gets, next B gets it and then C gets it.
    If you check for only C which is the final approver, workflow will send only one notification and once C approves it will forward.
    Ofcourse, before any of these guys are approving, collector assigned to the customer has to approve.
    And after all these approvals one more Role (called Receivable Role which can be anybody according to the WF definition) has to approve before the credit is generated).
    Now, I am not sure what the customer wants. Do they want multiple approvals or single approval? If they want multiple they have to use the first approach. If not they can use the second approach.
    I did a test case again and these comments are the results of the test. I did this on 11.5.9.
    Let me know if you have any questions. Also please refer to the metalink note 284804.1How Does Credit Memo Workflow Notify Multiple Approvers?.
    Thanks
    Nagamohan

  • Incorrect count query

    I'm using CursoredStream to fetch a large result set. When doing a cursor.size() Toplink generates the wrong count query. I do have group value functions in the query as shown below.
    For e.g. this is the cursor query:
    --- Actual select query ---
    SELECT t0.AWARD_ID, t0.AWARD_NUMBER, t0.FINAL_AMOUNT, t2.NAME,
    SUM(t1.REPORT_AMOUNT), t4.FISCAL_YEAR, t5.DESCRIPTION
    FROM REF_ENTITY t6, T_CODE t5, SOL t4, APP t3, APP_VERSION t2, SUBG t1,
    AWARD t0
    WHERE ((((t4.FISCAL_YEAR = '1993') AND (t6.REF_ENTITY_ID = 5)) AND (t4.SUBG_
    REPORT = 'Y')) AND ((t5.T_CODE_ID = t0.T_CODE_ID_STATUS) AND ((t2.APP_ID = t3.A
    PP_ID) AND ((t6.REF_ENTITY_ID = t4.REF_ENTITY_ID) AND ((t4.SOL_ID = t3.SOL_ID)
    AND ((t3.APP_ID = t0.APP_ID) AND (t0.AWARD_ID = t1.AWARD_ID)))))))
    GROUP BY t0.FINAL_AMOUNT, t0.AWARD_ID, t0.AWARD_NUMBER, t4.FISCAL_YEAR, t5.D
    ESCRIPTION, t2.NAME ORDER BY t0.AWARD_NUMBER ASC
    The count query generated by Toplink is:
    SELECT COUNT(*)
    FROM REF_ENTITY t4, AWARD t3, APP t2, SOL t1, SUBG t0
    WHERE ((((t1.FISCAL_YEAR = ?) AND (t4.REF_ENTITY_ID = ?))
    AND (t1.SUBG_REPORT = 'Y')) AND ((t4.REF_ENTITY_ID = t1.REF_ENTITY_ID)
    AND ((t1.SOL_ID = t2.SOL_ID) AND ((t2.APP_ID = t3.GMS_APP_ID)
    AND (t3.AWARD_ID = t0.AWARD_ID)))))
    I have to provide my own ValueReadQuery to get the correct count in the above case. Are there any rules for determining when we have to explicitly provide our own count query?
    cheers
    p.s: Toplink version 9.0.3.4

    Abe,
    This sounds like a bug. I assume you are using a ReportQuery to generate the initial SQL. You should only have to provide a ValueReadQuery to a cursored query when using SQL, stored-procedure, or to optimize what is being generated.
    This looks like the group-by on your ReportQuery is being ignored on the size query. The best plan is to submit this to support with the TopLink code used and the information provided in this post.
    In the mean time the work-around of providing your own query is probably the best solution.
    Doug

  • PPOMA Approval Limits - Report

    Hi All,
    Is it possible to report out on approval limits that are assigned to positions within PPOMA
    Thanks
    Neil

    Did you find the answer? because I have the same doubt.
    Thanks a lot and best regards, sapera

  • APPROVAL LIMITS IN ORACLE RECEIVABLES

    Whilst in the AR Corporate Super User responsibility in Vision Operations, I defined approval limits for a an application user with a currency of GBP and an amount ranging from £5000 to£6000 and then saved it. Later, I then decided that I wanted to change the amounts from lets say £10,000 to £20,000. Whwn I call up the user in the Approval limits window in AR and I try to click in the currency filed I get the following message:
    APPS_AR_11290 The approval limit for the user (eg Fred)for the currency GBP already exists. How do I change the amounts
    and what reports can I run to see the various users and their approval limits? please advise me

    Hi,
    For your current requirement please follow the below procedure.
    1. Disable the Automatic Transaction Numbering In the Transaction Window.
    Navigation: Receivables Manager --> Setup --> Transactions --> Sources.
    In the transactions sources window Disable the Automatic Transaction Numbering.
    Now we are able to create the transactions with alphabetical numbering.
    Regards.
    Raju.

  • Count Query Performance

    How can we improve the perfromace of a count query?
    Suppose I have a table A that holds more than 50 million rows.
    Now if i want to count the no of rows which is the best one
    1) Select count(*) from A.
    Definitely not as it is doing a full table scan
    2) Select count(primary_key) from A.
    3) Select count(row_id) from A.
    One more question whats the difference between select count(*) from table_name and select count(1) from table_a. Many people suggest count(1) and i dont see any reason though.
    Kindly guide me.

    > Please see my points 1,2 and 3.
    Can this change the execution plan (path) of the CBO in anyway?
    1. count rows
    2. count rows using primary key
    3. counting rows using physical row addresses
    The fact is that the rows, and all the rows, need to be counted. The CBO will choose the most "attractive" I/O path - i.e. the smallest one, the one with the least amount of I/O. It does not need tricks like COUNT(1) or COUNT(PK) or COUNT(ROWID) in order to make an appropriate decision.
    Example:
    SQL> create table tab1 nologging as select level as ID, LPAD('*',4000,'*') as STUFF from dual connect by level <= 10000;
    Table created.
    SQL> set autotrace on
    Running a SELECT COUNT(*) without any alternate I/O paths (no indexes exist)
    SQL> select count(*) from tab1;
    COUNT(*)
    10000
    Execution Plan
    Plan hash value: 899213575
    | Id | Operation | Name | Rows | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 2306 (4)| 00:00:28 |
    | 1 | SORT AGGREGATE | | 1 | | |
    | 2 | TABLE ACCESS FULL| TAB1 | 9982 | 2306 (4)| 00:00:28 |
    Note
    - dynamic sampling used for this statement
    Statistics
    28 recursive calls
    0 db block gets
    10087 consistent gets
    10000 physical reads
    0 redo size
    208 bytes sent via SQL*Net to client
    238 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed
    Creating an PK index
    SQL> alter table tab1 add constraint pk_tab1 primary key(id) using index;
    Table altered.
    Running the same SELECT COUNT(*) - but the CBO now sees that the PK index
    is smaller and cheaper to scan than scanning the table
    SQL> select count(*) from tab1;
    COUNT(*)
    10000
    Execution Plan
    Plan hash value: 1796789124
    | Id | Operation | Name | Rows | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 9 (23)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | | |
    | 2 | INDEX FAST FULL SCAN| PK_TAB1 | 9982 | 9 (23)| 00:00:01 |
    Note
    - dynamic sampling used for this statement
    Statistics
    194 recursive calls
    0 db block gets
    131 consistent gets
    20 physical reads
    0 redo size
    222 bytes sent via SQL*Net to client
    238 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    5 sorts (memory)
    0 sorts (disk)
    1 rows processed
    SQL>

  • Approval limits

    Dear all
    I neeed to set approval limits for concerened employees and set hierarchies for purchase requistions and Purchase orders in oracle purchasing. how can it be done. Kindly update
    Regards
    Arifuddin

    Hi Colin,
    thanks for your reply.
    Sorry for asking a silly question - I'm not familiar with what DDL and DML are - would that be the same as me doing something like:
    desc table_name;
    And supplying the table structures of the tables in question?
    Just checked on Google, and found:
    http://www.orafaq.com/faq/what_are_the_difference_between_ddl_dml_and_dcl_commands
    But I'm still not too sure what you would like me to supply...
    Sorry.

  • Define Credit Memo Approval Limits for Approvers in receivables

    Hi is there any way we can setup approval of credit memos in receivables to go directly to the persons manager who is inputting the memo ?
    much like a requisition does when its sent for approval?
    ie it just keeps going up the hierarchy until it finds some one who can approve?

    Refer to Re: Credit memo (CM) Approval limits set are not being checked in CM creation
    Thanks
    Nagamohan

  • Auditors and PO Approval Limits

    We are in process of an internal audit. One of the advance questions is regarding PO/PR approval limits in Oracle. The auditors have requested an Oracle Report detailing the Buyers Approval limits.
    I have not found a standard report. Would some one be able to advise a method of pulling this data easily, or on demand based on Auditors and Users requests. I would like the ability to view all levels, specific jobs or persons. But any method would be apprciated. (we use employee/supervisor as approval method)
    Is this possible without customizing?
    Tom

    You can obtain some of the data from using the Tools > Export Data option on the Position Hierarchy screen.
    Refer to Metalink note: 280495.1 and Metalink Note: 360105.1.
    Hope this helps,
    Sandeep Gandhi

  • SETTING UP APPROVAL LIMITS IN AR IN VISION OPERATIONS

    Whilst in the AR Corporate Super User responsibility in Vision Operations, I defined approval limits for a an application user with a currency of GBP and an amount ranging from £5000 to£6000 and then saved it. Later, I then decided that I wanted to change the amounts from lets say £10,000 to £20,000. Whwn I call up the user in the Approval limits window in AR and I try to click in the currency filed I get the following message:
    APPS_AR_11290 The approval limit for the user (eg Fred)for the currency GBP already exists. How do I change the amounts
    and what reports can I run to see the various users and their approval limits? please advise me

    you need to use AR approval limits form for the apropriate organization.
    merci,
    iguru

  • Count query taking time

    I have a query -->select c1,c2,c3 from table1 . This query takes only few milliseconds. But when I take count from the same query i.e. when I execute select count(c1,c2,c3) from table1 then it takes a very long time (about 1 min). The table1 contains about 25000 rows. Please help to improve performance of Count query.

    Satej wrote:
    I have a query -->select c1,c2,c3 from table1 . This query takes only few milliseconds. But when I take count from the same query i.e. when I execute select count(c1,c2,c3) from table1 then it takes a very long time (about 1 min).Classic misperception of Toad, SQL Navigator and similar tool users. All these tools fetch just first result screen and show time it took to fetch just that and not the time to fetch all rows. And in order to count you need to fetch all rows.l That is why select count(*) takes longer. But 1 min for 25000 rows is a bit long. Check execution plan to see what is going on.
    SY.

Maybe you are looking for

  • Err1Err3 message on startup

    Hey folks, I have been having a problem starting up my computer. First, my computer stats: HP Pavilion Elite Mm9340f, windows vista 64 When I start up the computer, I simply get the HP logo on the blue screen and then it goes to a black screen with t

  • Undergrad Students: Co-Op position available using LabVIEW

    To Whom It May Concern: It is good to see the recent posts about LabVIEW jobs, and we have a Co- Op position available using LabVIEW. I recently posted a similar message to the info-LabVIEW mailing list, and someone there recommended I also post to c

  • A second web browser opens when I initially open firefox.

    a second web browser opens when I initially open firefox. This also happens in Aurora.

  • Using static import

    I just downloaded the 2.2ea. I tried using the static import feature. When I try to import my own classes f.ex. import static test1.test2.TestInferface; i get the error cannot find symbol symbol : class test2 location: package test1 import static tes

  • My Mac locks up - can't understand why

    Been having issues with my home Mac as of late (dual 2.3Ghz processor, pre-Intel age, running OS 10.4.11). I had been having some instances lately where it started "locking up," and the fan would slowly start to spin until it got really loud. The fir