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]

Similar Messages

  • Approval procedure for goods issue

    Dear Expert,
    We would like to set approval procedure for goods issue base on the following criteria:-
    1. Only goods issue related to "write Off"
    2. We indicate "W/off" at Ref2 field
    Can anyone help me on this?
    Thank you.
    Regards,
    Ng

    Ok....
    Try this....
    Select Distinct 'True' From OIGE T0 Where T0.Ref2='W/off' and T0.DocNum=$[OIGE.DocNum.0]
    It would be OIGE.DocNum.0 and not OIGN.Docnum.0
    Please try above query for approval as it works fine in my DB
    Regards,
    Rahul

  • 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])

  • 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

  • Enhanced Approval Procedure Functions- authorization issue

    Dear Expert,
    I have activated the enhances approval procedure function as per below screen shot:
    Granted authorization as mention in New ChaRM Feature with SP 10: Enhanced Approval Procedure Functions by Michael. With SM_APP_AP with 02, 22 and 75.
    But the Request for change procedure selection and approval steps was disabled
    The requestor able to change the approval procedure and approval steps only  if i granted the user with 70 (administer).
    Please help as i want the requestor to be able to select the approval procedure and approval steps but not approving the CR. Im following the chart below but seem like is not working.
    Role
    SAP standard roles
    Activity for
    Change Manager
    SAP_CM_SMAN_CHANGE_MANAGER
    37 (approve) approval step, 75 (delete approval step), 22 (add approval step), 02 (change approval procedure assignment)
    Potential Approvers
    SAP_CM_SMAN_DEVELOPER
    SAP_CM_SMAN_OPERATOR
    SAP_CM_SMAN_TESTER
    37 (delivered inactive)
    Power User, Administrator
    SAP_CM_SMAN_ADMINISTRATOR
    70 (administer), 37 (approve) approval step, 75 (delete approval step), 22 (add approval step), 02 (change approval procedure assignment)
    Thanks
    Regards,
    Junnie

    Hi Jansi,
    I have added activity 22 (add approval step)  and 02 (change approval procedure assignment) but the approval procesure and approval step are disabled and not allow the requestor to select /add/ male changes.
    So im not sure which part is going wrong.
    Thanks
    Regards,
    Junnie

  • 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

  • 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

  • Approval Procedure For Issue For Production form

    Hi All,
    How to Defind the Approval procedure For the Issue For Production tell me is it possible or not
    vikas

    Hi Vikas,
    As workaround you can set the approval to the stock transfer for the production warehouse and allow only issue for production from that production warehouse.
    Cheers

  • Goods Issue Approval Procedure

    Hi Experts,
    In Document Approval Procedure on Goods Issue Doc. can i make Approval Procedure for a particular G/L Accout.
    i.e. I select an Item  Code for Goods Issue and selected a particular G/L A/c. as  50102001 - Scrap Account then it should forward to Approval otherwise if that A/c. is not selected in Goods Issue form it should Add directly.
    Awaiting for your helpful reply.
    Regards,
    Ravi

    Hi Ravi....
    Approval Procedure is not possible for Row Level Details...
    It is always possible for Document Level data....
    Regards,
    Rahul

  • 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

  • Query approval procedures issue

    Hi all
    I'm creating a query for approval procedure in Sales orders. This query is working fine:
    SELECT DISTINCT 'TRUE' FROM ORDR T0
    WHERE CAST ($[ORDR.DocTotal] AS decimal(19,6))>= $[ORDR.U_Credito]
    But the one above give the following error get an error:  Could not commit transaction: Error -1 detected during transaction
      SELECT DISTINCT 'TRUE' FROM ORDR T0
    WHERE CAST ($[ORDR.DocTotal] AS decimal(19,6))>= ($[ORDR.U_Credito]*0.2)
    How can i multiply that field to get 20%.
    The field ORDR.U_Credito is type amount
    Kind Regards,
    Margarida Pedroso
    Edited by: Margarida Pedroso on Nov 6, 2011 12:21 AM
    Edited by: Margarida Pedroso on Nov 6, 2011 12:23 AM
    Edited by: Margarida Pedroso on Nov 6, 2011 12:42 AM

    Hi Margarida Pedroso,
    Try:
    IF $[ORDR.DocTotal.number\] >= ($[ORDR.U_Credito.number\]*0.2)
    SELECT DISTINCT 'TRUE'
    Thanks,
    Gordon

  • 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 base approval for PO Unit Price

    Dear All,
    I want a Query Base approval
    Scenario: If Purchase Order Unit Price Exceed form 10000/- INR then Purchase Order Goes to the  Approval
    Do any one have a Query base approval for above Scenario?

    In an approval query you can not access all the row level data. (Only the first line.)  So you can not connect your approval on row level conditions.
    I can suggest one (but a little uncomfortable and complicated) workaround for approval on line level:
    1. Create a header level UDF e.g. named ForApproval with possible values Y and N, with default value N.
    2. Write code in the SBO_SP_TransactionNotification stored procedure, that signals an error message u2018You should set ForApproval to Y!u2019  if U_ForApproval=u2019Nu2019 and there is any line with fulfilling your criteria.
    3. Set an approval procedure according to the header level ForApproval field.

Maybe you are looking for