SC Approval Query

Hello SRM Gurus,
I am working on the BADI BBP_WFL_APPROV_BADI for SC Approval.I need some clarifications on the foll points before I can proceed with the development...
My requirement is
1>The no of levels of Approval depends on the total Value fo SC and the Product Category of the Items(i.e. the Whole shopping cart since all the Items will be of the same Product category as well as same cost centre).
Based on the combination of these 2 values,I will have to set the approval_index field.
2>Also after this,based on the combination of the value for the fields Product Category + Cost centre,the approvers have to be determined.
Now for the deteremination of Approvers,either a custom table can be maintained or they ca be retrieved form teh Org structure itself.
But now here,for getting the Approvers,if I have to get the apporvers from the Table(database table bbpt_wfl_lia_def),I can only maintain the combination of values for the fields Cost center and Prod category and the corresponding agent and not the approval level.How do I link the approval index and the approvers???
Also, if i ma getting the approvers form the Org structure how is the link between Cost centre+Prod cat and Corresponding approver maintained????Or in case of getting the approvers for the Org structure,I just need to get the Chief/manager of the Person who is creating the Shopping cart(Since cost centre will be maintained at the User level)???
3>Also since my approval is purely at the Header level,whcih of the example implementations given with the std BADI will be usitable for my reqt(particularly for the APprovers part)????
Also since mine is Header level approval(since cost center+Prod cat will necessarily be same the whole of the SC,do I need to activate only the workflow 14000133(and no other wfs i.e.WS14500015,WS10000031,WS10000060,WS10000129 )?
Also,Please correct me if i have gone wrong in any of my understanding.Any help on this is highly appreciated.
Regards,
Disha.

Hi Pras,
    I am implementing the BADI 14000133 for Shopping  cart approval at the Header level based on the  total value  of  shopping Cart,cost center and product category.
   We are  maintaining 3 ztables to determine the  rules for approval as  shown below :
<u><b>1 Material Group Material Type relationship</b></u>
Release Group     Material Type         Material Group
Capital      CAP                 MCAP01- MCAP06
Catalogue     CAT                 MCAT01 – MCAT03
Normal             UTI,Service,GEN         MUT01, SER*,MGEN01–
                                    MGEN02
<u><b>2 Rule Table for mapping the values ranges</b>.</u>
Ruleno Release Grp  Val frm   Val TO   No. of Approvers
01     Capital           0             5000         1
<u><b>3 Determination of approvers based on rule, Material Group and cost center</b></u>
Ruleno  RelGroup  CostCenter  No of Approver   Approvers
01     Capital    100002     1               USJOHN
  Can anyone please tell me whether this apporach will be proper since we dont wnat to determine the approvers through Org?
  Also should we maintain the table BBPT_WFL_LIA_DEF?
Also i have some doubts  regarding the execution of the Witem..
1>The Witem goes to all the 3 approvers(say approval is 3 level) and if  nayone of the 3 approves ,the status is set to approved
2>If  any of the approvers rejects the shopping cart,does the SC go back to the previous  approver?
3>If  any of the approver  changes the SC,does the SC go to the  next approver?
  Our  requirement is ths  same as the std WF behaviour(WS100000129).
   I  have issues basically related to the Witem execution since I have not worked on Workflows previously...So  not sure  as  to what will happen inn case of this WF(WS14000133)..Since you have worked on this WF,can you please tell me how  will the WItem execution happen in case of this WF and are there any explicit settings required for the WF item execution to happen in some specified manner.
  Also, which of the std Implementations example for the BADI BBP_WFL_APPROV_BADI will suit my scenario?
Regards,
Disha.

Similar Messages

  • Approval Query for a specific customer group

    Dear Experts,
                 Following is the scenario, customer deals with whole sale and retail customers group. The client wishes to ensure that If the whole sales customer group account balance greater than zero then while making a sales order or invoice it should trigger approval.
    Saravanan

    Hi Saravnan......
    Thy this Approval Query and just put the Group Code for your customer in this group code's inverted comma....
    SELECT Distinct 'TRUE' From OCRD T0 Where T0.Balance>0 and GroupCode=' '
    And T0.CardCode=$[ORDR.CardCode.0]
    If above does not work then use below...
    SELECT Distinct 'TRUE' From OCRD T0 Where T0.Balance>0 and GroupCode=' '
    And T0.CardCode=$[$4.0.0]
    Regards,
    Rahul

  • Problem with user defined approval query

    Hi
    Sorry me for my english
    I have a problem with approval query
    DECLARE @DocDate DATETIME
    SET @DocDate = (SELECT $[OINV.DocDate])
    IF (DATEDIFF(DAY,@DocDate,GETDATE())) != 0
    BEGIN
    SELECT DISTINCT 'TRUE'
    END
    the query works with the previous invoices, but today's invoices show me a error colud not commit transaction
    Can Help me?
    Thanks
    Felipe Loyola

    Hi Felipe Loyola,
    Try this:
    SELECT DISTINCT 'TRUE' FROM OINV T0
    WHERE DATEDIFF(DD,T0.DocDate,GETDATE()) != 0 AND T0.DocNum = '$[$8.0.0\]'
    Thanks,
    Gordon

  • Rounding data on an approval query

    Hello everyone...
    As You know, taxes have increased in Mexico so we created new tax codes and accounts, and since I can't block any of the old taxcodes/acounts until all previous documents have ben closed/paid the only option I could think of was creating an approval process for all documents using the previous tax codes, since I can't create an approval query based on document lines/rows, I created it comparing the document's tax vs the document's total ($$). The old taxes were 10% and 15% these are the percentages I want to "block" using the approval process.
    Here's the query I created
    IF (($($27.0.number) = $($22.0.number).15) OR ($($27.0.number) = $($22.0.number).1) ) SELECT 'TRUE'
    The query/approval works, but there is a problem: SBO rounds to 2 decimals, so for a $ 124.15 sale the 15% tas would be 18.6225 but the tax ammount field would show 18.62 only which by being different in 0.0025 passes the criteria...
    How can I make this query work with rounded data?, I tried using round($($22.0.number)) but when then I always get a "Cannot comit transaction" error..
    Thanks in advance
    Hugo

    Hugo,
    I am glad my suggested solution worked.  I try to answer only questions that I know will work.
    It does not help in answering on a trail and error basis which unfortunately happens a lot of times as the enthusiasm in answering keeps away the focus.
    Depending on your decimal places definition in General Setting the numbers would be rounded.
    Using CAST to Varchar will also preserve the decimals but the numeric value will get converted.
    Best wishes
    Suda

  • Approval Query to skip for one Vendor Group - Not working

    Dear All,
    I am trying to create an approval query wherein when a user creates a Purchase Order for a Particular Vendor Group then the approval check is not required and for other Vendor Group approval check is required. The query is as under :
    SELECT distinct 'true'  FROM OPOR T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode WHERE T2.GroupName <> 'Supplier Own Group'
    I don't want that which vendors are in Supplier Own Group check go for an approval process. Means all vendors in this group should get skipped for approval.
    How to achieve this because this query seems not to be working in the approval process because when a user creates a PO whose Vendor group is under Supplier Own Group then also the approval checking is happening.
    Please help how to resolve this issue.
    Regards,
    Depika

    Hi,
    Try this
    SELECT distinct 'true'  FROM OPOR T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN OCRG T2 ON T1.GroupCode = T2.GroupCode
    AND T2.GroupName <> 'Supplier Own Group' where T0.CardCode = $[$4.1.0]
    Hope this helps,
    Son.

  • Approval Query when a Sales Return Document is Created.

    Hi all,
    When i post a Sale Return Document , the following Approval Query is not working when i try to work out for Approval of a New Sales Return document is Created.
    Select 'TRUE' From ORDN T0 Where T0.DocStatus='O' And Datediff(dd,T0.DocDate,Getdate())=0
    Is there any wrong with this Query?

    Just Opened the Recently Added Return Document with all the other window closed.
    Then, Tools -->Queries --> User Queries --> Approval Procedure (Category where my above sales return query is placed in the Query Manager) --> Sales Return (Return Query)
    When clicking on it...the query Generator window opens with TRUE as the result.
    But When adding the Return Document the REMARKS Window which always Opens for all the Approval Documents isn't Opening

  • 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

    Dear all,
    I want to set an approval for purchase order document. but there is one condition, the purchase order should only go for approval when they are belonging two item groups (kitchen and crockery item groups).
    Please help me in writing the query.
    Thanks & Reagrds
    Tavargeri Ganesh

    Dear Tavargeri Ganesh,
    Unfortunately, your required query can not be created because that info is not on the header but in the row level.  The possibility could be if your approval depend only the first line item.
    Thanks,
    Gordon

  • Approval Query on multi-level line discounts

    Hi Experts,
    I have this query that is attached in the A/R Reserve Invoice> free text field that triggers different values corresponding to the to approval levels of the management. The query is triggered when a discount is manually change. Also, the free text returns a null value,  if the item chosen is defined in period & volume discounts table (OSPP & SPP1).
    However, the issue arises when the client creates first a Sales Quotation which has an item defined in OSPP (promo item), upon copying to RI, the FMS returns a value instead of null, especially if the item copied is a promo item.
    I need help to modify this query to consider also if the item (promo) is copied from a base document.
    Thanks,
    Don
    If CONVERT(real,$[$38.15.11]) > 0.00 AND
    NOT EXISTS (
    SELECT DISTINCT ItemCode FROM OSPP WHERE ItemCode = $[$38.1.11] AND ListNum=1
    AND Discount <> 0.00)
    OR
    NOT EXISTS (
    SELECT DISTINCT ItemCode FROM SPP1  WHERE ItemCode = $[$38.1.11] AND ListNum=1
    AND Discount <> 0.00 AND (CONVERT(smalldatetime,$[$10.0.Date],101) >= CONVERT(smalldatetime,FromDate,101))
    AND (ToDate IS NULL OR CONVERT(smalldatetime,$[$10.0.Date],101) <= CONVERT(smalldatetime,ToDate,101)))
    Begin
                    DECLARE @discprct1 as real, @discprct2 as real
                    SELECT  @discprct1 = 0.00, @discprct2 = 0.00
                    SELECT @discprct1 = ISNULL(OITM.U_DiscLimit1,0.00) FROM OITM WHERE OITM.ItemCode = $[$38.1.11]
                    SELECT @discprct2 = ISNULL(OITM.U_DiscLimit2,0.00) FROM OITM WHERE OITM.ItemCode = $[$38.1.11]
                    If @discprct2 <>  0
                    Begin
                                    If CONVERT(real,$[$38.15.11]) > @discprct2 SELECT 'Level3 Approval'
                                    ELSE
                                                    SELECT CASE WHEN (CONVERT(real,$[$38.15.11]) <= @discprct2) AND
                                                    ((@discprct1 = 0.00) OR (CONVERT(real,$[$38.15.11]) > @discprct1))
                                                    THEN 'Level2 Approval' ELSE
                                                    (SELECT CASE WHEN (CONVERT(real,$[$38.15.11]) <= @discprct1) AND @discprct1 <> 0.00 THEN 'Level1 Approval' ELSE '' END)
                                                    END
                    End
                    Else
                    If @discprct1 <>  0
                                    SELECT CASE WHEN CONVERT(real,$[$38.15.11]) > @discprct1 THEN 'Level2 Approval' ELSE 'Level1Approval' END
                    ELSE SELECT 'Level1 Approval'
    End
    ELSE SELECT ''

    Hi Ravi,
    The users don't want to restrict the whole report on a specific customer or material. The only user input variable that will be available is the customer order date.
    The restriction has to be on the value of caracteristics coming from each individual sales orders that appear on the report.
    Exemple: I ask for sales order for a specific date and it gives me 2 sales orders with different customers and materials:
    Customer order list:
    - Ord# 1000241, Cust#100, Mat #A01, $100, <b>128$, 95$</b>
    - Ord# 1000244, Cust#115, Mat #B02, $100, <b>119$, 118$</b>
    The amount 128$ is restricted by date, and customer #100
    The amount 95$ is restricted by date, and material #A01
    The amount 119$ is restricted by date, and customer #115
    The amount 118$ is restricted by date, and material #B02
    Thanks in advance,
    Regards,

  • Approval Query based on BP terms

    I am looking for a little input on the following scenario.  I am looking to have an approval stage that when a BP has a particular Payment terms, it will need to get approval.  The payment term number I am using is 68 and it is stopping it on every delivery, not just the deliveries that have that particular payment term.  Here is the query I am running for this:
    SELECT Distinct 'TRUE' FROM OCRD T0 WHERE T0.[GroupNum] ='65'
    Any idea how to get it to only stop it for the this particular payment term and not all deliveries?
    Thanks,

    Hi,
    Try this query:
    SELECT distinct 'true' FROM ODLN T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode WHERE T1.[GroupNum]  = $[ODLN.GroupNum]
    Thanks & Regards,
    Nagarajan

  • Approval Query on Inventory Transfer

    Hi All,
    I want an Approval Procedure to be invoked when a Particular User post a Inventory Transfer. The Scenario is the user will transfer goods from his Warehouse to 2 different Warehouse. For Eg: Stores and Despatch.
    He will make a separate Inventory Transfer to transfer goods to Stores and another entry to transfer goods to Despatch.
    If he Transfer Goods to Stores, it has to be approved by Stores Department User.
    If he Transfer Goods to Despatch , it has to be approved by Despatch Department User.
    I tried using Query in Approval Procedure. Not able to get correct way it shoud work.
    Help Needed...
    Thanks in Advance....
    Marikannan

    Hi Thanks for the reply...  I have created the UDF for those. I used the Following Query.. But it doesnt work. Any issue with my query...
    DECLARE @whs AS NVARCHAR(20)
    SET @whs = (SELECT $[$18.1.0])
    DECLARE @reas AS NVARCHAR(20)
    SET @reas = (SELECT $[$u_po_ref.1.0])
    SELECT DISTINCT 'TRUE' FROM OWTR Z1 WHERE @reas = 'DSPT' AND @whs = 'QLTY'
    I Use @whs for Filler field in OWTR
    I User @reas for UDF in OWTR
    Thanks... Marikannan
    Edited by: Marikannan Balu on Apr 22, 2010 8:11 AM

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

  • AME Approval Query

    Hi ,
    We are on R12 and using Iproc and AME.
    For Requisition Approval, currently we have defined Rules with Header Item class to generate a list of approvers using an Approval group.
    So, if a Requisition has 10 lines, then the req is sent for approval to the relevant approval groups once based on Rules defined.
    eg: Req1-> Approval Group1 -> Approval Group2 -> Approval Group3 -> End
    Say, a Requisition is approved by approver Group1 and then if someone changes one of the lines, and resubmits the Requisition, it then goes for re-approval to ALL the approval groups again.
    Is there a way to prevent this and make it go to the remaining approvers ONLY(Group 2 and Group3) ?
    I know this is not an ideal approach, but for now just need to know in theory if this is possible using the setups in AME.
    Thanks
    SG

    Hi,
    You could look into AME attributes if there is one that allows this desired functionality. May be repeated approvers or something like it.
    In worst case you can write the approval group queries to avoid re-approvals. Use ame_temp_old_approver_lists table to identify the approvals that are already done. The item ID in this table is transacttion_id (requisition_id).
    Although i am not very certain if ame_temp_old_approval_lists will have data while approval group 2 query is run but its worth a try.
    ~Amol

  • Approval Query for Outgoing Payment

    Hi All Experts,
    I have to Create Approval for Outgoing Payment where payment means is Cash,Cheque or Bank Transfer but not Credit Card.
    In other words approval should be raised for all payment means other than Credit card payment means.
    For which I have Created Query as follows
    select Distinct 'true' FROM dbo.OVPM T0
    Left join dbo.VPM3 T1 on T0.DocEntry=T1.Docnum
    WHERE  T0.CreditSum=0 And T1.CreditAcct is null
    payments goes for approval but Credit Card payment also goes for Approval which is not required.
    Please Help me to Correct the Query.
    Regards,
    Gayatri Shukla.

    Hi,
    Little modification to your query. Try this.
    select Distinct 'true' FROM dbo.OVPM T0
    Left join dbo.VPM3 T1 on T0.DocEntry=T1.Docnum
    WHERE  T0.CreditSum = 0
    Regards,
    Amrut Sabnis.

  • Approval query - purchase order

    Team
    I need the query for additional approval  following conditions.
    PO value grater then one lack.
    Month to date  PO value greater then 50 lacks
    Thanks
    Anantha Desai

    Hi
    Please Try This Query for Approval of Purchase Order.
    SELECT Distinct 'True'
    FROM OPCH T0(NOLOCK)
    WHERE (T0.DocTotal>100000
      OR 5000000>=
      SELECT SUM(T1.DocTotal) FROM OPCH T1(NOLOCK)
      WHERE T1.DocEntry=$[OPOR.DocEntry] AND DATEPART(MM,T1.DocDate)=DATEPART(MM,$[OPOR.DocDate])
      AND DATEPART(YY,T1.DocDate)=DATEPART(YY,$[OPOR.DocDate])
    Thanks

Maybe you are looking for