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.

Similar Messages

  • 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

  • Creating a Query for Purchase Order Approval

    I need to develop a query to check if any of the line totals in a new purchase order exceeds $500. I have to attach this query to the approval procedure (under 'Terms' in 'Define Approval templates'). When the 'Add' button on the purchase order is clicked, the values on the form are still not available in the database. This means, my query has to pick the data from the new purchase order form. Is there any way to build such a query? Thanks.

    Satish, Alerts just notify the appropriate parties. They do not stop a document from being posted. This means, it is not capable to recognize the situation unless it's already stored in the DB.
    Alexey. what about creating a Development Request about this topic?
    Regards,
    Felipe

  • 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

  • Approval Query for Invoices with Items Onhand below zero.

    Dear Experts,
    I would like to make an approval procedure applicable on A/R Invoice. 
    When ever one of the Invoice items OnHand amount is below ZERO - I need the Approval Procedure to Popup and this way the Produce of the Invoice will be blocked.
    Is there any way to write a query on Approval Template for that?
    Thanks! 
    Regards,
    D.Medalion

    Hi D.Medalion
    Please Follow some step
    First Create Approval Stages in Administration ->Approval Procedures->Approval Stages
    First -
    Administration ->Approval Procedures->Approval Templates->Documents-> Click On A/R Invoice .
    Second-   Administration ->Approval Procedures- Approval Templates->Terms->When the Following Applies->Click Tick On Deviation from Commitment  and ration Drop Down Choose Greater or Equal
    Thanks & Regard
    Khan Imran

  • 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

    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 Query for AP Invoices Containing Budget Related GL Account

    Hi Experts,
    I would like to create a approval template for all AP invoices that include a GL account that is related to the budget. Can you please help me with the approval query?
    Thank you!
    Jane

    Hello Gordon Du,
    "B1 approval will only apply to document level. If you want to check line level, only the first line can be subjected to."
    I was thinking to trigger the approval process based on a document (AP invoice) containing relevant cost centres on a line by line basis as entered via one of the enabled dim fields.
    Writing a trigger query for each cost centre effected? This does not appear to be a good solution, what is a better direction. Is there another way? (PO are not yet used via SAPB1)
    Currently my invoices add, but do not trigger the approval process based on my attempts thus far.
    Can the originator manually choose an approval pathway?
    If this is against posting etiquette delete and advise.
    I am a relative newbie to SAP B1, so am happy to be pointed to relevant help files. I arrived via  google searching and arrived here.
    Thankyou.

  • Approval Query for Receipt from production

    Hi experts,
    I want to define an approval process for receipt from production.
    The condition is below:
    Only if it is " Receipt from production" then the goods receipt document should go to approval of quality.
    If is any unplanned direct goods receipt then system should allow to add it straightly.
    To do so, Please provide me the required query.
    regards
    Ravindran Srinivasan

    Hi Ravindran,
    I once encounter same problem like this. And I found out that, unfortunately, approval procedure can't work on receipt from production document.
    Yes, we all know that receipt from production and inventory goods receipt are actually same object type in SAP B1 and stored in same table. But, try it by yourself in your testing database, even if you apply the approval templates for goods receipt document, and you apply the condition as "always", you won't get prompted for approval if you try to add the receipt from production document.
    However, I said this based on my experience with version prior to 8.81 and 8.82. But somehow I have a strong feeling that this issue still not yet realized by SAP.
    Best Regards,
    Hendry Wijaya

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

    Dear Sir / Madam;
    Please Help, We try to made Query for PO Approval with condition if PO Type "ITEM" have to approve by Purchasing Manager, but for PO Type "SERVICE" have to approve by General Affair Manager.
    We Create Query for this condition " SELECT *  FROM OPOR  WHERE T0.[DOCTYPE]='I'
    We already create the stage, and this query is not work. But if try to set the total Doc greater than 1000000, it is work.
    Dear Sir / Madam, please help me to send me the right query ?
    Thanks for your help
    Regards
    Petrus

    Hi,
    I suggest to add select distinct 'true' or select 'true' for in your query like previous answer.
    Here are the solutions for your problem:
    A. for doc type is not as same as service :
    SELECT distinct 'true' FROM OPOR T0
    where $[OPOR.doctype] = N'S'
    B. For doctype is not as same as item:
    SELECT distinct 'true' FROM OPOR T0
    where $[OPOR.doctype] = N'I'
    Both have been tested and work well.
    Rgds,

  • Query for approval

    I have updated SBO_SP_TransactionNotification for validating sales order.The query is as follows -
    if @object_type = '17' and @transaction_type IN ('A')
    begin
            declare curItem  cursor  for Select PriceBefDi,ItemCode,SeriesName FROM
         RDR1 INNER JOIN ORDR ON RDR1.DocEntry=ORDR.DocEntry
            INNER JOIN OUSR ON OUSR.UserId=ORDR.UserSign
         INNER JOIN NNM1 ON NNM1.Series=ORDR.Series
         WHERE ORDR.DocEntry=@list_of_cols_val_tab_del AND USER_Code<>'manager'
         declare @dblPrice numeric(10,2),@dblItemPrice numeric(10,2)
           declare @strItemCode varchar(20),@strSeriesName as varchar(40)
         open curItem
            fetch next from curItem into @dblPrice,@strItemCode,@strSeriesName
           while @@fetch_status = 0
         begin                         
              SET @dblItemPrice=(select price from itm1 where itemcode=@strItemCode and pricelist=(select listnum from opln where listname='Sales price list' ))
              if @dblItemPrice>0 and charindex('DEM',@strSeriesName)=0
              begin               
                   if @dblPrice<@dblItemPrice AND charindex('REP',@strSeriesName)=0
                   begin
                        set @error =1
                        set @error_message = 'The price of the item ' + @strItemCode + ' should be equivalent to sales price list i.e.' + cast(@dblItemPrice as varchar)
                   end
                   else
                   begin
                        if @dblPrice>@dblItemPrice
                        begin
                             set @error =1
                             set @error_message = 'The price of the replacement item ' + @strItemCode + ' should not be greater than sales price list i.e.' + cast(@dblItemPrice as varchar)
                        end
                   end
              end
              fetch next from curItem into @dblPrice,@strItemCode,@strSeriesName
         end
         close curItem
         deallocate curItem
    end
    This stored procedure is working correctly as per the requirement.Sales order can not be added if the price is less than sales price list.
    Now I want to remove this validation and add approval for this.If the rule is violated ,then the document will go for approval.In SAP I have created query for approval as,
    SELECT DISTINCT 'True'  FROM OITM  WHERE ITEMCODE=$[$38.1]  AND U_Discount_Percent < $[$38.15]
    UNION
    SELECT (CASE WHEN $[$38.14]<>(select price from itm1 where itemcode=$[$38.1] and pricelist=(select listnum from opln where listname='Sales price list' ))
    THEN 'True' ELSE 'False'            END)
    Here I am getting the price as varchar.Is it possible to call stored procedure SBO_SP_TransactionNotification from query ?

    Hi Dilip,
    I have tried the following query for approval :
    SELECT 'TRUE'
    FROM OITM JOIN ITM1 ON OITM.ItemCode=ITM1.ItemCode
    JOIN OPLN ON OPLN.ListNum=ITM1.PriceList AND UPPER(LTRIM(RTRIM(OPLN.ListName)))='SALES PRICE LIST'
    WHERE OITM.ItemCode =$[$38.1.0] AND $[$38.14.NUMBER] != ITM1.Price
    It works for all the lines in Sales Order.Even If there is a single item with Price before Discount not equal to Sales Price List Value,
    System will send the document for approval.
    I have put the condition $[$38.14.NUMBER] ! = ITM1.Price assuming that the price in SO should be exactly equal to Sales Price Price  List .
    Try this query at your end and let me know the result.
    Thanks and Regards,
    Pooja Singh.

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

  • Approval Query For A/R Delivery

    Hi
    I have made a query for Approval Procedure, only those Delivery documents will go for approval for which A/R Down payment Request has not been made. But it is not working properly Kindly Correct the query.
    SELECT Distinct 'True'  where dln1 t0 inner join odln t1 on t0.docentry = t1.docentry inner join ordr t2 on t0.baseentry = t2.docentry and t2.docentry not in (Select distinct t4.baseentry from dpi1 t4) and
    t2. docentry = $[DLN1.Baseentry]
    Thanks
    Rashid

    Hi Rashid,
    B1 does not support approval queries on document lines. you can query only document header.
    you can either try to workaround it with all sorts of aggregate UDFs in the header, or alternatively take a look at:
    [http://www.beonesolutions.com/ip/Solutions/ap.html|http://www.beonesolutions.com/ip/Solutions/ap.html]
    all details, including the ability to query all document tables, are in:
    [http://www.beonesolutions.com/files/Approval_Pro_Brochure.pdf|http://www.beonesolutions.com/files/Approval_Pro_Brochure.pdf]
    Gilan

  • Approval Query  for Sale Delivery Problem

    Hello,
    I have to set approval procedure of Sale Delivery in following condition
    If i add sale order for Specific item for 10 Qty for example C01 customer & after that i add sale order for same item qty 10 for another customer ie C02 & i have stock for that item 50 but user give delivery first to C02 in staid of C01 but C01 give me first order
    on this condition i have to set approval user can't deliver second sale order first he have to take approval from manager to do this & he deliver first order first then then don't have to need approval.
    Can any one help me?

    Hi,
    Row level approval is not possible in SBO.
    You may check this for your reference: http://www.beonesolutions.com/ip/Solutions/ap.html
    Thanks,
    Joseph

Maybe you are looking for

  • File upload not working on Mac OSX

    I've tried several of the Flex file upload components, in all cases they don't work correctly when used on a Mac. I've tested both flash player 9 and the latest 10 release. The file uploads to the server, but the progress bar doesn't update and the u

  • Pasting settings to multiple images in Flimstrip

    Hi - this is probably a basic question but I may have missed the "how to." When I finish adjusting (in the Develop Module) and I click "copy" and select the items I want to copy, then what I want to do is apply (paste) these settings into a number of

  • Schedule a Job

    Hi, I have followed the following <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1515">blog</a> and inside the run method I have written a code which accesses user data and calls a Remote FM using JCA. The same code works when I execu

  • Free Transform and Crop Crosshair

    What is the Free Transform and Crop Crosshair used for? Whenever I transform an image or crop an image it shows up in the center of the image. Is this used as a refrence to the center of your image or can you do more with it? I notice that you can mo

  • Dreamweaver CS4 on Win7x64 only starts once per session

    Hello. I use DW only occasionally so I didn't notice that whenever I exit DW I am unable to restart it during the same windows session.  If I try to open it a second time, nothing happens.  However, if I log off as a windows user and then log back in