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

Similar Messages

  • 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

  • Query for details of  Sale order , Invoice and COGS

    I Need the report cointing following based on month & Business partner
    Sale order, Sale Amount, Due date, Invoice Amount, Last Invoice date, COGS amount

    Hi Anantha,
    Please check below link and modify according to your requirement.
    Sales Order Query for  in SAP B1
    Query - Sales Orders linked to Deliveries
    My Top SQL Queries for SAP Business One
    Hope this helps
    Regards::::
    Atul Chakraborty

  • Transaction code A/R Reserve Invoice and A/R Credit Memo

    Hello experts,
    My client has entered AR Reserve invoice and AR Credit memos- I need to find the accounting documents of these transactions.
    I am not able to find the difference between them in my table. I am using BSEG.
    What am I doing wrong?
    THanks a  lot

    Hi........
    Welcome To SAP Business One Forum......
    Is your question related to SAP B1?
    If yes then for every marketing document SAP creates Journal Entry except Orders as you can see it in Accounting Tab of Document.
    So you can find out those accounting transactions by its Origin and Object code in document tables........
    Regards,
    Rahul

  • Wrong A/P invoice and effect of Credit memo

    If we registered wrong AP invoice there is no way unless issue credit memo. And this process cause other wrong record in system. In SAP Business One there is no option to cancel an invoice but with Credit Memo. This is the only way and it has to be this way because of the law, in Venezuela every invoice that is cancelled has to have a credit memo to support it. First of all I would like to bring your attention to this point that  it is we are talking about the correction of the figure just in financial side ( no impact in inventory) which it may cause because of user mistake when he /she register AP invoice with  putting wrong amount at that time. Based on your solution :   With debit memo not only  the amount in  financial side  will be corrected but also  the quantity of the warehouse will be changed which it is not our case.
    In summary we need to correct the amount of invoice JUST in  financial module with no impact in inventory?
    Thanks in advance

    As you know there is only one way to cancel AP invoice , and it cause decreasing in inventory, so how can I register again AP invoice becasue related Good recipt was closed by AP invoice , and I can not issue AP base on that good receipt.

  • Getting error during posting A/P invoice and  A/P credit memos

    We are intermittently getting this error during A/P invoice.
           When i am doing the full cycle of Purchase like
            Purchase Order
            Goods Receipts PO
           A/P. Invoice.
         At the time of A/P. Invoice the date has been coppied from the Goods Receipt's PO, i am getting the error, this error not comes regularly, only for few transcations,
         Please guide to me.
             Error is
           " No matching records found 'G/L Accounts' (OACT) (ODBC-2028)
                                  Message 131 - 183 "
              Patch level is 27 and version is 2005B

    Hello Prasad,
    Before add A/P invoice, are you changing the price to a lower price, either by changing amount in the 'price' column or by giving a higher discount at the header level ? As far as I know, in a non continuous stock system company with the 'Use Negative Amount for Reverse Transaction' setting not ticked.
    Another solution could be as follows (just check in your SAP B1 installation) :
    When the user chooses User Defined Chart of Accounts under Administration -> System Initialization -> Company details -> Basis Initialization tab , the default accounts remain in the "G/L Account Determination", "Define Tax", "Define Warehouse" windows under Administration -> Definitions -> Financials and Administration -> Definitions -> Inventory. User has to check and define all accounts.
    My reference is SAP notes 771489.
    Another related issue is whether you are using rounding when adding a marketing document. If yes, you must define rounding account in 'Administration' > 'System Initialization' ->'G/L Account Determination' -> 'General' tab page under "Rounding Account" field.
    Rgds,

  • Querry For Approval Procedure

    Hi All,
    I want to know that, how to generate query for Approval procedure.? I know it is started with <b>DISTINCT 'TRUE'</b>. But how to select this field. If i want to generate querry for approval of row level discount greater than 15%. How to generate it?
    Swapnil

    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

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

  • Error: Lock profile for approval procedure not maintained in Customizing

    Hi,
    We are working on the CHARM approval process. I have noticed that without selecting an approval procedure, I select the status (Awaiting business approval) on which the approval workflow is triggered, the system gives below error:
    Select an approval procedure first
    Lock profile for approval procedure not maintained in Customizing
    Approval procedure and approval steps are locked automatically
    This locks the approval procedure and the RFC can no longer be processed further. Why is that happening ? Anyone can select the status by mistake and lose the RFC, is there a way to stop this or at least reset it ? the lock procedure is already maintained in approval procedure customizing.
    Best Regards.

    Hi Karthik,
    Thanks for the quick reply, however the settings mentioned on page 38 are already in place i.e. the approval procedure gets determined correctly based on change category (rule policy) and also is locked after putting it to 'Awaiting Approval' 
    But the problem exists - setting the status 'Awaiting App.' without selecting app.proc, will result in a total lock of the RFC.

  • Mandatory fields for creation of FB60(vendor invoice),and FK01(cost center)

    Hi all,
    can u plz send me the mandatory fields(along with discription) for creation of FB60(vendor invoice),and FK01(cost center).
    thank u,
    Srinivas Reddy.

    The FK01 is the transaction used to create a Vendor.
    The mandatory fields are:
    a. NAME1: For Name
    b. SORT1: For CUIT number.
    c. SORT2: For alternative CUIT number.
    d. CITY1: For city.
    e. STCD1: Tax Number.
    f. Others depending the case.
    For FB60 (Vendor invoice) the mandatory fields are:
    a. ACCNT: Number of Vendor Account.
    b. BLDAT: Date.
    c. XBLNR: Reference Number.
    d. WRBTR: Invoice Amount.
    e. HKONT: G/L Account Number.
    f. WRBTR: Invoice Amount. The same as d but in the item.
    g.MWSKZ: Tax Type. Depending the case.
    h. KOSTL: Cost Center. Depending the case but is highly probable that the field were mandatory.
    i. Others. Depending the case.
    I have given to you the most probably fields that are mandatory for those transactions.
    Your Sincerely
    Leonardo Lopez
    FI Consultant

  • Create Item AR Invoice to Service AR Credit Memo

    Hi Expert,
    Customer is running 2007A PL30. We understanding that it is impossible to copy Item AR Invoice to service AR credit memo. It is customer business practice to issue same AR invoice to all customer for same item and later issue service AR credit memo to customer. Customer wants the item information to be copied to service AR credit memo rather than keying multiple rows to indicate discount given on which items. It is not possible to include discount at original AR invoice.
    Any workaround or solution to solve this problem?
    Regards
    Thomas

    Please note the following:
    Item and Service type documents do not have a one to one match of the row level fields.  So the ItemCode from the AR Invoice could not be copied to a AR Service CM as the ItemCode column is not exposed and these are 2 different types of documents.
    This is what you could do....
    Open the AR Credit Memo...Enter the Customer Code....
    Add a formatted search to the Description field to Display the list of Items and take the Invoice number from the user as a parameter.
    Query same below
    SELECT T0.ItemCode FROM [dbo].[INV1] T0 INNER JOIN [dbo].[OINV] T1 ON T0.DocEntry = T1.DocEntry
    WHERE T1.CardCode = $[$4.0.0.] AND T1.DocNum = '[%0]'

  • The "Without Qty Posting" check box appears disabled in A/P and A/R credit Memo Rows

    Dear All,
    The "Without Qty Posting" check box appears disabled in A/P and A/R credit Memo Rows even when set visible and active in the form settings. Please advice. SAP Business One version 8.82 PL 13
    regards
    Deb

    Hi,
    Please check:
    The field is available only in the following
    cases:
    1. A/R credit memos not based on other documents or
    2. A/R credit memos based on an A/R invoice or
    3. A/R credit memos based on an A/R reserve invoice, for which items have been delivered, and
    4. if non-drop-ship warehouses are used
    Thanks & Regards,
    Nagarajan

  • Reverse Freight Amount of A/R Invoice through A/R Credit Memo

    Hi All,
    Using PL 25 SBO 2005 B & also tried in PL 38
    I am trying to reverse the A/R Invoice through A/R Credit Memo.
    There is total amount of Invoice is Rs. 960/- out of that Rs.100/- is Freight, when I am reverse the Invocie via A/R Credit Memo, it is showing only 860/-, not taking automatically Freight Amt. I have click on the link to freight and add Exempt -> and Freight Amt 100/-. and added the Credit Note.
    after adding it is also showing A/R Invoice open. and in Balance on invoice is showing appx. Rs. 98 something amt. pending to receive.
    Can any body guide me the correct and proper way to reverse the A/R Invoice which are having Freight.
    Team, Thanks for your support.
    Best Regards,
    Chintesh

    Dear Shrinivasan,
    Earlier, i had choosen customise. Now i have done below process..
    A/R Credit Memo -> selected Customer ->  Copy From -> A/R Invoice -> then wizard appeared -> Draw All Data (Fright and Withholding Tax) -> finish
    Then All data appear in Credit Memo -> click on link to Freight  ->  in the column of Exampt -> added freight.
    And finally add it.
    Then close all opened window and check the invoice but it is showing freight amt in balance.
    Can u plz guide me abt its back end entry means Accounting Entry.
    With Warm Regards..
    Chintesh

  • Difference between doing revaluation of an asset and posting a credit memo

    Hi all,
           My cleint wants to know what exactly is the difference between posting a credit memo to an asset and doing revaluation of an asset.
    Any help is appreciated.
    Thanks,
    Krishna

    hi,
    revaluation: An adjustment to asset values to compensate for a reduction in the value of a currency because of inflation or when adopting market value principles for the valuation of fixed assets.Revaluation enables you to valuate assets at their replacement value (which differs from the acquisition and production costs).
    credit memo: A posting that reduces the balance of the asset
    A.
    pls reward useful answers
    thank you

  • 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

Maybe you are looking for