Sales Opportunity Stage Tab - Want last updated row details in query

Dear Experts,
I have a query as under :
SELECT T1.Name, T1.OpprId, T1.OpenDate, T0.Step_Id, T0.Line, T0.OpprId, T0.U_status, T2.Name FROM OPR1 T0  INNER JOIN OOPR T1 ON T0.OpprId = T1.OpprId INNER JOIN [dbo].[@STAGE]  T2 ON T0.U_status = T2.Code WHERE T1.Name = 'ORDER'
Now I want that this query should give me the last row detail in the Stage TAb of Sales opportunity. Now this query is giving me every row stage details which are put in the Stage Tab. For example in the Stage Tab of Sales Opportunity there are 4 rows of Stages, its giving me all the 4 row stages in the query. I want that only the last stage should be displayed in the query may be it's on 2 second stage or 3 rd ot 4 th. I want only last stage to be shown.
Please advise what I need to do for the above query.
Regards,
Kamlesh

Hi All,
I have been working in a query to generate the last stage details in the query but still not able to resolve it.
SELECT T0.Status,T0.OpprId, max(T1.Line) 'Stage',T0.OpenDate, T0.CardCode, T0.CardName, T0.Territory, T0.CloPrcnt,T1.OpprId, T1.Line, T1.OpenDate, max(T1.OpenDate) 'Open Date',T1.CloseDate, T1.Step_Id,T2.descript, T3.Name, T0.MaxSumLoc, T4.U_swl, T0.MaxSumSys, T0.U_eqno, T0.MaxSumLoc, T4.U_partno, T4.U_desc, T4.U_unit, T4.U_amt, T4.U_qty, T4.U_amt, T4.U_span FROM OOPR T0  INNER JOIN OPR1 T1 ON T0.OpprId = T1.OpprId INNER JOIN OTER T2 ON T0.Territory = T2.territryID INNER JOIN [dbo].[@STAGE]  T3 ON T1.U_status = T3.Code, [dbo].[@SALES_ENQ_ITEM]  T4 WHERE T0.OpprId = T4.U_opprNo AND T0.Status = 'O' group by T0.Status,T0.OpprId, T0.OpenDate, T0.CardCode, T0.CardName, T0.Territory, T0.CloPrcnt,T1.OpprId, T1.Line, T1.OpenDate, T1.CloseDate, T1.Step_Id,T2.descript, T3.Name, T0.MaxSumLoc, T4.U_swl, T0.MaxSumSys, T0.U_eqno, T0.MaxSumLoc, T4.U_partno, T4.U_desc, T4.U_unit, T4.U_amt, T4.U_qty, T4.U_amt, T4.U_span
The above query is generating and giving me the Last Stage through max(T1.Line) 'Stage' field. But I want to have if any opportunity Number has 1,2,3 Stage then only Max should should which is 3 but in this query all 3 are showing.
As per Noratam ''There are other options by checking max of the start-date and stage-key fields of the sage table''.
I can use the Start Date which seems to be max(T1.OpenDate) 'Open Date' but how to give a formula or write a query by which only Max Date is selected as per the stage in the query.
I think I am not able to use the Max funtion properly. Please help what is wrong with it.
Can you please help in this regard.
Regards,
kamlesh
Edited by: Kamlesh Gupta on Mar 22, 2009 11:33 PM

Similar Messages

  • Tabs only open in a new window. Ctl T opens a new window NOT a new tab help-last update this problem started. How do I set FF back to open tabs in 1 window

    Tabs only open in a new window. Ctl T opens a new window NOT a new tab help-last update this problem started 2 days ago. How do I set FF back to open tabs in 1 window?
    There is no plus sign and going into optins and changing settings has not worked. I have uninstall FF and reinstall-keeping my personalization-and that was no help.
    Right clicking on FF Icon to open a new tab, or going up to FF drop down tab and clicking on new tab both do not work.
    Help everything opens a new window not a new tab. there seems to be no way to reset this or to chose a different optin. I just downloaded new tabs at end addon and it didn't do a thing.

    as a first troubleshooting step - does it work like normally when you open & run firefox in [[Safe Mode|safemode]] by pressing the shift key while you open firefox (all other instances have to be closed before)...

  • Adding Activity to Sales Opportunity stage

    I'm trying to create a new activity using the DI API and link it to a certain Sales Opportunity stage.
    I've been looking at the SalesOpportunities and SalesOpportunitiesLines objects to see if I could add an activity there, and I've looking at the Contacts object to see if I could set the SalesOpportunity (stage) there.
    Neither seems to be possible.
    Does anybody know how to link activities to sales opportunities?

    its object Contacts
    there fill properties
    DocType to 97
    ParentobjectId and Parentobjecttype
    I recommend to create one activity by hand through sbo and make select from OCLG table and check, what is tehre filled.

  • Clicked on any the link searched by using google or yahoo, it opened a new tab on latest update. Why's not direct the link on the same tab like last update?

    When I'm using google, yahoo or ask, or any search engine website. I did any random research used and clicked on any link searched by google, it immediately opened and directed me to the new tab to the link that I just clicked. My question is: Why isn't direct the link that I want to load on the same tab? It didn't happen on the last update. Is this a bug? If it's not then is there any solution? Maybe the setting. I will thanks and appreciate for any help.

    Opening the results in the same tab or in a new tab can be set via the search settings page of the Google and Yahoo! sites.
    For the Google website you can set your preferences on the Google.com page via the gear icon at the top right, click that button to open the menu list and select Search settings.
    * http://www.google.com/preferences?hl=en
    * Results Window: Open search results in a new browser window.
    For Yahoo! on the Yahoo! search page via:
    *http://search.yahoo.com/
    *More > Preferences > Display & Layout > Open results in a new tab or window

  • Last update vendor details.

    I wanted to know the details of all the suppliers who has changed the phone number or location or bank account etc from last friday to this friday. Is there any query that i could use to find it?

    Hello.
    You can use the Audit Trail feature to achieve your goal.
    Octavio

  • How to disable Mozilla yellow strip, reminding us constantly to "update a plugin", which we don't want to update. Details (RE: Flash) below: bobgorg@ymail

    Hello, how to disable the long horizontal Mozilla yellow strip, popping up and reminding us constantly to "update a plugin", which we don't want to update.
    Disabling the ones below:
    1/ plugins.update.notify User;true
    2/ plugin.scan.plid.all;true
    3/ dom.ipc.plugins.enabled;false
    either does not help or disables completely Flash! What else to do with this ultra annoying "Update plugins" reminder, as we want to keep the older version 10 of Flash? We just do not want Flash v. 11 - it takes huge amount of CPU, while Version 10 works fine for all 'you tube" and "etc"... videos. No need for V.11. (Let us worry about viruses and security) But here it comes the so annoying Mozilla reminder to upgrade to Flash Version 11 - the yellow strip also takes screen space under the address bar. Please help. Very annoying - almost ready to switch to other browsers if this issue is not resolve. Other than that, the Mozilla 14 is great. Congratulations to all designing it. Thanks in advance. Bob
    Please respond: [email protected]

    Hi,
    You can try to set '''plugins.hide_infobar_for_outdated_plugin''' to true in [http://kb.mozillazine.org/About:config about:config].
    [http://kb.mozillazine.org/About:config_entries about:config Entries]

  • Want to delete Rows from SAP Query which have u20180u2019 or blank values

    Hi Experts,
    I have made one sap-query,  in that I have added some additional fields, after that I am getting some blank or u20180u2019 values in some rows, can anyone tell me how to delete those rows which have u20180u2019 or blank values.
    Regards
    Mahadev Roy

    Hi mahadev
    You must be fetching data from SQ02 in some internal table.Delete values from that internal table.
    Also as you are fetching records from SQ02 then in the select statement you can put this condition of '0' and blank
    so that you will get appropriate result.
    Thanks
    Khushboo

  • Stored procesdure for UDT linked to UDF in Stage of Sales Opportunity

    Dear All,
    I have an User Defined Table named 'process' in Sales Opportunity Row Stage Tab with some values as 1.1, 1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0 so on which is connected to a user defined field named 'Reasons'.
    Now the user does the sales opportunity entry and in the stage tab selects the process e.g 1.5 in the user defined field. Now I suppose 1.5 has a reason name of lost to others. Now I want to add a stored procedure that if the user selects lost in the Sales Opportunity summary tab and he has not selected the reason which is between 1.5 to 1.9 ( means lost reasons ) the sales opportunity should not get saved. An error message should show as please select proper reason.
    Can it be achived through SP. I think we can do it but cannot make the SP could you please guide and help me to resolve this issue..
    Appreciate your quick and positive response.
    Regards,
    Kamlesh

    Hi,
    I am trying to make the SP for cross checking the Lost reason if it is not put which are between 6.0 to 7.0 when the user selects lost in the summary tab but I am getting an error while executing the SP as - Msg 102, Level 15, State 1, Procedure SBO_SP_TransactionNotification, Line 243 Incorrect syntax near '='.
    Note the followings :
    In the OPR1 row I have a udf named U_Status
    My SP is as under :
    IF @transaction_type IN (N'U') AND @object_type = '97'
    begin
    if exists (SELECT * FROM [dbo].[opor] T0 INNER JOIN [dbo].[opr1] T1 ON T0.OpprId = T1.OpprId where T0.Name ='MACHINE' and T0.Status ='L' and T1 (U_status ='0' or U_Status ='1.1' or U_Status ='1.2' or U_Status ='1.3' or U_Status ='1.4' or U_Status ='1.5' or U_Status ='1.6' or U_Status ='1.7' or U_Status ='1.8' or U_Status ='1.9' or U_Status ='2.1' or U_Status ='2.2' or U_Status ='3.1' or U_Status ='3.2' or U_Status ='3.3' or U_Status ='3.4' or U_Status ='4' or U_Status ='4.1' or U_Status ='4.2' or U_Status ='4.3' or U_Status ='5' or U_Status ='5.1' or U_Status ='5.2' or U_Status ='5.3' or U_Status ='5.4' or U_Status ='5.5' or U_Status ='5.6')and T0.opprid =@list_of_cols_val_tab_del)
    begin
    SELECT @error = 10, @error_message = N' Please put proper reasons for Losing the Opportunity'
    end
    end
    Would be obliged if you can throw some light in it.
    regards,
    kamlesh

  • SQL - Retriving Last 6 rows from Join of 2 Tables

    Hi All
    I want to retrive the last 6 rows from a query which has join of 2 tables
    Thanks in adv.
    Junu

    Hi,
    Check this.
    SELECT e.empno, e.deptno, e.sal,e.rn
    FROM (
         SELECT ROWNUM rn, a.empno, b. deptno, a.sal,
              ( SELECT COUNT(1) FROM scott.emp c, scott.dept d
                        WHERE c.deptno = d.deptno ) max_rn
    FROM scott.emp a, scott.dept b
              WHERE a.deptno = b.deptno
         ) e
    WHERE rn BETWEEN max_rn -6 AND max_rn     
    ORDER BY rn     
    Regards
    K.Rajkumar

  • Outlook Integration - email as Activity of Sales Opportunity

    Hello all,
    Is there an option to attach an email from Outlook to Sales Opportunity as Activity? Outlook Integration offers a lot of document type, business partners, items, etc., but not Sales Oportunity.
    I really need it for our customer so any ideas how to make it are welcome.
    Regards, Roman

    I haven't found any solution for adding an activity to a sales opportunity with the DIAPI except direct update of the DB. It's not even possible to add a "Follow Up" activity to activity linked to a sales opportunity, DIAPI loose link to sales opportunity.
    According to [1075696|Link activity to an opportunity level DIAPI; and [966860|Adding Activity to Sales Opportunity stage; it is still not possible to do that in DIAPI
    Interesting that in the DTW we can do that...

  • Display all pending quotation on sales opportunity window

    how display all pending quotation of that customer on sales opportunity window through navigation arrow?

    Hi,
    Run below query in query generator first and save it under query manger. Open sales opportunity and run saved query to get list of open sales quotation.
    SELECT t2.docnum
    FROM OOPR T0
    JOIN OPR1 T1 ON T1.OpprId = T0.OpprId and T1.ObjType='23'
      left join OQUT T2 on t2.DocEntry =  T1.[DocID]
      left JOIN QUT1 T3 ON T2.DocEntry = T3.DocEntry
       where T2.[DocStatus] = 'o' and t2.cardcode = $[OOPR.cardcode]
    Thanks & Regards,
    Nagarajan

  • Query for the table last updated

    hi,
    how to know the time and date a table last updated?
    Regards
    Raj

    Raj,
    Query DBA_OBJECTS, here is an example:
    SQL> SELECT OBJECT_NAME, LAST_DDL_TIM, TIMESTAMP
    FROM DBA_OBJECTS
    WHERE OBJECT_NAME = 'FND_USER'
    AND OBJECT_TYPE = 'TABLE';

  • Update Communication details in HR - PA30

    Hi all,
    I want ot update Communication details for Pernr in T-code : PA30. Infotype -0105, Subtyp - 0001/0010.
    This data should be updated in PA0105 table . Is there any FM's are there to update this or else should we use BDC?
    Regards,
    Balavardhan.K

    hi check this..
    Report abc.
    DATA : P0015 LIKE P0105.
    DATA : RETURN LIKE BAPIRETURN1.
    DATA : KEY LIKE BAPIPAKEY.
    DATA : RETURNE LIKE BAPIRETURN1 .
    P0015-PERNR = '1'.
    P0015-BEGDA = '2061101'.
    P0015-ENDDA = '2061101'.
    P0015-SUBTY  = '0010'.
    P0015-USRID = 'TEST'.
    P0015-USRID_LONG = MAILADDRESS.
    CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
    EXPORTING
    NUMBER = p0105-pernr
    IMPORTING
    RETURN = RETURNE.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    INFTY = '0105'
    NUMBER = P0105-PERNR
    SUBTYPE = P0105-SUBTY
    OBJECTID = P0105-OBJPS
    LOCKINDICATOR = P0105-SPRPS
    VALIDITYEND = P0105-ENDDA
    VALIDITYBEGIN = P0105-BEGDA
    RECORDNUMBER = P0105-SEQNR
    RECORD = P0105
    OPERATION = 'MOD'
    TCLAS = 'A'
    DIALOG_MODE = '0'
    IMPORTING
    RETURN = RETURN
    KEY = KEY.
    IF RETURN IS NOT INITIAL.
    WRITE :/ 'Error Occurred'.
    ENDIF.
    Dequeue
    CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
    EXPORTING
    NUMBER = P0105-PERNR

  • Last stages of Sales Opportunity in XL reporter

    Hi all!
    I would like to print last stage of Sale opportunity in Xl reporter. NOw, i only show all all stages in report but i want only last satges.
    Could you help me!
    Thanks!

    Hi
    Please take the stages in the Parameter. so that you can take the report as per the stages
    Hope it help
    Ashish Gupte

  • Sales Opportunity - Sales Stage

    Hi experts,
    On the sales opportunity window, in the stages tab, the stages field has a Define New option. Is there a way to remove the Define New option. We do not want users to define their own stages.
    Thanks!
    Jane

    Hi Jane,
    Please use Additional Authorization Creator Window to restrict users from accessing User Tables.
    Definition
    Use this window to create and add a new permissions object for user-created forms.
    To get here.. Admin.>System Init > Authorization > Additional Authorization Creator
    In the Additional Authorization Creator window, enter an Authorization Id and Name, From the option dropdown Select the options you want.
    To enter the FormID, Click Edit and enter the Form Number of the User defined table.
    NOTE: To get the Form number open the user defined table and on the Status Bar at the bottom you can see the Form=xxxxx (number), in your case 733. Use this number. To view the form details on the status bar, please click View > System information on the Top Menu.
    One you have entered the Form number click Update.
    Now in the General Authorization Window you can see an additional entry on the right side window bottom called User Authorization clicking which you will see the Additional Authorization you created. Set this as No Authorization for the user for whom you don't want to give permission to define new. Hope this helps.
    Thanks,
    Joseph

Maybe you are looking for

  • Script to get the status of a PW in 365

    I have been doing a ton of research unfortunately I don't think this is possible. I am looking to see when a password expires for a specific account that is only in 365. It is not synced with AD so it is in the cloud. Is there a script to run to find

  • COPA and BO 3.5

    Hello I'm looking for how BO could be used with COPA. I need to do reporting with data from COPA. I would like to do it with Business Object 3.5. I would like to know if there is any free "info content" or univers to be able to use to provide archite

  • Agreement

    Hi All I'm implementing a SAP Project. Customer want control Agreement No by manual but Agreement No only have 10 character but customer want in put about 25 character. Could you have any suggest to resolve this problem. I think the Agreement No can

  • HT4623 when I want to Reset All Settings , my phone ask for Restrictions Passcode

    when I want to Reset All Settings , my phone ask for Restrictions Passcode , and i dont have no code on my phone

  • Procedure and Bind Variable

    I'm trying to write a procedure for an exercise I'm working on. I got an error that I needed to use a "Bind Variable," so now I'm trying to pass a bind variable to the procedure. I am supposed to get user input. CREATE OR REPLACE PROCEDURE insert_gla