Query On Sales Quotation

Hi All,
         I have made an UDF at title level named priority and set values as High, Medium and Low. When we make a sales order, we set the priority as well. Now the customer wants a query where he can get the details of number of sales quotations made within a week and two weeks range and that too based on the priority i.e the report should show the Highest priority Sales quotation first and so on. I have come up with an SQL but i dont know how to get the date range i.e week range and how to set the report according to the priority level. Can anyone please suggest how to correct this query;
SELECT T0.[CardCode], T0.[CardName], T1.[CntctPrsn], T0.[DocDate], T0.[DocDueDate], T0.[DocNum], T0.[U_Priority] FROM OQUT T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
Thanks in advance,
Joseph
Edited by: Joseph Antony on Mar 5, 2009 11:32 AM

You can try this first:
SELECT T0.CardCode ' Code' , T0.CardName 'Name' , T0.CntctCode, T0.DocDate, T0.DocDueDate 'Valid Untill' , T0.DocNum, T0.U_Priority
FROM DBO.OQUT T0
WHERE DateDiff(ww,T0.DocDate,GetDate())< 3
Order By T0.U_Priority
Thanks,
Gordon

Similar Messages

  • Req:validtion query for sales quotation

    Hi,
    I would like to put validation for sales quotation when Freight1 Tax Code at line level is not empty
    My query is:
    if @object_type ='23' and @transaction_type in ('A','U')
    begin
    if exists(SELECT *  FROM [dbo].[OQUT]  T0 INNER JOIN QUT2 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN QUT1 T2 ON T0.DocEntry = T2.DocEntry
    WHERE T1.TaxCode is not null and T0 .DocEntry = @list_of_cols_val_tab_del and
    T2 .DocEntry =@list_of_cols_val_tab_del )
    select @error=N'001'
    select @error_message =N'Freight1 Tax code should be empty.'
    end
    but didnot get the result.Plz give the solution.

    Hi Md Zak,
    Try dis..
    IF (@object_type = '23' and (@transaction_type IN ('A','U')))
    BEGIN
    If Exists (SELECT T0.DocEntry  FROM OQUT T0 INNER JOIN QUT2 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN QUT1 T2 ON T0.DocEntry = T2.DocEntry
    WHERE T1.TaxCode is not null and T0 .DocEntry = @list_of_cols_val_tab_del)
      Begin
      set @error = N'001'
      set @error_message = N'Freight1 Tax code should be empty.'
      End
    END
    Hope Helpfull
    Regards::::
    Atul Chakraborty

  • Copy data directly from service order to sales quotation

    I know the process to create the sales quotation from service order in customer interaction center but my query is that is there a way that data should be directly copied from the service notification to the service order to the quotation because I have entered the data completly in the notification .Entring the data again and again make mistakes .
    THANKS
    AVANISH GULATEE
    M-08447307358

    look for the BADIS that get triggered when you save the notification. if you find any BADI, then you can create new implementation for it and you can write the code. you can use CRM_ORDER_MAINTAIN to create service order inside that new implementation.

  • Creating Alerts on adding sales quotation?

    Hi All,
    we want to create an alert when adding a sales quotation.
    Overview:
    Someone in a company adds an sales quotation. We have to send automatically an alert to the sales employee in the document.
    We worked on the transaction notification. Now it adds data into OALR and OAIB Tables, but there is no alert sent.
    Do you know a possibility to automatically send alerts when adding documents?
    Or which steps business one makes when sending an alert?
    Best Regards
    Michael

    Hi,
    I am afraid that it will not work if you did not create the sales employee as user. The alert management is a feature to activate the alert that sent to user but not sales employee. So, I suggest to create user code for the sales employee and then under module administration -->  alert management --> press Ctrl+A --> create the alert name --> click open save query button to display query manager --> select and click the query --> select the user code in the To column where the user code is the sales employee by tick the tick box column  --> click add button if finish. You could define the frequency of the alert and save history tick box checked or not checked.
    Rgds,

  • Print Layout of Sales Quotations

    Hi Expert,
                     Iam designing PLD of Sales quotations,i want to Pull Unit price (Variable-81) and Total (Variable-82) of Sales order into sales quotation coloumns.how to pull above variable of Sales order into quotations PLD.pl tell me solutions.
    Rgds
    Sudhir Pawar.

    Hello sir,
                   Thanks for replying me.i tried below query as per ur query syntax but its showing just zero value of previous customer.
    SELECT top 1 T1.[Price]
    FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
    Where T0.[CardCode]=$[$149.4.0]
          and T1.[ItemCode]=$[$149.38.1]
    ORDER BY T0.[CardCode], T1.[ItemCode], T1.[Price] , T0.[DocDate] desc
    Where as T0.[CardCode]=$[$149.4.0]  -- Form-149,Item=4,Pane=0 in Sales Quotations.
                      T1.[ItemCode]=$[$149.38.1] --Form=149,item=4,Pane=1
    result showing just zero value.its may be happens due to wrong selections in FMS ,so  pl tell me correct FMS.
    Thanks
    Rgds
    Sudhir Pawar.
    Edited by: sudhir pawar on Dec 14, 2009 11:24 AM

  • Approval of Sales Order vs Sales Quotation

    Hi experts, How can I fire an approval when total of Sales Order is different from total of quotation base? I retrieved the total from quotation on a sales order user field , but I can't fire the approval.
    Thanks,

    Hi Rolando Arzamendia.
    Try this User Query for Sales Order vs Sales Quotation Approval.
    SELECT Distinct 'True'  FROM
    ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN oqut T2 ON T1.BaseDocNum = T2.DocNum
    WHERE T2.DocTotal = $[ORDR.DocTotal]
    Thanks,
    Madhan.

  • All sales orders which have sales quotations

    Hi, I am new to SAP and would appreciate help on this query.
    I want docnum for all sales order and also docnum of quotation of those sales orders if those sales orders have any sales quotations. basically only those quotation should show which have sales orders and all sales orders should show even if they have quotations or not. I wanted to pull sales employee name also associated with the sales order.
    This if my first attempt to ask a question on the forum, and I would really appreciate help on this.

    Hi........
    Warm welcome to SAP Business One Forum.....
    Please try this........
    Select T0.DocNum 'Sales Order No.', T0.DocDate 'Sales Order Date',
    T3.DocNum 'Sales Quot. No.', T3.DocDate 'Sales Quot. Date'
    From ORDR T0 Inner Join RDR1 T1 On T0.DocEntry=T1.DocEntry
    Left Join QUT1 T2 On T1.BaseEntry=T2.DocEntry LEFT JOIN
    OQUT T3 On T2.DocEntry=T3.DocEntry
    Hope this will help you........
    Regards,
    Rahul

  • Query for Sales Order Analysis

    Dear Experts
    I have written a Query for Sales Order Analysis and would like to have help on this.
    The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum] ORDER BY T0.[DocNum]
    where U_Total_GP is a UDF for storing the GP of each order.
    After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. However, the query does not calculate column total for total amount and total GP. Although I know the total for each column can be displayed by pressing "Ctrl" + Click on the column title, it would have to be done from time to time.
    Therefore, I would like to modify my query in order to calculate the column totals when executed. Are there any suggestions for this?
    Thank you
    Regards
    Elton

    Hi Elton,
    Try this:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]
    ORDER BY T0.[DocNum]
    Thanks,
    Gordon

  • Query on Sales Order Analysis

    Dear Experts
    I have written a Query for Sales Order Analysis and would like to have help on this.
    The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]
    After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. Everything is fine with this query except I would also like to incdude the total number of Sales Order (per day) right below the column "DocNum".
    Is it possible to achieve this?
    Thank You
    Regards
    Elton

    Try this:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT count(DocDate), SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]

  • Storeprocedure for sale order without sale quotation

    hi,
    i want sp where without creating SQ, SO WILL NOT ADD

    Hi ,
    Please try this ,
    create TRIGGER [dbo].[BaseEntry] ON [dbo].[RDR1]
    for Insert
    AS DECLARE
        @BaseEntry nvarchar(max) 
    BEGIN
         SET NOCOUNT ON;
        SELECT @BaseEntry =isnull(BaseEntry,'') FROM INSERTED
        if isnull(@BaseEntry,'') =''   begin
           RaisError('Please Raise Sales Quotation First.',16,10)
           Rollback transaction
        end
    END
    Thanks
    Lloyd

  • Copy closed or cancelled sales quotation to sales order

    2007A SP0 PL49
    It is possible to copy a closed/cancelled sales quotation to a sales order. It is also possible to copy to sales order several times. What is the reason for this? Has this always been the way it works?

    Yes it's possible and been around since we started with SAP 2005A. We use sales quotes extensively and treat them like standing orders.  We have customers that order the same items over and over daily/weekly, and rather than have to key in those sales orders over and over we use the document generation wizard to copy sales quotes to sales orders based on UDF we have added.
    If you want closed sales quotes to be blocked from adding to a subsequent document I am sure this can be done with stored procedures.

  • Send Sale Quotation to customer by email

    Can i send out sale quotation to customer by email in B1.
    Can you help me! Thank you

    Hi.
    In 2004C
    You ought to have SBO Mailer from SBO Service Manager installed. Then open document and choose File - Send - E-mail. If contact person has e-mail it will put in automatically, if no type or In window Send message choose Add recipient - Contact Person. Check E-mail. type here. Fill Subject and press Send.
    With regards
    Maxim Groonis

  • In the Production Order, Sales Quotation is displayed not the Sales Order

    Hello to All,
    I need a kind help from you.
    My scenario is as follows
    There is a Configurable Material (Finished Product)
    Sales quotation (VA21/2/3) were made for this material.
    Sales Order (VA01/2/3) with reference from the Sales Quotation were made for this same material.
    Now when I run the MRP (MD02) for this material, Planned Orders were created.
    Planned orders were converted to the Production Order.
    In the Production Order (say in Display mode), under the 'General' tab, there is a segment called 'Sales order'. In this segment, the sales order is being displayed if the Production Order is created for a sales order (MTO scenario).
    But, in my case, the Sales Quotation number is being displayed instead of the Sales order.
    My Issue which need your answers:
    Is it a standard SAP scenario?? I mean, if the production order is created for a sales order and again if the sales order is created earlier with reference to a sales quotation, then in the production order, the Sales quotation is displayed. Is it a standard?? Or it is showing wrongly? I mean, is it like that, always the sales order should be displayed in the Production order and not the sales quotation??
    Please suggest so that I can overcome this problem, if at all it is a problem.
    Some More Inputs (For your analysis/research):
    1. After the MRP run of the material the Planned Order is created. I have checked the planned order, and found tha the assignment of sales document (in this case Quotation) is done in the Planned order itslef. It is visible wthin the "Assigmnet" tab of the Planned Order.
    2. For the analysis purpose, I created one stand-alone Sales Order for the same material. I mean, without reference from any Sales Quotation. Then, when I run the MRP (md02), the Planned Order and then production order were created normally, with reference to the Sales order. This just for your kind information.
    3. I have checked the pegged requirement of the Production order in the MD04. It is showing the Sales order itself. But, if I see the production order (CO02/O03), it shows sales quotation.
    User Requirement:
    Evenif, the sales order is created with reference to a Sales Quotation, after MRP run, in the Planned and thereby subsequent production order, the Sales Order should display and not the Sales quotation.
    Please suggest.
    Thanks and Regards,
    Supriyo

    Hi
    Since your scenario is configurable material,  the system takes the reference of sales quotation only. Because the in case of configurable materials the sales quotation is the base and based on the sales quotation the sales order is created and subsequent production order.
    This is std SAP and for configurable materials the sales quotation is deciding factor
    Krishna

  • Attachments(matrix) in Sales Quotation

    Hi All,
                  In my sales quotation i want to add an attachemnt tab,in that matrix will be there.i want to browse from dialog box & add 'n' no.of items to the matrix folder & save it.can anybody tell me some sample coding to add multiple items in matrix & add....same like in sales oppurtunities i want to add attachments in sales quotation.
    thanks
    dileep

    hi
    I think you got confused with document and draft no on Approval documents.
    Ofcourse many user,got this confusion.
    The Document number wont be generated in Sales Quotation till you add it(i.e when waiting for approval)
    The document number which is shown in  that document when pending for the approval, is not the finalised number.
    Its just the next number of sales quotaion which wont get stored in sales quotation,rather it will store in Draft table ODRF.
    when you have too many documents which is waiting for approval,you can notice that document number will be same for all the other documents.
    So you note down the Draft Number which is UNIQUE.
    For Ex:
    you are creating sales quotation which has the document number as '335'.
    so when you sending it for approval the draft number will be staored as '211'.
    after getting the approval,when you add it,document number will be generated as '337' because two documents were posted when the draft no:211 is waiting for approval.
    revert me for any clarification.
    Edited by: kambadasan on Feb 23, 2012 1:41 PM

  • How to find out Inquiry  document number in sales quotation

    Hi all
    my client have requirement that while creating quotation with reference to inquiry number the system should copy inquiry number in sales quotation it should be save into any particulates field so base on that  he can configure  output determination can any one help me how to find out Inquiry  document number in sales quotation and what are the config step i need to do
    Thanks and regards
    rajesh

    Hi raj
    Firstly  , In Sales header data you can see the preceding document feild but i am not sure in which tab .
    Secondly, As far as document flow is concerned go to VA22 and then you will get the document number of the quotation and at the top you will get one small icon which is document flow , but i am, not sure with the shortcut but just check with  Shift +F2. then you can see the flow
    Regards
    Srinath

Maybe you are looking for