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,

Similar Messages

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

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

  • 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

  • Report for pending approval absences

    Dear all Gents ,
    I want to create report for all types of employees absences which are pending approval and approved and every thing , any one has a select statement for this please ?
    thank you

    You have to query : per_absence_attendances table for applied leave
    and HR_API_TRANSACTION Table for pending approval leave.
    Thanks

  • Problem writing a sql query for a select list based on a static LOV

    Hi,
    I have the following table...
    VALIDATIONS
    ID          Number     (PK)
    APP_ID          Number     
    REQUESTED     Date          
    APPROVED     Date          
    VALID_TIL     Date
    DEPT_ID          Number     (FK)
    I have a search form with the following field item variables...
    P11_DEPT_ID (select list based on dynamic LOV from depts table)
    P11_VALID (select list based on static Yes/No LOV)
    A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
    SELECT v.APP_ID,
    v.REQUESTED,
    v.APPROVED,
    v.VALID_TIL,
    d.DEPT
    FROM DEPTS d, VALIDATIONS v
    WHERE d.DEPT_ID = v.DEPT_ID(+)
    AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
    This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
    Can anyone help me to extend my query to include this situation?
    Thanks.

    Hello !
    Let's have a look at my example:create table test
    id        number
    ,valid_til date
    insert into test values( 1, sysdate-3 );
    insert into test values( 2, sysdate-2 );
    insert into test values( 3, sysdate-1 );
    insert into test values( 4, sysdate );
    insert into test values( 5, sysdate+1 );
    insert into test values( 6, sysdate+2 );
    commit;
    select * from test;
    def til=yes
    select *
      from test
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);
    def til=no
    select *                                                                               
      from test                                                                            
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);  
    drop table test;  It's working fine, I've tested it.
    The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
    For understandings:
    1.) TRUNC removes the time part of DATE
    2.) The difference of to date-values is the number of days between.
    3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
    4.) DECODE is like an IF.
    Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
    Good luck,
    Heinz

  • Adding a query to the approval template

    Hello
    I'm trying to setup an approval template for AR Invoices based on a UDF.
    Basically I want to add a query to the approval template that will trigger an approval request based on the following query
    but i don't know how to set it properly.
    trigger an approval when:
    select * from OINV where u_ordertype = 'sub'
    any help would be appreciated it!
    Mike

    Hi Mike,
    Try this:
    select 'true' from OINV T0 where T0.u_ordertype = 'sub' and T0.DocNum = $[$8.0.0\]
    Thanks,
    Gordon

  • Standard Work flow for Leave approval in HR module

    Hi ,
    My query is there any standard work flow available in HR module for Leave approval and Over time approval. We have negative time management and with out ESS and MSS.
    Pl suggest if any one has used this earlier with out ESS or EP
    Regards
    Punit

    I can think of the following but not without enhancement for the workflow part.
    - Since you are not using ESS, you (leave admin) may create the absence record directly in IT2001 (in LOCK mode).
    - In the user exit of 2001 you may trigger your Workflow process (i.e. call the function module to trigger WF here) depending on the LCCK status. You have to explore if standard WF can be used to your requirement.
    - Upon approval, you can UNLOCK the absence.
    - In the event that UNLOCK is unsuccessful, trigger WF to your Leave Admin for him to update via PA30.
    Standard SAP Workflow
    - Only 1 level approval
    - Using Chief Position
    IF your workflow requirement deviates, then you have to also customize workflow, does not matter whether you are using ESS or not.
    Finally test and retest to make sure all possible events are covered.
    OT is the same, except that you need to use 2007 vs 2002
    Edited by: sapuser909 on Nov 18, 2009 12:07 PM

  • Why we maintain usage for work approval,  applications and documents in WCM

    hi,
    what is significance of maintaining usage for Work Approval, Work clearance Application and Work clearance documents in Customizing of work clearance management.
    Please reply.... with detailed notes..
    regards,
    Amit kushwaha

    Hi,
    For WCD Usage u can have further controls given in customizing.
    But u can hide Usage in WA and WCA, if its not used. But at application level u can use it for various types of permits, which u can use as the triggering point for printouts.
    If this answers ur query u can give points.
    Thanks.

  • How to use the same POWL query for multiple users

    Hello,
    I have defined a POWL query which executes properly. But if I map the same POWL query to 2 portal users and the 2 portal users try to access the same page simultaneously then it gives an error message to one of the users that
    "Query 'ABC' is already open in another session."
    where 'ABC' is the query name.
    Can you please tell me how to use the same POWL query for multiple users ?
    A fast reply would be highly appreciated.
    Thanks and Regards,
    Sandhya

    Batch processing usually involves using actions you have recorded.  In Action you can insert Path that can be used during processing documents.  Path have some size so you may want to only process document that have the same size.  Look in the Actions Palette fly-out menu for insert path.  It inserts|records the current document work path into the action being worked on and when the action is played it inserts the path into the document as the current work path..

  • Error while creating a query for my custom infotype

    Hi,
    I have created a custom infotype with fields currency amount and currency field .
    While I am creating a query for it its giving an error
    Message no. AQ_AD_HOC221 Error when generating the report(see long text )
    I tried to execute the standard program RPUMS40CCI but still I am facing same error .
    I have also maintained table T777i for my infotype but still problem exists.
    Please help.
    P

    Hi
    Check in PM01

Maybe you are looking for

  • How do I change font and colors back to default?

    I have changed the font and color of the text through the tools button and the options button and the content tab. I find nothing telling me how to change the font and colors back to default font and colors. Can you advise me? I'm using Windows 7 Hom

  • HT3775 i cant waych you tube in my macbook pro

    hello all i've trying to watch you tube vids for the past week, but it seams to be like what on my snap shot above i updated the flash player i check my int browser for update i try in chrome firefox and safari its all the same any help please ? many

  • PPRO is only playing solo channels - how do I get it back to playing both

    I've been editing a project for about six weeks and had no problem importing audio and video.  Everything had been synched up ok and PPRO was behaving normally. I've had two weeks off and have just imported more footage but the audio now doesn't play

  • IKE Trouble with Peer to Peer VPN

    Got an interesting one here.  We have three flavors of Cradlepoint router.  The early 1200, the 1200b and the 1400.  I am setting up peer tp peer VPNs.  The Cradlepoints sit in a school bus and connect to the ASA in our district office. The ASA 5510

  • Thumbnails not loading

    Ok so I'm running CS6 and working on a project that has around 100 Canon XF clips (from a C300) in the project. I want to be able to scroll through my clips in the project window so that I can quickly grab certain shots without having to load them al