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

Similar Messages

  • Approval procedure issue

    Hi,
    I need a query for outgoing payment approval, if cash is more than 1000 then approval should get activated.
    Below query is not working. Any chages?
    Select 'true' where $[$ovpn.CashSum] > 1000
    Regards
    Shashi

    hi shashi,
    Read this Note 1165619 - Cannot add outgoing payments in approval procedures
    https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1165619
    Edited by: Jeyakanthan A on Sep 12, 2009 10:13 AM

  • Query approval procedure-SO approval if there is due invoices =90days

    Hi,
    My customer is running 2007A PL30. He needs approval procedure for SO to be approved if the customer has overdue invoices more than 90 days.
    Any idea how to write the query?
    Regards
    Thomas

    Hi Thomas,
    This is surely doable.  It can only be done through user query.  Try this one:
    SELECT distinct 'true' from OINV T0 where T0.CardCode =
    $[$4.0.0] and DateDiff(DD, GetDate(), T0.DocDueDate) >= 90
    and T0.DocTotal > T0.PaidToDate and T0.DocStatus = 'O'
    It can not be run directly.  Assign to approval template directly to see.
    Thanks,
    Gordon

  • Query Approcal Procedure per line for SO

    Dear all expert,
    I would like to make query approval procedure that will tell user to ask approval every time they enter transaction that has gross margin < 0. This approval will work per line transaction. I mean if in line 1 has gross margin > 0 but in line 2, the gross margin is < 0, the approval procedures will run.
    Thanks for all your help

    Hi,
    AFAIK it's not possible to have query approvl on document lines, but only on document header or footer.
    Without using the SDK, I know no ways to achieve it.
    Regards,
    Eric

  • Approval procedure to control AR Delivery quantities

    Hi,
    My customer is using 2007A PL30. May I know how to write query  approval procedure if AR Delivery quantities entered by user is more than SO open quantities?
    Regards
    Thomas

    Thomas,
    You may have better luck getting an answer to this question if you post it on the [SAP Business One SDK|SAP Business One SDK; forum, as this type of query set on an event rather than on a timed schedule, would be better created through programming.
    Kind regards,
    Lucas

  • Approval procedures for cancelling SO printed

    Dear all expert,
    I want to make query approval procedure that will triggered when user want to cancel / close SO document in Open printed status.
    Is it possible ?
    thanks for your kind help
    Regards
    Thanks

    Hi!
    Please check this link.
    Re: FMS for Current User Code in Sales Order
    Thanks!

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

  • 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

  • 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

  • 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

  • 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

  • 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

Maybe you are looking for