APPROVAL PROCEDURE THROUGH QUERY

Dear Suda,
Now i am telling wat i have actually done and wat is its result. Please try to understand it.
First of all I have made the querry below-
SELECT DISTINCT 'True', T1.DiscPrcnt AS 'Discount % per Row', T0.SlpName AS 'Sales Employee Name' FROM [dbo].[OSLP] T0 INNER JOIN [dbo].[RDR1] T1 ON T1.SlpCode = T0.SlpCode WHERE (T1.DiscPrcnt > 25 )
In this querry i have typped DISTINCT 'TRUE' manually but keeping the SELECT table as it is.In this case the system is not asking me for any kind of discount (not greater than 25% or not less than 25%)
After that i have modified above querry as below-
SELECT DISTINCT 'TRUE' FROM [dbo].[OSLP] T0 INNER JOIN [dbo].[RDR1] T1 ON T1.SlpCode = T0.SlpCode WHERE (T1.DiscPrcnt > 25 )
In this qurry i have typped DISTINCT 'TRUE' manually. When i executed this qurry i jst get the true in first row first column place.When i have attached this querry to approval, and after that when i have started for creating purchase order with the originators log in then in this case the system is asking approval for every discount from 0% to 100%.
Wat shud i do now...Please reply ASAP.
Swapnil

Hi, Swapnil!
You are on the right path, but I'm not sure if you can run this approval procedure at the line level.
The queries you had are against the wrong table (RDR1 is a Sales Order table) and are missing the link to the active document. You have to add the reference to the active document or else you are pretty much querying against the entire RDR1 table.
You need something like this:
SELECT CASE WHEN ($[$38.15.Number] > 25) THEN 'True' ELSE 'False' END
38 is the grid and 15 is the column for the discount.
I tried a basic case and it didn't work. I think you need to loop through all the lines, but I'm not sure how to do this.
You might have to create a header level UDF that changes automatically when the discount column changes, and has some logic to keep the highest discount you have on all the lines (something like: if discount greater than already stored value, update stored value) In the end, monitor this UDF for your approval procedure.
Hope this helps!
Liviu

Similar Messages

  • Approval Procedure - User Query .....!!

    Hi Experts,
    In our organisation we have a approval procedure applicable on sales order. There are two authorizer authorises specfic users request. Now the problem is for a specific customer order can we use a separate query to change the authorizer ??
    Example : -
    Approval Stage 1 : Authorizer A : User 1, User 2
    Approval Stage 2 : Authorizer B : User 3, User 4
    Now, User 2 requires approval of specific customer order which will authorise by Authoriser B.
    Is there any way to write a query on Approval Template for that
    or User 2 has to be added on both the Approval Stage
    or anything else ?? Please guide.
    Regards,
    SK

    Hi,
    There is no way to write a query on Approval Template for that. User 2 has to be added on both the Approval Stage.
    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

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

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

  • 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

  • Approval Procedure - how to pass value to query

    I want to do an approval procedure for checking GRPO Qty which greater than PO OpenQty by Query.
    How to pass the GRPO DocEntry and LineNum to the query, and how can check the passing value is correct or not?

    I have tested one row only, but also not work.
    Here is the query I used.
    select case when (t1.openqty < $\[PDN1.Quantity.0]) then 'TRUE' ELSE 'FALSE' END as RESULT from pdn1 t0
    right outer join por1 t1 on t1.docentry = t0.baseentry and t1.linenum = t0.baseline
    where t1.docentry in ($\[PDN1.BASEENTRY.0])
    group by t1.docentry, t1.linenum, t1.quantity, t1.openqty
    having (sum(isnull(t0.quantity,0))  < t1.quantity)
    order by t1.docentry, t1.linenum, t1.quantity, t1.openqty
    If the pass value is correct, the result should be like this.
    TRUE
    Is the query wrong? Any suggestion?
    Thanks.

  • 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

Maybe you are looking for

  • Error in updating jar file in windows

    Hi... I am updating a jar file using Runtime.exec() by passing a batch file in it. While updating the jar file I am getting error like this: java.io.IOException: Error in writing existing jar file at sun.tools.jar.Main.run(Main.java:198) at sun.tools

  • Is there a way to retrieve files encripted up by Apples Backup?

    I have some files on an external hard drive that were backed up (encripted?) by Apples Backup a couple years ago.  I would like to restore that data and retrieve some photos.  Is thare a program or method to accomplish this?  Thanks for any help with

  • Lost the songs on my comp;uter

    I lost all the songs on my computer but I still have them on my ipod. How do I transfer the songs from the ipod to the computer? If I sync I will lose the songs on my ipod right?

  • Cursor statement in forms

    hi all, i have cursor like cursor b_details_E is select company,orgport,disport,agent,shipper                             from b_details                             where type = 'Export'                             and status = 'SEA'; begin for i in 

  • My imac 27" screen is stuck on grey screen

    My imac 27" screen is stuck on the gray screen. I've tried starting in safe mode and nothing happened.  I don't get the apple or the spinning wheel. it just sits there and it doesn't sound like it's trying to do anything. Any ideas?