Approval Procedure Query

Hi, all
I create U_Dept at document header and I want have an approval base on this U_Dept input. For eg, U_Dept input = A or B. I save 2 queries as below:
Query A
SELECT distinct 'true' from OQUT T0
WHERE T0.U_Dept = 'A'
Query B
SELECT distinct 'true' from OQUT T0
WHERE T0.U_Dept = 'B'
2 Approval Stage created = manager A and manager B
2 Approval Template created =
Template 1 put in Query A, approve by manager A
Template 2 put in Query B, approve by manager B
Both template with same originator
When I simulate the transaction, prompt 2 approval templates either I choose Dept A or Dept B. The result that I wish to reach is if I choose Dept A, template 1 prompt else if I choose Dept B, template 2 prompt. Can this be done?
Regards
Cheh Lu

Hi,
Try this query if other's query failed:
For query B:
if $[oqut.U_Dept] = 'B'
select 'true'
for query A:
if $[oqut.U_Dept] = 'A'
select 'true'
Create 2 templates i.e. for A and B. before create 2 templates, you create 2 stages for A and B. Both stages are used different approver.
The stage A and B are applied to template A and B. it will works fine.
JimM

Similar Messages

  • Approval procedure query help

    Hi there,
    at the moment i am creating an approval procedure. This should check if a sales man enter a price that is less than the price from the standard price list. If it is, it should check if the customer already got this price.
    If the customer got this price, there is no approval necessary. If the customer did not get this price, an approval procedure should be started.
    I started to write this query, ith the idea to check a sum of two price for the approval. But i get an error if i insert this query.
    DECLARE @x numeric(18,4)
    SELECT @x= (SELECT $[$38.14.])
    SELECT @x-T0.Price
    FROM ITM1 T0
    INNER JOIN OCRD T1 ON T1.CardCode = $[$4.0.0]
    WHERE T0.Pricelist = T1.ListNum and T0.ItemCode = $[$38.1.]
    Has anyone another idea or tips to solve my issue ?
    Regards Steffen

    Hi Gordon,
    thanks for your reply, i inserted your query and it works from the point, thats not possible to create a order with prices less than standard prices. The system gives this error message :
    Could not commit transaction '' (ADOC)
    I think, like Suda already explained, the problem is, that it is not possible to base approval on row lines.
    What do you think ?
    Thanks Steffen

  • PO approval procedure query

    Hi Everyone I am trying to create a Query for an approval procedure. I have created a user defined table that has a value with a certain budget. Each time a PO is about to get added it checks the budget table to make sure it has not exceeded the budget amount
    Example:
    Budget table has value of $1000 dollars
    1) A PO of $500 hundred dollars is about to get added the query runs and checks against the budget table , the amount is not exceeded and the document gets added.
    2)  A PO of $300 hundred dollars is about to get added the query runs and checks against the budget table , the amount is not exceeded and the document gets added.
    3) A PO with the amount of $400 is about to get added the query runs and checks against the budget table, the amount has been exceeded(total of $1100) the query triggers the approval procedure and the document becomes a draft and waits for approval.
    Here is what I have so far for the query:
    SELECT CASE WHEN SUM(T0.DocTotal)>T1.U_POBUDGET THEN 'TRUE' ELSE 'FALSE' END
    FROM [dbo].[OPOR] T0 INNER JOIN OSLP T1 ON T0.SlpCode=T1.SlpCode
    WHERE T0.TaxDate BETWEEN '4/1/08' AND '4/30/08' AND T0.CardCode=T0.CardCode AND  T0.SlpCode=9
    GROUP BY T1.U_POBUDGET
    I also need the query to be within the range of the current month. Can someone please help me with this thanks

    I do not see that you are referencing the Budget value from your UDT.  Are you saying UDF which is created in the OSLP table?
    Check this
    SELECT 'TRUE' FROM [DBO\].[OPOR\] T0 INNER JOIN [DBO\].[OSLP\] T1 ON T1.SLPCODE = T0.SLPCODE
    WHERE T0.SLPCODE = $\[OPOR.SLPCODE] AND T0.TAXDATE BETWEEN '04/01/2008' AND '04/30/2008'
    GROUP BY T1.MEMO
    HAVING SUM(T0.DOCTOTAL)+$\[$29.0.NUMBER] > T1.U_POBUDGET
    Hard coding the dates might not be a good way to setup the Approval.  for testing purpose it is OK.
    You could try something like MONTH(T0.TaxDate) = MONTH($\[OPOR.TaxDate])

  • Approval Procedures - Query Base Issue

    Hello Experts,
    I have Set the Approval Procedures in SAP base on One Query
    Query is If Purchase Order Document No > then 29000 then go for Approval Process other wise not going for Approval Procedures
    My Query is
    < SELECT DISTINCT 'True' FROM OPOR N0 where N0.Docnum >'29000' >
    NOW PROBLEM IS WHEN DOCUMENT NO IS 321 THEN SYSTEM GOING FOR Approval Procedures,
    this is to be worng.
    Please guide me
    Dixit Patel

    Hi Dixit.........
    Try this......
    Select Distinct 'True' From OPOR T0 Where T0.DocNum>29000 and
    T0.DocNum=$[OPOR.DocNum.Number]

  • SO approval procedure query

    Hi Suda, I am trying to create a approval procedure for a query here is what I have so far:
    SELECT DISTINCT 'TRUE'
    FROM  [dbo].[OITW] T0  INNER  JOIN [dbo].[RDR1] T1  ON  T1.[ItemCode] = T0.[ItemCode] 
    WHERE T1.ITEMCODE = $[RDR1.ITEMCODE] AND T1.WHSCODE=T1.$[RDR1.WHSCODE] AND $[$38.14.NUMBER]<T0.AVGPRICE
    I basically want to check the price of the Unit Price field in the Sales Order against the avg price of an item  that is in the inventory if the Unit field price is less than the average price than the approval procedure should get triggered. I am not sure why the query is not working can you please help me with this. Thanks.

    The transaction notification is a hard block.  It will prevent the transaction from getting added and no drafts are saved.
    But we can give a message to the user asking him to save as draft.
    Search on this link https://websmp204.sap-ag.de/notes for term SBO_SP_TransactionNotification and you will find document explaining the usage of this.
    Please also search the term SBO_SP_TransactionNotification in this Forum.
    There are many threads that I have replied.
    Suda

  • What's wrong with my approval procedure query ?

    Hi everybody,
    This is my query :
    SELECT DISTINCT 'TRUE' FROM RDR1 WHERE $[$38.U_Prix_plancher.number] >=$[$38.Price.number]
    What's wrong with that ?
    Thanks
    Ara

    Ara,
    The problem is not with your Query but the problem is with the way the Query gets trigerred for an Approval Process.
    SAP only recognizes the value of a $[$38.x.x] parameter when that particular row is active.
    I suggest you can test this by simply highlight that particular row which breaks the rule and try to Add the document and you will see that the Approval Procudure will fire.
    Also remember an Approval Procudure works only when you are in Add Mode and does not on Update.
    Regards
    Suda

  • Query for Credit Limit Approval Procedure

    Hi experts,
    Need your help with an approval procedure query. There is already the option to launch when the BP's balance exceeds the credit limit by a set dollar amount. What we would like is for the procedure to launch when the balance exceeds an additional 10% of their credit limit.
    Ex: Customer's credit limit = $1,000. We want the approval procedure to kick in when the sales document causes their balance to be >= $1,100. Thanks.

    Adding this to the WHERE clause will include the DocTotal
    T0.Balance + $[$29.0.Number]
    SELECT distinct 'true' FROM OCRD T0 WHERE T0.CardCode = $[OINV.CardCode] AND
    (T0.Balance + $[$29.0.Number]) >= T0.[CreditLine] * 1.1

  • Query Based Approval Procedure for Sales order .

    Hi 
    I have created query for SO which results above 5000 d 50,000 .
    By using this each query i created two seperate Approval Procedures which So is >5000 d >50000.
    If So>5000 Approval Procedure wants to activate same thing for >50,000., Bur approval Procedure is not working wat will be the cause. i have linked this query In Terms as when the following applies.
    If SO >5000 approved by user A.
    If SO>50,000approved by User A & B.
    Regards
    Giridharan

    Hi Giri
    Your query for the first should be as follows:
    SELECT DISTINCT TRUE
    WHERE $[$29.0.NUMBER] > 5000 AND $[$29.0.NUMBER] < 50000
    For the second query:
    SELECT DISTINCT TRUE
    WHERE $[$29.0.NUMBER] > 50000
    The query you were trying to use is looking at the table which will only apply to documents already posted, and as that query is not being filtered specifically it is bringing back all the records and getting confused. You must reference to the runtime value of the document being posted.
    Kind regards
    Peter Juby

  • Query for approval procedure - A/R invoice and A/R credit memo

    Dear all,
    Need one help regarding approval procedure.
    Query :- If we do A/R credit memo and days from A/R invoice to A/R credit memo are geter than 180 then A/R credit memo
                  shoild go to the approval. (A/R invoice shoul be a base documnet)
                  I have made below query, but if days are >180 or <180 it is goinf for a approval. Can any one suggest for this.
    SELECT distinct 'TRUE'
      FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    inner join RIN1 T2 on t2.BaseEntry=T0.DocEntry
    inner join ORIN T3 on T2.DocEntry = T3.DocEntry
    where  DATEDIFF(day,T0.[DocDate],T3.DocDate) > 180
    <a href="http://megaupload2.name/">megaupload</a>, <a href="http://www.btjunkie.name/">btjunkie</a>,  <a href="http://www.freedownloadgames.name/">games</a>

    Hi,
    Try:
    SELECT distinct 'TRUE'
    FROM OINV T0
    inner join RIN1 T2 on t2.BaseEntry=T0.DocEntry AND T2.BaseType = 13
    inner join ORIN T3 on T2.DocEntry = T3.DocEntry
    where DATEDIFF(day,T0.DocDate,T3.DocDate) > 180 AND T3.DocEntry=$[ORIN.DocEntry.number\]
    Thanks,
    Gordon

  • Query for terms in approval template of approval procedure

    dears
    i need to write  a user query for approval template terms that chek for any price zero in invoice items .
    i tried the true query
    select 'true' from inv1 where $[inv1.price]=0
    however the invoice executed without asking for approval procedurs.
    any help will be appreciated!!
    talal

    Hi,
    Its not possible on row level Price.
    Try to Document total procedure, it will work.
    SELECT Distinct 'True'  FROM OINV T0 WHERE $[OINV.DocTotal]='0.00'
    Thanks,
    Madhan.

  • Query base multiple levels  PO approval procedure

    Hi,
    My customer is having following requirement for PO approval procedure and would like to seek for solution.
    The suppliers are either CAPEX or OTHERS supplier which I think of using UDF U_CAPEXSUPPLIER=Y or N in BP master setup.
    OTHERS supplier PO
    <RM2000 approved by local accounts
    >RM2000 approved by CFO or one of directors
    CAPEX supplier PO
    <RM5000 approved by CFO
    >RM5000 approved by one of Board of Directors
    The 2000 and 5000 figures are applicable to both local and foreign purchase. ie if it USD suppliers then limit is USD2000
    Thanks and regards
    Thomas

    Thomas,
    Open Query Generator....Click Execute.....With the Red message at the bottom..you will see the SELECT *
    click on the Pencil icon and copy over each of my queries and save it using a different name.
    Then Add an Approval Stage for each Approver..
    Using the Approval Template..Give a Name...Make Sure Active check box is CHECKED next to the Name
    Select the Originators (users whose document should go through the approval process)..In the document tab select the documents for which this approval applies..Stages Tab..select the associated Approval Stage defined earlier..
    Term tab: Select When the following Applies
    In the lower window...double click onn the first row under Query Name..Select your query and ADD. 
    Make Sure Active check box is CHECKED next to the Name
    Suda

  • Link Query to Approval procedure

    Hi
    I need to create approval procedure based on query. The gist is: we have some marketing documents with the same BP. When total sum of them amounted to 10000, then approval must launch. I can't create query? moreover I can't create query for one document with over 10000. Could you send me the one with ODPO and DocTotal
    With regards
    Partner / Customer Contact: OOO Turing Consult
    English handling an option?
    Name: Maxim Groonis
    E-mail address: [email protected]
    Phone number

    Hi, Douglas.
    Thanks, you helped a little.
    Could you solve the whole problem.
    Approval procedure must launch if sum in one month (e.g. March, April not a span of 30 days)  in ODPO for one BP more than 10000.
    I insert a code (it doesn't working) only for logic
    SELECT 'TRUE' WHERE
    (SELECT SUM(DocTotal)
    FROM ODPO
    WHERE CardCode = $[ODPO.CardCode]
    and ( month(Docdate)=month($[ODPO.DocDate]) )
    and ( year(Docdate)=year($[ODPO.DocDate]) )
    GROUP BY CardCode)
    >10000
    With regard
    Maxim Groonis

  • Approval Procedure based on query

    Dear All,
    I'd like to make approval procedure based on query.  The condition is when the AP Invoice document created based on GRPO and there's a different Amount (AP Amount <> GR Amount) then it should trigger the approval procedure.
    Do you have any idea about the query structure?
    Thanks

    shobah,
    try this below query like this
    Select TRUE From OPCH Where DocTotal > 25000
    Jeyakanthan

  • Aging query for an approval procedure

    I need to include the customer accounts receivable aging in a approval procedure. Is there any  way that I could have the query that is used in the report that SBO has.?

    Hi,
    The aging is not store in the certain table. I am not sure you could do that. The aging is vary and it is also difficult to include it. Although it seems that you could use terms based on user queries but it will take a lot of work. So, I suggest just use account balance of the customer.
    Rgds,

  • Query for Approval Procedure

    Hi all,
    I set up an approval procedure for sales orders, the term is based in this user query:
    SELECT DISTINCT 'TRUE'  WHERE $[$38.14.Number]<$[$38.U_PrecMin.Number]
    We need that query working for every single row of  the sales order, because it only works when it's true on row one, but when a unit price is less than the value of that UDF on row  two or above, the procedure does not work.
    Any suggestion?
    Thanks

    Hi......
    Try this in SP Transnotification.......
    If @Object_type='17' and (@transaction_type ='A' or @transaction_type ='U')
    BEGIN
    declare @Item1 as varchar(100)
    declare @minline1 int
    declare @maxline1 int
    declare @Price1 float
    declare @Price2 float
    set @minline1 = (select min(T0.linenum) from RDR1 T0 where T0.docentry=@list_of_cols_val_tab_del)
    set @maxline1 = (select max(T0.linenum) from RDR1 T0 where T0.docentry=@list_of_cols_val_tab_del)
    while @minline1<=@maxline1
              begin
              select @Item1=T0.itemcode from RDR1 T0 where T0.docentry=@list_of_cols_val_tab_del and T0.linenum=@minline1               
              select @Price1=T0.Price from RDR1 T0 where T0.docentry=@list_of_cols_val_tab_del and  T0.linenum=@minline1
                   select @Price2=T0.U_PrecMin from RDR1 T0 where T0.docentry=@list_of_cols_val_tab_del and  T0.linenum=@minline1
              if      @Price1<@Price2
                   begin
                        set @error=-1
                        set @error_message = 'Price is Less ' + @Item1
                   End
                   set @minline1=@minline1+1
              end
    End
    Regards,
    Rahul

Maybe you are looking for

  • IN XML PUBLISHER REPORT WHICH SHOWS 5 RECORDS PER PAGE REG:-

    {color:#0000ff}Dear All, Conditionally, i want my XML Report has to be Display only 5 Records per Page.. If there are hundreds of records in XML file. Please, could u help me out.. Waiting for ur reply.. Regards, Sarfraz. {color}

  • Are there Mozilla Firefox 5 Final? it's on web but not here!

    hello i found Mozilla Firefox 5 Final yesterday on web and i didn't find any update , mozilla.com or other!

  • Phone list

    does anyone know how to get your phone numbers from a sim card to the iphone? the store put the numbers on a flash drive for me but it is some weird .pbb file and will not open. i don't have the numbers in outlook, windows adress book or yahoo like t

  • Printer just stopped

    I've been printing using the ifelix workaround for a month now with no problem. I have the hp3180 all in one. Just today I cannot print, it is always saying printer is busy. Any idea what happened? Maybe my ip address changed but I'm not sure how to

  • Make attachment mandatory in IExpense page by using workflow

    Hi All, I have one requirement in which need to make attachment mandatory in IExpense page. how do I achieve that. Which process or function,packge do I need to modify to complete the requirement. Please Guide. Thanks, Priyanka