Query on Sales Oppurtunity

Hi All,
        I have made a query report for sales opportunity which is repeating the data. Can i please get any suggestions as on how to correct this query???
SELECT   T0.[U_ECLNO],  T0.[CardName] as 'Name of Client' ,  T3.[Street]+ T3.[Block]+ T3.[ZipCode]+ T3.[City]+ T3.[Country]+ T3.[State] as 'Address' , T1.[Name] as 'Cont. Per.' , T0.[PrjCode] as 'Project' , T0.[U_Consultant], T2.[SlpName] as 'Gen./Follow up by' , T0.[MaxSumLoc] as  'Offer Value', T0.[OpenDate] as ' Offer sent', T0.[Memo] as 'Remarks'  FROM OOPR T0  INNER JOIN OCPR T1 ON T0.CprCode = T1.CntctCode INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode, CRD1 T3
Thanks in advance,
Joseph

Try this query
SELECT T0.U_ECLNO, T0.CardName as 'Name of Client' , T1.Address,T1.Name as 'Cont. Per.' , T0.PrjCode as 'Project' , T0.U_Consultant, T2.SlpName as 'Gen./Follow up by' , T0.MaxSumLoc as 'Offer Value', T0.OpenDate as ' Offer sent', T0.Memo as 'Remarks' FROM OOPR T0 INNER JOIN OCPR T1 ON T0.CprCode = T1.CntctCode INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode
Where T3.CardType = 'L'
Jeyakanthan

Similar Messages

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

  • Query For Sales Order Amendments

    Hi,
    Does anyone have a query that lists the amendments to a Sales Order?
    I basically want to create an alert that runs this query once a day and shows me the sales orders that have been amended that particular day.
    Any help on this would be gratefully received.
    Regards
    David

    Hi..
    Try These Query in Alert you will get your req. fulfill
    SELECT T0.[DocNum], T0.[DocStatus], T0.[DocDate], T0.[DocDueDate], T0.[CardCode], T0.[CardName] FROM ADOC T0 WHERE T0.[ObjType] = 17 AND  T0.[UpdateDate] = GETDATE()
    Regards,
    Bhavank
    Edited by: Bhavank on Sep 28, 2010 5:50 PM

  • Query for Sales order and corr.AR Invoice Info

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT
    ORDER_NUMBER
    CUSTOMER_NUM
    CUSTOMER_NAME
    ORDERED_DATE
    FLOW_STATUS_CODE
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    There are some issues that must be defined before you have the exact query.
    Do you have freight charges or non-inclusive tax? If you have, freight charges and tax amounts must be included?
    Depending on you grouping rule, you can have lines from more than one order in a single invoice. In this case, as invoice amount you want the sum of all lines, or only the lines from that order?
    Below is an example using two views. It assumes that grouping rules split lines from different order into different invoices.
    Hope it helps,
    Ketter Ohnes
    create or replace view order_summary as
    select oh.org_id,
    oh.ORDER_NUMBER,
    oh.header_id,
    ott.name tt_name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code,
    sum(ol.ordered_quantity*ol.unit_selling_price) total,
    sum(ol.tax_value) tax,
    (select sum(operand)
    from OE_PRICE_ADJUSTMENTS_v x
    where x.header_id = oh.header_id
    and x.adjustment_type_code='FREIGHT_CHARGE') freight_charge
    from oe_order_headers_all oh,
    oe_order_lines_all ol,
    hz_cust_accounts ca,
    hz_parties p,
    oe_transaction_types_tl ott
    where ol.header_id=oh.header_id
    and oh.sold_to_org_id = ca.cust_account_id
    and ca.party_id = p.party_id
    and oh.order_type_id = ott.transaction_type_id
    and ott.language =
    (select language_code
    from fnd_languages
    where installed_flag = 'B')
    group by oh.org_id,
    oh.header_id,
    oh.ORDER_NUMBER ,
    ott.name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code;
    create or replace view invoice_summary as
    select a.interface_header_context,
    a.trx_date,
    a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2 tt_name,
    a.customer_trx_id,
    sum(b.extended_amount) invoice_total
    from ra_customer_trx_all a,
    ra_customer_trx_lines_all b
    where a.customer_trx_id = b.customer_trx_id
    and b.interface_line_context = 'ORDER ENTRY'
    and b.line_type in ('LINE','FREIGHT')
    group by a.interface_header_context,
    a.trx_date, a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2,
    a.customer_trx_id;
    select *
    from order_summary o,
    invoice_summary i
    where o.order_number between :1 and :2
    and o.order_number = i.interface_line_attribute1
    and o.tt_name = i.tt_name;

  • Query for Sales Order and AR Invoice Information

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT     
    ORDER_NUMBER     
    CUSTOMER_NUM     
    CUSTOMER_NAME     
    ORDERED_DATE     
    FLOW_STATUS_CODE     
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    Table RA_CUSTOMER_TRX_ALL can be joined to RA_CUSTOMER_TRX_LINES_ALL table through CUSTOMER_TRX_ID column. The table RA_CUSTOMER_TRX_LINES_ALL.INTERFACE_LINE_ATTRIBUTE6 = OE_ORDER_LINES_ALL.LINE_ID. And from the LineId, you can get the HeaderId os the OE_ORDER_HEADERS_ALL table.
    You must have visualized the query by now.
    Thanks
    Sumit

  • Query vs Sales Analysis Report

    I wrote a query that does virtually the same thing as a sales analysis report -- add up all invoice totals and calculate a gross sales number.
    In the sales analysis report ItemXXX has a total sales of $1456.94
    My query ItemXXX has a total sales of $1457.73
    A $.79 discrepancy which I assumed was a result of the fact that my query doesn't include A/R Credit Memos. Only some items have this discrepancy.
    The problem is that if I do an inventory posting list on the item there are no A/R Credit Memos listed. Only A/R Invoices, A/P Invoices, and A/P Goods Receipts.
    What other documents could be affecting this number? Any other things that could be causing this?
    Thanks,
    -Steve

    Hi Nagarajan,
    Im user of Sap Business One, i need the completly query for obtain the Sales Analysis Report
    i have this but in some items dont match
    SELECT  ItemCode,   
            Sum(TotFac) - SUM(TotNC) as  'FacturadoNeto',   
            Sum(GBrutaFac)-SUM(GbrutaNC) as  'GBruta',   
            Round((Sum(GBrutaFac)-SUM(GbrutaNC))/case when  (Sum(TotFac) - SUM(TotNC))= 0 then 1 else (Sum(TotFac) - SUM(TotNC)) end  *100,2) as '% Margen'   
    FROM (   
    SELECT    
    ItemCode = T1.ItemCode, 
    Marca = (Select T2.FirmName from OMRC T2 JOIN OITM T3 on T2.FirmCode = T3.FirmCode where T3.ItemCode=T1.Itemcode), 
    TotFac = Sum(T1.Linetotal),    
    GBrutaFac = SUM(T1.GrssProfit),   
    TotNc= 0,   
    GbrutaNC = 0   
    FROM OINV T0 (NOLOCK) INNER JOIN INV1 T1 (NOLOCK) ON T0.DocEntry = T1.DocEntry                                    
    WHERE (T0.[DocDate] >='20140101' AND  T0.[DocDate] <='20141231') 
      and T0.DocType  = 'I' -- solo facturas por articulos   
    Group by  T1.ItemCode  
    Union   
    SELECT    
    ItemCode = T1.ItemCode,   
    Marca = (Select T2.FirmName from OMRC T2 JOIN OITM T3 on T2.FirmCode = T3.FirmCode where T3.ItemCode=T1.Itemcode), 
    TotFac = 0,   
    GBrutaFac = 0,   
    TotNc= Sum(T1.LineTotal),    
    GbrutaNC = SUM(T1.GrssProfit)   
    FROM ORIN T0 (NOLOCK) INNER JOIN RIN1 T1 (NOLOCK) ON T0.DocEntry = T1.DocEntry                                    
    WHERE (T0.[DocDate] >='20140101' AND  T0.[DocDate] <='20141231')
      and T0.DocType  = 'I' -- solo NC por articulos   
    Group by T1.ItemCode 
    Union
    SELECT    
    ItemCode = T1.ItemCode,   
    Marca = (Select T2.FirmName from OMRC T2 JOIN OITM T3 on T2.FirmCode = T3.FirmCode where T3.ItemCode=T1.Itemcode), 
    TotFac = 0,   
    GBrutaFac = 0,   
    TotNc= Sum(T1.LineTotal),    
    GbrutaNC = SUM(T1.GrssProfit)   
    FROM ODPI T0 (NOLOCK) INNER JOIN DPI1 T1 (NOLOCK) ON T0.DocEntry = T1.DocEntry                                    
    WHERE (T0.[DocDate] >='20140101' AND  T0.[DocDate] <='20141231')     
      and T0.DocType  = 'I' -- solo Fact Anticipos por articulos   
    Group by T1.ItemCode
    ) T   
    Group by  ItemCode, Marca

  • In query  display  sales negative values

    Hi Friends
    Iam Exicuting query based on these selection parameters
    Sales Org: 5360
    cal Month/Year: 04.2007 to 04.2008
    When am exucuting the query above parameters some values display negative values like
    04.2007 month display -39
    07.2007 month display -253
    the key-fig is sales turnover Qty display negative values
    in BW side cube also display negative values
    why display the negative values
    anybody help me

    Check the Source where data is coming if it is negative value. If source has positive value, in Cube also it should be positive.
    Whatever value you have in your infoprovider, it will display in query.

  • Change in an LOV query of Sales Order Form not working

    Hi,
    I wish to change the the Order Type (in the Sales Header) displayed in the Sales Order Form when viewed from a particular Responsibility.(11i Instance)
    To be specific only certain order types should be displayed in the LOV when the User tries to create Order from that Responsibility.
    In that process I created an FP with Action --> Builtin -->Create Record Group From Query
    Then in Property-->Object Type-->LOV and Target Object -->ORDER_TYPE Value-->Name of my Query Group
    I downloaded the Sales Order Form and modified the Query of the Group keeping the columns selected and the view used same and added in the Group I created.
    But it didn't work out.
    I tried out by changing my Target Object to SRV_ORDER_TYPE and its corresponding query from the Oracle Form.
    But still it didn't work.
    Please tell me where I'm going wrong.
    Am I not choosing the correct target record group LOV?

    Hi Robert,
    I have successfully accessed a matrix using Visual Basic .Net. It has been quite a challenge while I was at it.
    One important thing to understand is that (unless you access the datasource) in order to access a particular control in a matrix object, this control needs to be visible and enabled. It is like simulating a user accessing the matrix via GUI... if a control is not enabled, you cannot access it (as said via control). That might explain question 1.
    Short sample on matrix handling is here:
    http://www.itwiki.net/ow.asp?SboHowToReadFromAndWriteIntoMatrix
    <b>Q2 - Cell count:</b>
    I have personally never used the Cells count method. It should always return the number of rows. My only guess here is that you are using an old reference on the matrix object in which the rows are not there yet.
    Dim oMatrix As SAPbouiCOM.Matrix
    Dim oColumn As SAPbouiCOM.Column
    Dim oEditText as SAPbouiCOM.EditText
      oMatrix=YourSboForm.Items.Item(38).Specific
      oColumn=oMatrix.columns.item(strColumnname).specific
      oEditText=oColumn.items.Item(1).specific
      Msgbox(oEditText.String)
    The above code should get you the first cell of the first row of the given matrix.
    HTH Lutz Morrien
    P.S.: If you need any more sample code, check with the SAP matrix sample or send me a mail (adress see Http://www.itwiki.net)

  • BP Turnover Query by Sales Emp

    Hi Experts,
    I am trying to run this query to show in 3 columns the turnover over 3 years per sales employee for each of their customers.
    SELECT T1.[CardCode], T1.[CardName], 
    (select Sum(T2.DocTotal) where T2.[Docdate] between '20110101' and '20111231') 'Turnover 2011',
    (select Sum(T2.DocTotal) where T2.[Docdate] between '20100101' and '20101231') 'Turnover 2010',
    (select Sum(T2.DocTotal) where T2.[Docdate] between '20090101' and '20091231') 'Turnover 2009'
    FROM OSLP T0  INNER JOIN OCRD T1 ON T0.SlpCode = T1.SlpCode INNER JOIN OINV T2 ON T1.CardCode = T2.CardCode WHERE T0.[SlpName] Like '[%2]%%' group by t1.cardcode, t1.cardname, t2.docdate
    The problem I am getting is that there are multiple entries for each BP - whereas I only need to see one.   Also I would like to know if it it possible to only show BPs where there has been activity for the sales emp which should cut down the results.
    Many Thanks
    Geoff

    Hi Geoff........
    Please try this.......
    Select T0.CardCode, T0.CardName, (IsNull((Select Sum(T4.DocTotal) From ORDR T4 Where T4.CardCode=T0.CardCode And T4.DocDate Between '20110101' And '20111231'),0)) '2011',
    (IsNull((Select Sum(T4.DocTotal) From ORDR T4 Where T4.CardCode=T0.CardCode And T4.DocDate Between '20100101' And '20101231'),0)) '2010',
    (IsNull((Select Sum(T4.DocTotal) From ORDR T4 Where T4.CardCode=T0.CardCode And T4.DocDate Between '20090101' And '20091231'),0)) '2009'
    From OCRD T0 Inner Join OSLP T1 On t0.SlpCode=T1.SlpCode
    Where T1.SlpName Like ''[%2]'%%'
    Regards,
    Rahul

  • Problem with bex query listing sales "this month" and "same month last year

    Hi,
    I've created a query in BW BEx, where I have a mandatory variable for 0calmonth, and I list 0material and sales (in volume, liter). And I have a restricted key figure giving me sales (volume in liter) restricted with 0calmonth = variable - 12, to give me the sale for the same month the user select, previous year.
    This seems to be working, the sum is correct, but when adding up the number for the sales in the month previous year, the numbers does not fit the sum in the end.
    I think the report only lists materials with sales the month selected in the variable, if a material has not been sold that month, but in the same month last year, it's not listed in the reports, but it's added in the sum in the end.
    Example.
    We have three records like this:
    material - calmonth - volume
    101 - 01.2010 - 5
    101 - 01.2011 - 8
    201 - 01.2010 - 7
    The report will give the following (calmonth variable = 01.2011)
    Material - volume this month - volume same month last year
    101 - 8 - 5
    Sum 8 - 12
    Any way to solve this issue? We noticed because we run BO - Webi on top of the BEx query, and BO sum's the values per material, and in webi the report would give us the sum 8 and 5.
    Any input is appreciated.
    Regards,
    Øystein

    Hi,
    thanks for your reply.
    The error is that the report only seems to list materials that has been sold "this month", and if the same material was sold the same month last year, it will also list the volume for this.
    But if the material is only sold in the same month last year, it's not listed in the report, but it's calculated into the sum at the end.
    The report is listing material, which is why the error presents itself, as you said
    Getting 8 minus 12 is correct unless you drill down by material. In that case, it should be 8 minus 5 and 0 minus 7.
    The row with 0 - 7 is not shown, and my guess is that the report will only list materials that has sales this month (which has been selected in the variable)
    Regards,
    Øystein
    Edited by: Oystein Gundersen on Mar 21, 2011 4:36 PM

  • How to Create Specific SAP Query for Sales BOM

    Dear All Salute !!
    How I can create a SAP Query which provide information from the Sales Order-Line Item, this specific material is having any BOM or not?
    Suppose, user want Input,
    Sales Order No., Product Category, Duration of Sales Order Release.
    want Output,
    Sales Order No., Customer No., Customer Description, Sales Order Line Item, Material No., Material Description, Delivery Date, Quantity, Sales Order release Date
    Users requirement is, List of All Line Items for which BOM is yet to be Uploaded in the System.
    Please provide complete detail with Table & field by using SAP Query.
    Rgds
    Srivastav
    +91-9973504950

    If I am correct, in table KDST, you can see the details of Sales BOM with sale order.  Since right now, I dont have access to SAP, I am unable to confirm this.  You have to consider this table and develop on your own logic with the help of ABAPer.
    thanks
    G. Lakshmipathi

  • 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

  • Warranty related query for sales item

    hi I need a report for checking an sales item is under warranty or not & also I want to know the status of the products which comes under warranty is in open state or closed state Regards, K.Ramasamy

    Hi,
    Try this query:
    SELECT T0.[ItemCode], T0.[ItemName], T1.[TmpltName], T1.[Deleted] FROM OITM T0  inner join OCTT T1 on  T0.[WarrntTmpl]  =  T1.[TmpltName] WHERE T0.[SellItem]  = 'y'
    Thanks.

  • 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

Maybe you are looking for

  • Recovery key from MBAM for non TPM machines

    Hi, Since long time am trying to find answer about below query but unlucky , can some one guide me if this is feasiable or not? 1. I have non TPM Machines and want to use Bitlocker with MBAM. 2. if I will use the USB flash driver as start-up key duri

  • Additional field in the sales order screen

    I need some additional field in the sales order screen. There is   also no screen exit available for VA01. Can I use this   additional data B tab in header details by creating additional   field in it. Please tell me how to use this tab or how to get

  • Help with initial settings in Adobe Premier Elements 7

    I recently bought a Sony DSC-T500 camera which can shoot 720P MPEG4 AVC/H.264.  This week I purchased the Premier Elements 7 in hopes to edit video.  My question concerns the very first screen that shows up when you open a new project.  I'm unsure wh

  • Passing internal table through Submit

    Hi, How do i pass an internal table through Submit statement. i dnt want to declare a select-options for this purpose. Is ther any other way?? Answers will be rewarded Regards, Rohan

  • Corruption of system.journal

    I have a problem with journald, my system.journal file's is corrupted at every boots dmesg: [ 35.565257] EXT4-fs (sda1): mounting ext2 file system using the ext4 subsystem [ 35.587096] EXT4-fs (sda1): mounted filesystem without journal. Opts: (null)