Approval Query for Prepaid customers

Hi, I need help with a query. I want an approval screen to pop up when a user tries to add a delivery for a prepaid customer and the customer has not paid. The following query get me a "Could not commit transaction" error.
In our system, customers with prepaid terms have -1 in the GroupNum field.
SELECT Distinct 'TRUE' From OCRD T0 INNER JOIN ODLN T1 ON T0.CardCode = T1.CardCode WHERE $[OCRD.GroupNum] LIKE '-%' AND $[OCRD.Balance] + $[ODLN.DocTotal] <= 0
Any help would be appreciated. Thanks

Hi,
Try this:
SELECT Distinct 'TRUE'
From OCRD T0
WHERE T0.CardCode = $[ODLN.CardCode] AND T0.GroupNum <0
AND T0.Balance + $[ODLN.DocTotal] <= 0
Thanks,
Gordon

Similar Messages

  • Why doesn't Verizon offer any Contacts backup solution for prepaid customers?

    So I used to be on a contract plan, had my branch office close down, went out of work, and ended up having my contract lapse (this was a couple years ago). After all the monthly service charges for two lines mounted up before Verizon actually shut off the service, combined with early disconnect penalties and the like, the final bill was like $1100.
    I wasn't about to pay this, so I ended up switching to a prepaid plan. I understand that prepaid services naturally will carry certain limitations and restrictions of service as compared to contract plans, but one of the most absurd and ridiculous limitations is having no way to backup contacts, whether in general, or when switching devices (particularly from Android to Apple, or vise versa).
    As soon as I switched to prepaid, the Backup Assistant feature designed exclusively to backup contacts stopped working. To add, the Verizon Cloud service is not available for prepaid customers. You would think as small as a vcf namecard file is to backup, that either 1) Verizon Cloud should be accessible to prepaid customers, maybe not to the extent of backing up photos, etc., but at least to backup contacts, or 2) enable the original Backup Assistant feature for prepaid customers to backup contacts.
    I'm now switching from an Android device to an Apple device, and Verizon is offering me no solutions to backup my contacts, other than a customer service rep telling me I could try taking both devices in to a store to see what they could do, but promised nothing in regards to them actually being able to do it. Android to android is simple, as you can export your contacts to an external SD card, and then import them back in via the external SD. But when switching to apple device, you can't do that. There's also no indication I could import contacts from Gmail to an apple device.
    Even after getting gouged with an $1100 collection debt from Verizon due to an unfortunate loss of job, I stayed loyal to them, continue to reach in to my pocket and send them money every month for the last 2 years on prepaid, yet I can't even backup my contacts? It's completely absurd.

    if you have an iPhone you'd just do it through iCloud( I ssume ) and if you have Android you'd just do it through your Google account

  • 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

  • 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

  • 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

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

  • 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 CUSTOMERS FULL DEBIT AND CREDIT WITH CLOSING BALANCE

    Hi Friends,
       I need query for CUSTOMERS FULL DEBIT AND CREDIT WITH CLOSING BALANCE for selection criteria from date and to date.
       I know the Trial Balance Report will sort out this issue... but i need routeday wise report
    1. Business Partner Master Data - i created one UDF field called U_Routeday (MONDAY, TUESDAY, WEDNESDAY,THURSDAY,FRIDAY)
    2. The query should be like selection criteria 
                                  - Routeday [%0]
                                  - Posting Date [%1]                           
                                  - Posting Date [%2]
    CardCode
    Debit
    Credit
    Balance
    D10503
    25031.50
    24711.50
    2962.00
    D10641
    5466.00
    7460.00
    285.00
    D10642
    2866.00
    142.00
    give any helpful query ASAP... Thanks in advance

    Hi,
    Try this query:
    Declare
    @fromdate as datetime
    Declare
    @Todate as datetime
    Declare
    @Code as nvarchar(25)
    set
    @fromdate = ( select min(Ta.[RefDate]) from OJDT ta where
    Ta.[RefDate] >= [%0])
    set
    @Todate = ( select max(Tb.[RefDate]) from OJDT tb where Tb.[RefDate]
    <= [%1])
    set
    @code = (select max(Tc.[ShortName]) from JDT1 tC where Tc.[ShortName]
    = [%2])
    SELECT
    [Name] as AcctName, [Jan]= sum([1]), [Feb]= sum([2]), [Mar]=
    sum([3]), [Apr]= sum([4]),  [May]= sum([5]), [June]= sum([6]),
    [July]= sum([7]), [Aug]= sum([8]), [Sept]= sum([9]), [Oct]=
    sum([10]), [Nov]= sum([11]), [Dec]= sum([12]), total = sum
    (isnull([1],0)+ isnull([2],0) + isnull([3],0) + isnull([4],0) +
    isnull([5],0) + isnull([6],0) + isnull([7],0) + isnull([8],0) +
    isnull([9],0)+ isnull([10],0) + isnull([11],0) + isnull([12],0))
    from
    (SELECT
    T0.[ShortName] as Name, sum(T0.[Debit]-T0.[Credit]) as T,
    month(T2.[RefDate]) as month FROM JDT1 T0  INNER JOIN OACT T1 ON
    T0.Account = T1.AcctCode INNER JOIN OJDT T2 ON T0.TransId =
    T2.TransId WHERE T2.[RefDate] between @fromdate and @todate and
    T0.[ShortName]  = @code  GROUP BY T0.[ShortName],T2.[RefDate] ) S
    Pivot
    (sum(T)
    For  Month IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
    group
    by [Name],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]
    Let me know your result.
    Thanks & Regards,
    Nagarajan

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

  • 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

Maybe you are looking for