PROBLEM IN SELECT STATEMENT

HI FRNDS ..
I AM HAVING SOME ERRORS IN THE WHERE CLAUSE PLZ CORRECT IT
select DOCNO into t_DOCNO from J_1IEXCHDR
       where exnum = gf_text and
             status ne ( 'd' and 'r' and 'b' ).
PLZ HELP ME TO COLLECT VALU OF THE STATUS FILED WHER IT IS NOT EQUAL TO D,  R AND B

RANGES: R_STAT FOR J_1IEXCHDR-STATUS.
R_STAT-LOW = 'D'.
R_STAT-SIGN = 'I'.
R_STAT-OPTION = 'EQ'.
APPEND R_STAT.
CLEAR R_STAT.
R_STAT-LOW = 'R'.
R_STAT-SIGN = 'I'.
R_STAT-OPTION = 'EQ'.
APPEND R_STAT.
CLEAR R_STAT.
R_STAT-LOW = 'B'.
R_STAT-SIGN = 'I'.
R_STAT-OPTION = 'EQ'.
APPEND R_STAT.
CLEAR R_STAT.
DATA: T_DOCNO LIKE J_1IEXCHDR-DOCNO OCCURS 0 WITH HEADER LINE.
DATA: GF_TEXT LIKE J_1IEXCHDR-EXNUM.
SELECT  DOCNO INTO TABLE  T_DOCNO FROM J_1IEXCHDR
WHERE EXNUM = GF_TEXT
AND
STATUS NOT IN R_STAT.
Try to use Ranges.
Regards
vijay

Similar Messages

  • Problem with Select Statements

    Hi All,
    I have a performance problem for my report because of the following statements.
    How can i modify the select statements for improving the performance of the report.
    DATA : shkzg1h  LIKE bsad-shkzg,
             shkzg1s  LIKE bsad-shkzg,
             shkzg2h  LIKE bsad-shkzg,
             shkzg2s  LIKE bsad-shkzg,
             shkzg1hu LIKE bsad-shkzg,
             shkzg1su LIKE bsad-shkzg,
             shkzg2hu LIKE bsad-shkzg,
             shkzg2su LIKE bsad-shkzg,
             kopbal1s  LIKE bsad-dmbtr,
             kopbal2s  LIKE bsad-dmbtr,
             kopbal1h  LIKE bsad-dmbtr,
             kopbal2h  LIKE bsad-dmbtr,
             kopbal1su  LIKE bsad-dmbtr,
             kopbal2su  LIKE bsad-dmbtr,
             kopbal1hu  LIKE bsad-dmbtr,
             kopbal2hu  LIKE bsad-dmbtr.
    *These statements are in LOOP.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1s , kopbal1s)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1su , kopbal1su)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1h , kopbal1h)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1hu , kopbal1hu)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2s , kopbal2s)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2su , kopbal2su)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2h , kopbal2h)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2hu , kopbal2hu)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.

    >
    Siegfried Boes  wrote:
    > Please stop writing answers if you understrand nothing about database SELECTS!
    > All above recommendations are pure nonsense!
    >
    > As always with such questions, you must do an analysis before you ask! The coding itself is perfectly o.k., a SELECT with an aggregate and a GROUP BY can not be changed into a SELECT SINGLE or whatever.
    >
    > But your SELECTS mustr be supported by indexes!
    >
    > Please run SQL Trace, and tell us the results:
    >
    > I see 8 statements, what is the duration and the number of records coming back for each statement?
    > Maybe only one statement is slow.
    >
    > See
    > SQL trace:
    > /people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
    >
    >
    > Siegfried
    Nice point there Siegfried. Instead of giving constructive suggestion, people here give a very bad suggestion on using SELECT SINGLE combined with SUM and GROUP BY.
    I hope the person already look at your reply before he try using select single and wondering why he has error.
    Anyway, the most important thing is how many loop expected for those select statements?
    If you have like thousands of loop, you can expect a poor performance.
    So, you should also look at how many times the select statement is called and not only performance for each select statement when you're doing SQL trace.
    Regards,
    Abraham

  • Problem with Select statement.

    DATA: wa_usr05   TYPE usr05.
    The select statement always gives sy-subrc = 0
    even if there is no entry with parid = 'ZRD'.
    On successful it fills the structure wa_usr05 as
    MANDT     C     3      ACC
    BNAME     C     12      SCL
    PARID     C     20      X
    PARVA     C     18
    but mandt is 310.
    USR05 is a pool table and has mandt field.
            SELECT SINGLE bname
                          parid
                          parva
                FROM usr05
                INTO wa_usr05
                WHERE bname = sy-uname AND
                      parid = 'ZRD'    AND
                      parva = 'x'  OR  parva = 'X'.
    Let me know the reason and solution to the problem.

    SELECT SINGLE * FROM usr05
    INTO wa_usr05
    WHERE bname = sy-uname AND
    parid = 'ZRD' AND
    parva = <b>'X'</b> .
    Use single * as u have defined the wa+usr05 as usr05.
    Else.
    DATA: i_usr05 TYPE STANDARD TABLE of usr05.
    SELECT * FROM USR05
             INTO TABLE usr05
             WHERE bname = sy-uname AND
             parid = 'ZRD' AND
            parva = <b>'X'</b> .
    Then loop at itab and write data.
    Hope this solves ur query.
    Reward points if this helps.
    Message was edited by:
            Judith Jessie Selvi

  • Facing problem in select statement dump DBIF_RSQL_INVALID_RSQL CX_SY_OPEN_S

    Hi Experts,
    I  am facing the problem in the select statement where it giving the short dump
    DBIF_RSQL_INVALID_RSQL CX_SY_OPEN_S.
    i have searched many forms, but i found that the select option s_matnr have the limitaion 2000 entreis, but i am passing same s_matnr to other select statement with more than 2000 entries but it is not giving me any short dump.
    but i am facing problem with only one select statement where if i  pass select option s_matnr more than 1500 entris also giving short dump.
    my select statement is
    SELECT * FROM bsim                                       
             INTO CORRESPONDING FIELDS OF TABLE g_t_bsim_lean  
               FOR ALL ENTRIES IN t_bwkey   WHERE  bwkey = t_bwkey-bwkey
                                            AND    matnr IN matnr
                                            AND    bwtar IN bwtar
                                            AND    budat >= datum-low.
    in the internal table g_t_bsim_lean internal table contain all the fields of the table bsim with 2 fields from other table.
    Please let me know whether i need to change the select statement or any other solution for this.
    Regards,
    udupi

    my select query is like this:
    DATA: BEGIN OF t_bwkey OCCURS 0,                          "184465
              bwkey LIKE bsim-bwkey,                            "184465
            END OF t_bwkey.                                     "184465
      LOOP AT g_t_organ          WHERE  keytype  =  c_bwkey.
        MOVE g_t_organ-bwkey     TO  t_bwkey-bwkey.
        COLLECT t_bwkey.                                        "184465
      ENDLOOP.                                                  "184465
      READ TABLE t_bwkey INDEX 1.                               "184465
      CHECK sy-subrc = 0.                                       "184465
      SELECT * FROM bsim                                        "n443935
             INTO CORRESPONDING FIELDS OF TABLE g_t_bsim_lean   "n443935
               FOR ALL ENTRIES IN t_bwkey   WHERE  bwkey = t_bwkey-bwkey
                                            AND    matnr IN matnr
                                            AND    bwtar IN bwtar
                                            AND    budat >= datum-low.

  • Problem with SELECT statement. What is wrong with it?

    Why is this query....
    <cfquery datasource="manna_premier" name="kit_report">
    SELECT Orders.ID,
           SaleDate,
           Orders.UserID,
        Distributor,
        DealerID,
        Variable,
        TerritoryManager,
        US_Dealers.ID,
           DealerName,
        DealerAddress,
        DealerCity,
        DealerState,
        DealerZIPCode,
        (SELECT SUM(Quantity)
         FROM ProductOrders PO
         WHERE PO.OrderID = Orders.ID) as totalProducts,    
    FROM Orders, US_Dealers
    WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)# AND Variable = '#Variable#'
    </cfquery>
    giving me this error message...
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.
    The error occurred in D:\Inetpub\mannapremier\kit_report2.cfm: line 20
    18 :              WHERE PO.OrderID = Orders.ID) as totalProducts,        
    19 : FROM Orders, US_Dealers
    20 : WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)# AND Variable = '#Variable#'
    21 : </cfquery>
    22 :
    SQLSTATE
      42000
    SQL
       SELECT Orders.ID, SaleDate, Orders.UserID, Distributor, DealerID, Variable, TerritoryManager, US_Dealers.ID, DealerName, DealerAddress, DealerCity, DealerState, DealerZIPCode, (SELECT SUM(Quantity) FROM ProductOrders PO WHERE PO.OrderID = Orders.ID) as totalProducts, FROM Orders, US_Dealers WHERE US_Dealers.ID = DealerID AND SaleDate BETWEEN {d '2009-10-01'} AND {d '2009-10-31'} AND Variable = 'Chick Days pre-book'
    VENDORERRORCODE
      -3504
    DATASOURCE
      manna_premier
    Resources:
    I copied it from a different template where it works without error...
    <cfquery name="qZVPData" datasource="manna_premier">
    SELECT UserID,
           TMName,
        UserZone,
              (SELECT COUNT(*)
               FROM Sales_Calls
               WHERE Sales_Calls.UserID = u.UserID) as totalCalls,
        (SELECT COUNT(*)
         FROM Orders
         WHERE Orders.UserID = u.UserID) as totalOrders,
        (SELECT SUM(Quantity)
         FROM ProductOrders PO
         WHERE PO.UserID = u.UserID AND PO.NewExisting = 1) as newItems,
        (SELECT SUM(NewExisting)
         FROM  ProductOrders PO_
         WHERE PO_.UserID = u.UserID) as totalNew,
        SUM(totalOrders)/(totalCalls) AS closePerc
    FROM Users u
    WHERE UserZone = 'Central'
    GROUP BY UserZone, UserID, TMName
    </cfquery>
    What is the problem?

    It's hard to say: what's your request timeout set to?
    700-odd records is not much of a fetch for a decent DB, and I would not expect that to case the problem.  But then you're using Access which doesn't fit the description of "decent DB" (or "fit for purpose" or "intended for purpose"), so I guess all bets are off one that one.  If this query is slow when ONE request is asking for it, what is going to happen when it goes live and multiple requests are asking for it, along with all the other queries your site will want to run?  Access is not designed for this.  It will really struggle, and cause your site to run like a dog.  One that died serveral weeks ago.
    What else is on the template?  I presume you're doing something with the query once you fetch it, so could it be that code that's running slowly?  Have you taken any steps to isolate which part of the code is taking so long?
    How does the query perform if you take the subquery out of the select line?  Is there any other way of getting that data?  What subquery will be running once for every row of the result set... not very nice.
    Adam

  • Problem with select statement using Ranges

    Hi Guys,
                   I have used Ranges and used a select statement for selecting those ranges but I am facing a problem.
    RANGES: r_doctyp for EDIDC-DOCTYP.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'DEBMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'MATMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'PRICAT'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'ORDERS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'INVOIC'.
    append r_doctyp.
    Select DOCNUM                                " IDoc number
           DOCTYP                                " IDoc Type
                 from  EDIDC into table IT_ZEDIDC
                 where CREDAT EQ s_credat-low
                 and   DOCTYP EQ r_doctyp        " IDOC Types
                 and   DIRECT EQ '1'.
    Here my select statement is only taking INVOIC.
    But my statement should take any document type.
    Thanks,
    Prasad.

    Hi...,
    Your following select statement is correct.
    Select DOCNUM                                " IDoc number
                DOCTYP                                " IDoc Type
                from  EDIDC into table IT_ZEDIDC
                where CREDAT IN s_credat
                and   DOCTYP IN r_doctyp        " IDOC Types
                and   DIRECT EQ '1'.
    Why you are not getting result..
    1. structure of the IT_ZEDIDC is having two fields DOCNUM , DOCTYP  with same data lengths. If not it should be...
    2. Order in the database table is must be similer to the order you maintained in the select statement.
    3. As you are hard coding the input ranges make sure about every letter.
    4. take a look at other where condition fields too.
    5. check the table of the ranges in debugging mode.
    6. why can't you declare separate work area and table for ranges...?
      like .... data: r_tab type range of <field>
                 data: wa_tab like line of r_tab.
    7. Use clear work area statement after the append statment.
    --Naveen Inuganti.

  • Where condition problem in select statement.

    Hi,
    I am trying to write select statement as below
      SELECT objectclas objectid FROM cdhdr INTO CORRESPONDING FIELDS OF TABLE ltab_chgdocu
                       WHERE objectclas IN ('STUE' , 'STUE_V')
                       AND   ( TCODE eq 'CS01u2019 or tcode eq u2019CS02u2019 or   tcode eq 'C201' or tcode eq 'C202' ) .
    But I am getting the error like "literals that takes up more than one line or not permitted"
    Please let me know whats wrong and correct me .
    Thanks,
    Vinay.

    Hi Vinay,
    Declare constants
    constants : c_stue type CDOBJECTCL value 'STUE',
                 c_stue_v type CDOBJECTCL value 'STUE_V',
                 c_cs01 type sy-tcode value 'CS01',
                 c_cs02 type sy-tcode value 'CS02',
                 c_C201 type sy-tcode value 'C201',
                 c_C202 type sy-tcode value 'C202'.
    And replace your hardcoded values with these constants in your select query.
    SELECT objectclas objectid FROM cdhdr INTO CORRESPONDING FIELDS OF TABLE it_tab
                                        WHERE objectclas IN (c_STUE , c_STUE_V)
                                                     AND ( TCODE eq c_CS01
                                                     or tcode eq c_CS02
                                                     or  tcode eq c_C201
                                                      or tcode eq c_C202 ).
    Thanks & Regards
    - Always Leaner

  • Having Problem in select statement.

    Dear gurus
    im having an issue in select statement.
    i have written a select statement which is fetching the result as i required but it takes to much time to execute.
    how to make it work fast.
    SELECT vbak~vkbur vbap~vbeln vbap~posnr vbak~audat
             vbap~kwmeng vbap~meins vbak~kunnr vbak~vkorg
             vbak~vtweg  vbak~spart matnr matkl auart
             vbap~abgru
      INTO CORRESPONDING FIELDS OF TABLE so_tab
      FROM vbak
      JOIN vbap ON vbak~vbeln = vbap~vbeln
      WHERE audat IN in_date
      AND matnr IN matnr
      AND ( auart = 'ZISO' OR auart = 'ZEXP' )
      AND vbap~werks IN werks  .
      SELECT lips~vbeln lips~posnr likp~lfdat lips~lfimg
             lips~meins likp~kunag matnr vgbel vgpos
             lfart
      INTO CORRESPONDING FIELDS OF TABLE del_tab
      FROM likp
      JOIN lips ON likp~vbeln = lips~vbeln
      FOR ALL entries IN so_tab
      WHERE vgbel = so_tab-vbeln
      AND vgpos = so_tab-posnr
      AND lfdat IN in_date
      AND likp~werks IN werks.
    Regards
    Saad Nisar.

    Hi,
    I agree with sabu.
    Along with these you need to do following things -
    SELECT vbak~vkbur vbap~vbeln vbap~posnr vbak~audat
             vbap~kwmeng vbap~meins vbak~kunnr vbak~vkorg
             vbak~vtweg  vbak~spart matnr matkl auart
             vbap~abgru
      INTO CORRESPONDING FIELDS OF TABLE so_tab
      FROM vbak
      JOIN vbap ON vbak~vbeln = vbap~vbeln
      WHERE audat IN in_date
      AND matnr IN matnr
      AND ( auart = 'ZISO' OR auart = 'ZEXP' )
      AND vbap~werks IN werks  .
    {color:green}
    *if sy-subrc eq 0.*
    *so_tab_tmp[]  = so_tab[].*
    *sort so_tab_tmp by vbeln posnr.*
    *delete adjacent duplicates from so_tab_tmp by vbeln posnr.*
    *if so_tab_tmp[] is not initial.*
    {color:green}
      SELECT lips~vbeln lips~posnr likp~lfdat lips~lfimg
             lips~meins likp~kunag matnr vgbel vgpos
             lfart
      INTO CORRESPONDING FIELDS OF TABLE del_tab
      FROM likp
      JOIN lips ON likp~vbeln = lips~vbeln
      FOR ALL entries IN so_tab_tmp
      WHERE vgbel = so_tab_tmp-vbeln
      AND vgpos = so_tab_tmp-posnr
      AND lfdat IN in_date
      AND likp~werks IN werks.
    {color:green}
    *endif.*
    *endif.*
    {color:green}

  • Problem executing SELECT statement due to st_spatial column type

    I am using a CachedRowSet and cache.execute() will not run because it does not support the st_spatial column type. I have been told to use the column metadata to build a select statement of column names, and check the column's type before you add it to the select clause. But, I am unsure of what to do since I can't get column names without running a select statement first... I will attach some code for you to look at, but please give me suggestions!
    try{
    Class.forName("com.informix.jdbc.IfxDriver");
    CachedRowSet cache = new CachedRowSet();
    cache.setReadOnly(true);
    cache.setUrl(dbname);
    cache.setUsername(user);
    cache.setPassword(password);
    cache.setCommand("SELECT * FROM "+table);
    try{
    cache.execute();
    }catch(Exception e){
    out.print("Can't Display");
    OTHER JSP CODE THAT WORKS WITH THE RESULTS FROM ABOVE
    }catch(Exception exc){
    out.println(exc.toString());
    } // end try-catch

    I honestly don't have a clue. I have no idea what the st_spatial data type is, or where it is defined, and as a result, I don't know why Java would be complaining about it. I do know that java.sql.ResultSet doesn't care about it (it would internally recognize it as a plain old object type via the getObject() method and you would have to cast it to st_spatial).
    What I would check:
    Is the Informix driver up to date?
    Does the CachedRowSet class extend ResultSet or otherwise use it as an internal data structure? If so, does it properly create the ResultSetMetaData object and no exceptions are being trapped?
    Otherwise... when copying data from the ResultSet object into its own internal data structure, does it correctly realize that the st_spatial column should NOT be copied into a String or a slot in a String array?
    Does a quick and dirty command line version of your program properly use CachedRowSet to retrieve at least one record from your database?
    Basically, put the JSP aside and just test the CachedRowSet to make sure it is working correctly. I have no idea what's in that class since it is not a Java standard class, so I can't really give you any additional suggestions.

  • Problems with select statement

    Hi,
    For some reason I cannot find the solution for the following problem.
    I have an internal table.
    Now I like to make an select over a database table, while only rows should be selected, where the key field occurs in the internal table and in case of  identical key field only the row with the lowest value in another column is selcted.
    Example:
    - internal table:
    col1  col2  col3
    1     A     AA
    2     B     AA
    3     A     AC
    -database table:
    col1  col2  col3
    1     001   CD
    1     002   CF
    1     003   CG
    2     001   CD
    2     002   CF
    2     003   CG
    3     002   CF
    3     003   CG
    4     001   CD
    4     002   CF
    4     003   CG
    - the selected database entries should be
    1     001   CD
    2     001   CD
    3     002   CF
    explication:
    - entries with 4 in the first column do not occur in the internal table, so they do not appear in the selection
    - in case of more than one entry in the database table only the one with the lowest value in column two will be selected
    If you have any idea how this could be solved, I would really appreciate you help.
    regards
    Torsten

    Hi,
    1) u have to select based on internal table 1
    2) u have to filter the internal table 2 for minimum value.
    select col1 col2 col3
    from <any table>
    into table <Internal_table_final>
    for all entries in <Internal_table_1>
    where col1 = Internal_table_1-col1.
    sort Internal_table_final by col1 col2.
    loop at Internal_table_final.
       at new col1.
          continue.
       endat.   
       delete Internal_table_final.
    endloop.
    <b>try this</b>
    Regards
    <b>Mark Helpful Answers</b>
    Message was edited by: Manoj Gupta

  • Performance problem in SELECT statement

    HI All,
    How to improve the performance in given query?
    Query is..
      data : begin of tzdate OCCURS 0,
               zdate like sy-datum,
             end of tzdate.
    data: p_adrnr like lfa1-lifnr.
       SELECT  single adrnr into  p_adrnr
              FROM lfa1
              WHERE lifnr = ilifnr-lifnr
               AND land1 IN s_land1.
    CONCATENATE '%' p_adrnr '%' INTO email_objectid.
    SELECT  udate INTO table tzdate
                 FROM cdhdr
                 WHERE objectclas = 'ADRESSE'
                   AND objectid  LIKE email_objectid
                   AND tcode      IN r_tcode.
    Regards,
    -D.
    Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting - post locked
    Edited by: Rob Burbank on Sep 16, 2009 10:14 AM

    HI All,
    How to improve the performance in given query?
    Query is..
      data : begin of tzdate OCCURS 0,
               zdate like sy-datum,
             end of tzdate.
    data: p_adrnr like lfa1-lifnr.
       SELECT  single adrnr into  p_adrnr
              FROM lfa1
              WHERE lifnr = ilifnr-lifnr
               AND land1 IN s_land1.
    CONCATENATE '%' p_adrnr '%' INTO email_objectid.
    SELECT  udate INTO table tzdate
                 FROM cdhdr
                 WHERE objectclas = 'ADRESSE'
                   AND objectid  LIKE email_objectid
                   AND tcode      IN r_tcode.
    Regards,
    -D.
    Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting - post locked
    Edited by: Rob Burbank on Sep 16, 2009 10:14 AM

  • Problem in select statement(urgent)

    hi experts,
    my ztable structure is,
    year(key) customer(key) month(key) quan1 quan2 quan3
    2006       britania         01          23   12    13
    2006       britania         06          34   24    15
    2006       britania         09          45   10    22
    i want to select quan1 from the above ztable for the same customer in the same year but the maximum of month.how to do that.
    in the above data i want to select 45 for britania in 2006.
    please give me the solution.
    thanks in advance
    regards,
    Ashok.

    Hi Ashok
      Please try with code similar to this:
      select year customer max( month )
             from <ztable>
             into <itab>
             where <cond>
             group by year customer.
    Kind Regards
    Eswar

  • SELECT statement for VBKD - FAE in FPLT

    HI,
    For CS Report - Need to find the Conform Business (AMC is there But Invoice is Pending ).
    For This -->
    I need to take the table flow as - FPLT --> VBKD --> All (like VBAK, VBAP etc..)
    Problem is -->
    SELECT statement
    INTO IT_VBKD
    FOR ALL ENTRIES IN IT_FPLT
    WHERE fplnr = gwa_fplt-fplnr
    is taking too much time to execute.
    1. All Entries are Pending for Invoice ( FPLT- FKSAF = 'A' )
    2. No entry in VBFA table for this criteria.

    Thanks Vinod,
    Yes, I check it.
    But, In Client's system VBAK-rplnr is always Initial.
    Actually, I have data like -->
    AMC for duration - 01.07.2010 to 30.06.2011
    For which I am taking Four Billing Cycles -
    1. 01.07.2010 to 30.09.2010 - billed on 01.09.2010
    2. 01.10.2010 to 31.12.2010 - billed on 01.12.2010
    3. 01.01.2011 to 31.03.2011 - Unbilled - Projected billing date 01.03.2011       "
    4. 01.04.2011 to 30.06.2011 - Unbilled - Projected billing date 01.06.2011       "
    I have to consider Case 3 & 4 (unbilled). How can I calculate details for it?
    Report is working Fine - if I select - Selection options from FPLT - But while taking it from Sales Order - It's going to TIME OUT at SELECT statement itself.
    (Because table FPLT has more than 10Lac entries - and all are fetched )
    Edited by: Priya.ABAP on Dec 6, 2010 11:47 AM

  • String compare in select statement

    Hi All,
    i have a problem in select statement. i have a name field in my selection screen, i am using name field to comapre string in my select statement, but i am not getting the resule can anyone suggest me on this . please find my code below,s_name1 is my select option name.
    IF s_name1-low IS NOT INITIAL.
    LOOP AT S_NAME1.
      CONCATENATE s_name1-low '%' INTO s_name1-low.
      TRANSLATE s_name1-low TO UPPER CASE.
      s_name1-option = 'CP'.
      MODIFY s_name1.
    ENDLOOP.
    ENDIF.
    SELECT lifnr land1 name1 ort01 ort02 pfach pstl2 pstlz regio stras
             erdat ernam ktokk loevm sperr sperm sperz nodel
        INTO (gs_vendor-vendor_num, gs_vendor-land1, gs_vendor-name,
              gs_vendor-ort01, gs_vendor-ort02, gs_vendor-pfach,
              gs_vendor-pstl2, gs_vendor-pstlz, gs_vendor-regio,
              gs_vendor-stras, gs_vendor-created_on, gs_vendor-created_by,
              gs_vendor-account_gp, gs_vendor-deletion_flag,
              gs_vendor-central_post, gs_vendor-ctr_purch_block,
              gs_vendor-payment_block, gs_vendor-central_deletion)
        FROM  lfa1
             WHERE  lifnr  IN s_lifnr
             AND    name1  LIKE s_name1
    Start of Change G9007789 03/12/2008 - D01K946651
    Additional selection criteria added for City and Region
             AND    ort01  IN s_ort01
             AND    regio  IN s_regio
    End of Change G9007789 03/12/2008 - D01K946651
             AND    ktokk  IN s_ktokk
             AND    ( ktokk  NE 'ZHMT' AND ktokk NE 'ZTER' ).
        APPEND gs_vendor TO gt_vendor.
        CLEAR gs_vendor.
      ENDSELECT.

    Hi,
    Have you checked whether you have given proper events.
    Check this code below.
    AT selection screen output. "Change here
    IF s_name1-low IS NOT INITIAL.
    LOOP AT S_NAME1.
    CONCATENATE s_name1-low '%' INTO s_name1-low.
    TRANSLATE s_name1-low TO UPPER CASE.
    s_name1-option = 'CP'.
    MODIFY s_name1.
    ENDLOOP.
    ENDIF.
    Start-of-Selection. " change here
    SELECT lifnr land1 name1 ort01 ort02 pfach pstl2 pstlz regio stras
    erdat ernam ktokk loevm sperr sperm sperz nodel
    INTO (gs_vendor-vendor_num, gs_vendor-land1, gs_vendor-name,
    gs_vendor-ort01, gs_vendor-ort02, gs_vendor-pfach,
    gs_vendor-pstl2, gs_vendor-pstlz, gs_vendor-regio,
    gs_vendor-stras, gs_vendor-created_on, gs_vendor-created_by,
    gs_vendor-account_gp, gs_vendor-deletion_flag,
    gs_vendor-central_post, gs_vendor-ctr_purch_block,
    gs_vendor-payment_block, gs_vendor-central_deletion)
    FROM lfa1
    WHERE lifnr IN s_lifnr
    AND name1 LIKE s_name1
    Start of Change G9007789 03/12/2008 - D01K946651
    Additional selection criteria added for City and Region
    AND ort01 IN s_ort01
    AND regio IN s_regio
    End of Change G9007789 03/12/2008 - D01K946651
    AND ktokk IN s_ktokk
    AND ( ktokk NE 'ZHMT' AND ktokk NE 'ZTER' ).
    APPEND gs_vendor TO gt_vendor.
    CLEAR gs_vendor.
    ENDSELECT.
    Reward if helpful.
    Regards.

  • Performance problem whlile selecting(extracting the data)

    i have one intermediate table.
    iam inserting the rows which are derived from a select statement
    The select statement having a where clause which joins a view (created by 5 tables)
    The problem is select statement which is getting the data is taking more time
    i identified the problems like this
    1) The view which is using in the select statement is not indexed---is index is necessary on view ????
    2) Because the tables which are used to create a view have already properly indexed
    3) while extracting the data it is taking the more time
    the below query will extract the data and insert the data in the intermediate table
    SELECT 1414 report_time,
    2 dt_q,
    1 hirearchy_no_q,
    p.unique_security_c,
    p.source_code_c,
    p.customer_specific_security_c user_security_c,
    p.par_value par_value, exchange_code_c,
    (CASE WHEN p.ASK_PRICE_L IS NOT NULL THEN 1
    WHEN p.BID_PRICE_L IS NOT NULL THEN 1
    WHEN p.STRIKE_PRICE_L IS NOT NULL THEN 1
    WHEN p.VALUATION_PRICE_L IS NOT NULL THEN 1 ELSE 0 END) bill_status,
    p.CLASS_C AS CLASS,
    p.SUBCLASS_C AS SUBCLASS,
    p.AGENT_ADDRESS_LINE1_T AS AGENTADDRESSLINE1,
    p.AGENT_ADDRESS_LINE2_T AS AGENTADDRESSLINE2,
    p.AGENT_CODE1_T AS AGENTCODE1,
    p.AGENT_CODE2_T AS AGENTCODE2,
    p.AGENT_NAME_LINE1_T AS AGENTNAMELINE1,
    p.AGENT_NAME_LINE2_T AS AGENTNAMELINE2,
    p.ASK_PRICE_L AS ASKPRICE,
    p.ASK_PRICE_DATE_D AS ASKPRICEDATE,
    p.ASSET_CLASS_T AS ASSETCLASS
    FROM (SELECT
    DISTINCT x.*,m.customer_specific_security_c,m.par_value
    FROM
    HOLDING_M m JOIN ED_DVTKQS_V x ON
    m.unique_security_c = x.unique_security_c AND
    m.customer_c = 'CONF100005' AND
    m.portfolio_c = 24 AND
    m.status_c = 1
    WHERE exists
         (SELECT 1 FROM ED_DVTKQS_V y
              WHERE x.unique_security_c = y.unique_security_c
                   GROUP BY y.unique_security_c
                   HAVING MAX(y.trading_volume_l) = x.trading_volume_l)) p
    any one please give me the valueble suggestions on the performance

    thanks for the updating
    in the select query we used some functions like max
    (SELECT 1 FROM ED_DVTKQS_V y
    WHERE x.unique_security_c = y.unique_security_c
    GROUP BY y.unique_security_c
    HAVING MAX(y.trading_volume_l) = x.trading_volume_l)) p
    will these type of functions will cause the performance problem ???

Maybe you are looking for

  • Hundreds of calendars, Hundreds of contacts, all the same...

    Hi all- It doesn't happen all the time, but sometimes I'll get a message saying that iSync wants to update my calendar with thousands of calendar entries, or hundreds of contacts, and it turns out, when I open iCal or Address Book, that all the calen

  • Creative MediaSource, tracks don't sound rig

    Please can somebody help. For no reason that I know of, since yesterday, I cannot listen to music properly through the PC. I use Creative MediaSource but very recently the sound has gone very weird (can't really describe it... sounds like when you he

  • Can a shape be grouped with an object?

    Is there any way to group a shape such as a line with arrowhead to an object? The intent is that the line overlay the object and point to a particular part of the object and that both should move with the text without the relationship between them be

  • Error in ThreadLocal's JavaDoc?

    I'm currently reading "Java Concurrency In Practice" (an excellent book, BTW), and was looking at the passage on ThreadLocal. I then went to the JavaDoc, and it sure looks to me like there's an error in the example code in the JavaDoc. Can someone co

  • HT4137 I can't update iOS on my ipad

    Please can someone explain where I'm going wrong. I have an iPad 2 and I am trying to update the iOS 6.1.3 on my iPad but in my settings - general I don't have a software update in my tab like I do on my iPhone. Does anyone know what I can do to upda