Please help - NE where condition in SELECT statement

Dear experts,
I am posting a section of my codes here for your review on performance tuning.
In my second select statement, I used a "NE" where condition. I read somewhere in this forum that using "NE" where condition is not a good decision for improving codes' performance. What alternatives can I have to achieve the same purpose? May I use "NOT IN" here instead? Or do I use a LOOP for this (a rather manual way)?
Just to let you all know that I still consider myself quite inexperienced in ABAP - please also let me know how I can better improvise my programming techniques in the posted codes here too.
I will be most glad to provide you with further information if needed - just let me know.
Many THANKS in advance!
IF p_noncis = 'X'.      " Non CIS category of spend selected
    " zfi_cis_mat_grp is a bespoke table that stores all CIS MATKL
    " and it has two fields only - MANDT and MATKL
    SELECT * FROM zfi_cis_mat_grp    
    INTO TABLE gt_cis_mat_grp.
    IF gt_cis_mat_grp IS NOT INITIAL.
      SELECT ebeln
             ebelp
           matkl
      FROM ekpo
      INTO TABLE gt_ekpo
      FOR ALL ENTRIES IN gt_cis_mat_grp
      WHERE matkl NE gt_cis_mat_grp-matkl.    " NE where condition - is this OK?
    ENDIF.
    IF gt_ekpo IS NOT INITIAL.
      IF s_sakto IS NOT INITIAL.
        SELECT ebeln
               ebelp
               sakto
        FROM ekkn
        INTO TABLE gt_ekkn
        FOR ALL ENTRIES IN gt_ekpo
        WHERE ebeln = gt_ekpo-ebeln AND
              ebelp = gt_ekpo-ebelp AND
              sakto IN s_sakto.
        IF gt_ekkn IS NOT INITIAL.
          SELECT bukrs
                 lifnr
                 belnr
                 budat
                 cpudt
                 xblnr
                 ebeln
                 ebelp
                 zfbdt
                 zterm
                 zlspr
          FROM bsik
          INTO TABLE gt_bsik
          FOR ALL ENTRIES IN gt_ekkn
          WHERE bukrs IN s_bukrs AND
                lifnr IN s_lifnr AND
                budat IN s_budat AND
                cpudt IN s_cpudt AND
                xblnr IN s_xblnr AND
                ebeln = gt_ekkn-ebeln AND
                ebelp = gt_ekkn-ebelp AND
                qsskz NE ''.
        ENDIF.
      ELSE.
        SELECT bukrs
               lifnr
               belnr
               budat
               cpudt
               xblnr
               ebeln
               ebelp
               zfbdt
               zterm
               zlspr
        FROM bsik
        INTO TABLE gt_bsik
        FOR ALL ENTRIES IN gt_ekpo
        WHERE bukrs IN s_bukrs AND
              lifnr IN s_lifnr AND
              budat IN s_budat AND
              cpudt IN s_cpudt AND
              xblnr IN s_xblnr AND
              ebeln = gt_ekpo-ebeln AND
              ebelp = gt_ekpo-ebelp AND
              qsskz NE ''.
      ENDIF.
    ENDIF.
  ELSE.      " Complete list of category of spend selected
    SELECT bukrs
           lifnr
           belnr
           budat
              cpudt
           xblnr
           ebeln
           ebelp
           zfbdt
           zterm
           zlspr
    FROM bsik
    INTO TABLE gt_bsik
    WHERE bukrs IN s_bukrs AND
          lifnr IN s_lifnr AND
          budat IN s_budat AND
          cpudt IN s_cpudt AND
          xblnr IN s_xblnr AND
          qsskz NE ''.
  ENDIF.

Hi,
If you want to remove th NE option then try this way..
SELECT bukrs
           lifnr
           belnr
           budat
              cpudt
           xblnr
           ebeln
           ebelp
           zfbdt
           zterm
           zlspr
    FROM bsik
    INTO TABLE gt_bsik
    WHERE bukrs IN s_bukrs AND
          lifnr IN s_lifnr AND
          budat IN s_budat AND
          cpudt IN s_cpudt AND
          xblnr IN s_xblnr .
IF SY-SUBRC EQ 0.
  Delete gt_bsik where qsskz EQ ' '.
ENDIF.

Similar Messages

  • Dynamic where condition in Select statement

    Hi,
    I have 10 fields on selection-screeen. In which ever field the user enters single values or ranges,i should pick that field dynamically and pass that field along with value range to Where condition of Select statement.How can i achieve this? Please help.
    Regards
    K Srinivas

    see the following example:
    data : begin of itab occurs 0,
             matnr like mara-matnr,
    end of itab.
    ypes: begin of ty_s_clause.
    types:   line(72)  type c.
    types: end of ty_s_clause.
    data : begin of gt_condtab occurs 0.
            include structure hrcond.
    data : end   of gt_condtab.
    FIELD-SYMBOLS <fs_wherecond> TYPE ty_s_clause.
    data:
      gt_where_clauses  type standard table of ty_s_clause
                        with default key.
    gt_condtab-field = 'MATNR'.
    gt_condtab-opera = 'EQ'.
    gt_condtab-low = '000000000000000111'.
    append  gt_condtab.
    clear  gt_condtab.
    call function 'RH_DYNAMIC_WHERE_BUILD'
      exporting
        dbtable         = space " can be empty
      tables
        condtab         = gt_condtab
        where_clause    = gt_where_clauses
      exceptions
        empty_condtab   = 01
        no_db_field     = 02
        unknown_db      = 03
        wrong_condition = 04.
    select matnr from mara into table itab where (gt_where_clauses).

  • Checking conditions in SELECT statement

    Hi All,
    I am relative new to ABAP and I would like to ask a question about checking conditions in SELECT statement in the "WHERE" part.
    There are two checkboxes at the selection screen and each should disable one of  conditions (marked with two stars) in the SELECT mentioned below.
    My question is, whether there exists an option how to solve this problem without using solution like:
    IF checkobx1.
    SELECT (without one condition)
    ELSEIF checkbox2.
    SELECT(without other condition).
    ELSE.
    SELECT (with both conditions)
      SELECT  qprueflos qherkunft qaufnr qsa_aufnr qmatnr qwerkvorg
              qpastrterm  qpaendterm
              qverid qobjnr vobjnr AS objnr_fa vauart
        FROM qals AS q INNER JOIN vkaufk AS v
        ON qaufnr = vaufnr
        INTO CORRESPONDING FIELDS OF TABLE gt_qals
        WHERE q~prueflos IN s_pruefl
          AND q~stat35     EQ space
          AND q~werk       EQ loswk
          AND q~herkunft IN s_herk
          AND q~offennlzmk EQ 0
          AND q~offen_lzmk EQ 0
          AND q~pastrterm IN s_startt
          AND q~paendterm LE s_endt
          AND v~auart IN s_auart.    "('ZCPA', 'ZCPK', 'ZCBA').

    Hi,
    With this, I think u can directly read into WHERE clause
    IF checkbox1.
        v_where = '& BETWEEN ''&'' AND ''&'' '.
        REPLACE '&' WITH key_field INTO v_where.
        REPLACE '&' WITH field_LOW INTO v_where.
        REPLACE '&' WITH field_HIGH INTO v_where.
        CONDENSE v_where.
    ELSEIF  checkbox2.
        v_where = '& BETWEEN ''&'' AND ''&'' '.
        REPLACE '&' WITH key_field INTO v_where.
        REPLACE '&' WITH field_LOW INTO v_where.
        REPLACE '&' WITH field_HIGH INTO v_where.
        CONDENSE v_where.
    ENDIF.
    select * into corresponding fields of table ITAB
                 from (table_name)
                where (v_where).
    In this key_field is your fieldname in the where clause and field_low, field_high are range of values.
    If i write static query it looks like this
    RANGES: MATNR1 FOR MARA-MATNR.
      MATNR1-LOW = MATNR_LOW.
      MATNR1-HIGH = MATNR_HIGH.
      MATNR1-SIGN = 'I'.
      MATNR1-OPTION = 'BT'.
      APPEND MATNR1.
    select * into corresponding fields of table itab
    from mara where matnr BETWEEN 'M100' AND 'M200'.
    Hope it helps u
    thanks\
    Mahesh
    Edited by: Mahesh Reddy on Jan 30, 2009 11:23 AM

  • WHERE clause in SELECT statement

    hi experts..
    i want to give 'OR' condition in the 'where' clause of 'SELECT' statement.
    is it possible?
    for examlpe..
    IF EXIDV2 IS NOT INITIAL.
       SELECT * FROM YSDT_SHIPLOAD
                INTO TABLE IG_SHIPLOAD
                WHERE EXIDV2 = EXIDV2 AND
                             VHILM = PC1 OR PC2 OR PC3.
    ENDIF.
    i want that VHILM should be one of those three.
    how can i do this?
    thanks..

    Hi ,
    its possible,
    Select * from ysdt_shipload int table ig_shipload where exidv2 = exidv2
                                                                            AND vhilm = pc1
                                                                            OR     vhilm = pc2
                                                                             OR   vhilm = pc3.
    OR
    Select * from ysdt_shipload int table ig_shipload where exidv2 = exidv2
                        AND (vhilm = pc1 or vhilm = pc2 or vhilm = pc3).
    Regards
    Arani Bhaskar
    Edited by: arani bhaskar on Mar 16, 2009 5:14 PM

  • When I updated my phone to be able to get iCloud it restored my phone to factory settings and I've lost everything. Please help! Where did it all go and how do I get it back?

    When I updated my phone to be able to get iCloud it restored my phone to factory settings and I've lost everything. Please help! Where did it all go and how do I get it back?

    I have just done exactly the same thing! How frustrating!!!

  • Please Help !  Exception in closing resultset,statement.

    In an application developed on , i am closing the resultsets and statements in finally block as
    finally {
         if (resultset != null) resultset .close();
         if (statement != null) statement.close();
    the above block does not take care of exceptions that might arise while closing resultset/statement. Please help with this:
    what the conditions exceptions may arise in closing resultset/statements.
    when does the garbage collector free such resources and what are the implications of not catching exception while closing - can this cause database handle leaks.
    Please help!

    I don't know what exceptions might occur, but since the close() method can throw SQLException, your program has to catch it. Maybe if you close twice, the second time will throw an exception? Anyway, it doesn't really matter, you still have to write a try-catch around it. What you do there is up to you -- you could ignore it (which is what I do) or you could end the program with a message.
    When does the garbage collector free those resources? The garbage collector only frees memory. Nothing else. And the garbage collector will free a ResultSet object only when there are no references to it anywhere in your program. That doesn't mean just in code that you wrote, but anywhere in code that's running in your program. For example, the Statement object that produced the ResultSet might hold a reference to it. However, the API documentation for ResultSet does say that when the garbage collector does free a ResultSet object, it will automatically close it.
    However, the best practice is to close ResultSet and Statement objects when you are finished with them, and not rely on garbage collection to clean up after you.

  • How build where clause in select statement in FM for Virtual provider

    Hi
    I looking for example of FM for Virtual provider where I find code how assign to select statement "where" clause value from query variable.
    In following code how build t_r_custtype range and how assign value to it.
    CODE********************************
    TYPE-POOLS: abap.
    initialize
      CLEAR: e_t_data, e_t_msg.
    this is specific to infoprovider VIRTPROV
      CHECK i_infoprov = 'VIRTPROV'.
      FIELD-SYMBOLS: <l_s_sbook> TYPE sbook,
                     <l_s_data>  TYPE ANY.
      DATA: l_t_component TYPE abap_compdescr_tab,
            l_t_sbook     TYPE TABLE OF sbook.
    initialize
      CLEAR e_t_data.
    Data selection / only Business Customer
      SELECT * FROM sbook
        INTO CORRESPONDING FIELDS OF TABLE l_t_sbook
        WHERE custtype in t_r_custtype.
    ENDCODE********************************
    Thanks a lot
    Adam

    Hello,
    Would you like fill the ranges in Customer exit for BEx..? 
    If Yes. please refer the attachment for the whole code...
    "Sample code in Customer Exit in BEx"
    IF i_step = 2.
    CASE i_vnam.
    WHEN 'ZDAY_CX'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = '-1'
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT2
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZLSDAY.
    E_TT =
    E_ULTKZ =
    l_s_range-low = ZFIDAY .
    l_s_range-high = ZLSDAY .
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    **To get the From date (For Text Variable) as per the user input date interval range**
    WHEN 'ZR_S'.
    LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZDAY_IN'.
    CLEAR: l_s_range.
    ZT_DT1 = loc_var_range-low.
    ZT_DT2 = loc_var_range-HIGH.
    CALL FUNCTION 'DATE_CREATE'
    EXPORTING
    ANZAHL_JAHRE = 0
    ANZAHL_KALTAGE = 0
    ANZAHL_MONATE = 0
    ANZAHL_TAGE = 0
    DATUM_EIN = ZT_DT1
    DATUM_EIN_ULT = ' '
    ULTIMO_SETZEN = ' '
    IMPORTING
    DATUM_AUS = ZFIDAY .
    E_TT =
    E_ULTKZ =
    l_s_range-low0(2) = ZFIDAY6(2).
    l_s_range-low+2(1) = '.'.
    l_s_range-low3(2) = ZFIDAY4(2).
    l_s_range-low+5(1) ='.'.
    l_s_range-low6(4) = ZFIDAY0(4).
    l_s_range-sign = 'I'.
    l_s_range-opt = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDLOOP.
    *****************************************End*************************************
    Please let me know if any clarification required..
    Rinku..

  • URGENT: To change the where condition in select query at runtime ?

    Hi,
    I have to develop a report, 4 which I have created a selection screen with 7 Input Parameters whose value is to be filled by the user while executing the report.
    On the basis of this I do the desired selection of output.
    But the problem is that how do I write my select Query(where condition) if the user enetrs only 2 Input parameters or 3 or whatever he feels like.
    Pls help me out...

    hi,
    check this sample code.
    Here i am populating where condition at runtime.
    DATA: V_WHERE TYPE STRING.
    SELECTION-SCREEN BEGIN OF BLOCK INPUT WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_VBELN FOR VBAK-VBELN,
                     S_ERDAT FOR VBAK-ERDAT.
    SELECTION-SCREEN END OF BLOCK INPUT.
    START-OF-SELECTION.
      PERFORM POPULATE_WHERE.
      PERFORM GET_VBAK_DATA.
    *&      Form  POPULATE_WHERE
    *       Populate Where
    FORM POPULATE_WHERE .
      IF NOT S_ERDAT[] IS INITIAL.
        CONCATENATE 'VBELN IN S_VBELN'
                    'AND'
                    'ERDAT IN S_ERDAT'
              INTO V_WHERE
              SEPARATED BY SPACE.
      ELSE.
        V_WHERE = 'VBELN IN S_VBELN'.
      ENDIF.
    ENDFORM.                    " POPULATE_WHERE
    *&      Form  GET_VBAK_DATA
    *       GET VBAK DATA
    FORM GET_VBAK_DATA .
      SELECT VBELN
             ERDAT
             VBTYP
             NETWR
             WAERK
             VKORG
             VTWEG
             SPART
        INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
        FROM VBAK
        WHERE VBELN IN S_VBELN
        AND   ERDAT IN S_ERDAT.
       WHERE (V_WHERE).
    endform.
    Regards
    Sailaja.

  • [u][b]Performance Tuning Help[/b][/u] : Repeating HUGE Select Statement...

    I have a select statement that I am repeating 12 times with the only difference between them all being the date range that is grabbed. Essentially, I am grabbing the last 12 months of information from the same table here is a copy of one of the sections:
    (select
    a.account_id as account_id,
    a.company_id as company_id,
    a.account_number as acct_number,
    to_char(a.trx_date, 'YYYY/MM') as month,
    sum(a.amount_due_original) as amount
    from
    crystal.financial_vw a
    where
    a.cust_since_dt is not null
    and a.cust_end_dt is null
    and a.trx_date > add_months(sysdate, -13)
    and a.trx_date <= add_months(sysdate, -12)
         group by
              a.account_id,
              a.company_id,
              a.account_number,
              to_char(a.trx_date, 'YYYY/MM')) b
    I am now looking to do some tuning on this and was wondering if anyone has any suggestions. My initial thought was to use cursors or some sort of in memory storage to temporarily process the information into a pipe-delimited flat file.

    "Don't need:
    to_char(a.trx_date, 'YYYY/MM')"
    Are you sure?
    "Change to (just to make it easier to read):
    a.trx_date between add_months(sysdate, -13)
    and a.trx_date <= add_months(sysdate, -12)"
    What? That's not even valid syntax is it? Besides the fact that the BETWEEN operator is inclusive (i.e. > add_months(sysdate, -13) is not the same as between add_months(sysdate, -13) ...).
    "And be sure you have an index on:
    cust_since_dt, cust_end_dt, trx_date in financial_vw."
    What information did you base this conclusion on. Just because something is in the where clause doesn't mean you should automatically throw an index on it. What if 90% of the rows satisfy those null/not null criteria? What if there's only one year of data in this table? Are you certain an index would help pick out all the data for one month more efficiently than a full table scan?
    My immediate question was why are you breaking the data for each month up into separate subqueries like this at all? What is it that your doing with these subqueries that you don't believe can be accomplished with a single grouped query?

  • Please HELP: save workbook with initial selection variables

    Hey folks,
    I'm very frustrated.
    I'd like to save a workbook without results and without any historical values in popup selection screen, but I'm not able to do.
    Does anyone knows an answer?
    I tried a lot, but haven't got any idea anymore.
    PLEASE HELP.
    I'm using the new SAP-BI 7.0 FrontEnd BEx-Analyzer.
    Hope you can help as soon as possible.
    Thanks in advance.
    Nico

    hey ottoman,
    I didn't get the last tip.
    Edit the variable I'm using and goto default tab?
    The possible variables are shown if I refresh and they were shown in a popup, where I can select the parameters. But if I clear the the results and want to run, an error occured, because it's an obligatory variable.
    As an alternative I tried to cancel. After it my workbook is cleared, but my formats are blown away
    That's why I haven't got any solution to save the workbook with an initial selection popup.
    Hope you have another idea?
    Thanks.
    Nico

  • Use of LIKE in where clause of select statement for multiple records

    Hi Experts,
    I have a account number field which is uploaded from a file. Now this account numbers uploaded does not match fully with sap table account numbers but it contains all of the numbers provided in the file mostly in the upright positions.
    For example in file we have account number as 2ARS1 while in sap table the value is 002ARS1.
    And i want to fetch data from sap table based on account number uploaded. So, i am trying to use LIKE with for all entries but its not working as mentioned below but LIKE is not working with FOR ALL ENTRIES.
    data : begin of t_dda occurs 0,
            dda(19) type c,
           end of t_dda.
    data : begin of t_bukrs occurs 0,
            bukrs type t012k-bukrs,
           end of t_bukrs.
    data : dda type t012k-bankn,
           w_dda type t012k-bankn.
    CONCATENATE '%'
                             '2ARS1'
                     INTO  W_DDA.
    MOVE W_DDA TO T_DDA-DDA.
    APPEND T_DDA.
    CLEAR T_DDA.
    free t_bukrs.
    SELECT BUKRS
      FROM T012K
      into TABLE t_bukrs
        for all entries in t_dda
    WHERE BANKN like t_dda-dda.
    Can anybody suggest what should i use to get the data for multiple account numbers using one select statement only instead on using SELECT UP TO 1 ROWS in LOOP....ENDLOOP ?
    Thanks in advance,
    Akash

    Hi,
    yes, For All entries won't work for LIKE with '%  '.
    I think the other alternative is go for Native SQL by writing sub-query
    sample code is here:
    data: begin of i_mara occurs 0,
              matnr like mara-matnr,
              matkl like mara-matkl,
           end of i_mara.
    exec sql.
    select matnr, matkl from mara where matnr in (select matnr from marc) and matnr like '%ma' into :i_mara
    endexec.
    loop at i_mara.
    write:/ i_mara-matnr, i_mara-matkl.
    endloop.
    hope u got it.
    regards
    Mahesh
    Edited by: Mahesh Reddy on Jan 21, 2009 2:32 PM

  • Dynamic WHERE clause in SELECT statement

    Hi,
    I need to extract (SELECT) all the products in different salesorganizations. Since a product can be available in more than 1 salesorg I have created several properties in the PRODUCT dimension - 1 for each salesorganization (naming: Sxxxx where xxxx is the salesorganization number).
    Since I need to prefix the salesorganization property with an "S" I have created a property on the SALESORG dimension called SALESORG.
    Therefore I need to create a dynamic WHERE clause in the SELECT statement. Currently my script is:
    *SELECT(%SORG%, "[SALESORG]",SALESORG, [ID]=%SALESORG_SET%)
    *SELECT(%PROD%, "[ID]",PRODUCT, [%SORG%]="X")
    My first SELECT find the Sxxx (equal to the property I need in the PRODUCT dimension). My second SELECT uses the variable in the first SELCT statement to use the correct property for the WHERE clause.
    Unfortunately the code is not validated - any suggestions?
    /Lars

    Hi Lars,
    If you run it from a DM package without validating it, does it still work? I would bet it does.
    If this is the case I would open a message with SAP (it would be an enhancement request). Until they fix the validation code, you would just have to live with the script not validating.
    Cheers,
    Ethan

  • Please explain on what does these select statements get from these tables..

    Hello Experts,
    What does these select statements get?and what are these tables CDHDR and CDPOS used for?
    The program that I am currently modifying lets users post documents and the ones that are not posted
    are saved in a custom table. Now, we had a scenario in PROD server wherein certain items are not being
    fetched as bypassed but we saved it in the bypassed table. Anyway, below is the select statements:
    get all change document header within the selected dates
      SELECT * INTO CORRESPONDING FIELDS OF TABLE it_cdhdr
        FROM cdhdr
       WHERE udate IN s_udate
         AND objectclas EQ 'CHARGE'
         AND tcode IN (lc_tcode_msc1,
                       lc_tcode_msc2,
                       lc_tcode_msc1n,
                       lc_tcode_msc2n,
                       lv_tcode_vl33n,
                       'SE38',
                       'ZGENE').
    IF NOT it_cdhdr[] IS INITIAL.
    SELECT objectid changenr value_new
          FROM cdpos
          INTO TABLE it_cdpos
          FOR ALL ENTRIES IN it_cdhdr
         WHERE objectclas EQ it_cdhdr-objectclas
           AND objectid   = it_cdhdr-objectid
           AND changenr   = it_cdhdr-changenr
           AND tabname    = lc_tabname_mcha
           AND fname     IN (lc_fname_zustd,'LWEDT').
    DELETE it_cdpos WHERE value_new+00(01) = 'X'.
      LOOP AT it_cdpos ASSIGNING <fs_cdpos>.
        l_matnr = <fs_cdpos>-objectid+00(18).
        l_charg = <fs_cdpos>-objectid+22(10).
        l_zustd = <fs_cdpos>-value_new+00(01).
        READ TABLE it_batch INTO wa_batch
             WITH KEY matnr = l_matnr
                      charg = l_charg.
        IF sy-subrc EQ 0.
          l_tabix = sy-tabix.
          wa_batch-zustd = l_zustd.
          MODIFY it_batch FROM wa_batch INDEX l_tabix
                 TRANSPORTING zustd.
        ELSE.
          wa_batch-matnr = l_matnr.
          wa_batch-charg = l_charg.
          wa_batch-zustd = l_zustd.
          wa_batch-code  = 'A'.              "selected within period
          APPEND wa_batch TO it_batch.
        ENDIF.
      ENDLOOP.
      ENDIF.

    Hi,
                            The first select statement is for Change document header.CDHDR table contains this object class in your case if you change any batch number for any material number  from the transaction for example (MB01) you can trace this .
    From CDPOS you can trace which tables affected (EX : MCHA) and the new value(l_zustd ).
    Regds,
    Vinsa.R

  • Please help : Problem with setLong during SELECT

         try // do query
         String query = "SELECT * FROM Doc_Log WHERE EVENT_ID = ?";
         System.out.println("SELECT STATEMENT....:"+"\t"+query);
         long PUBLISH_ID = EVENT_ID;
         System.out.println("EVENT_ID to be used is:"+"\t"+PUBLISH_ID);
         pstmt1 = conn.prepareStatement(query);
         pstmt1.setLong(1,PUBLISH_ID);
         // pstmt1.setString(1,Long.toString(EVENT_ID));
    rs1 = pstmt1.executeQuery(query);
         System.out.println(rs1);
    RUNTIME ERROR.............................
    SELECT STATEMENT....: SELECT * FROM Doc_Log WHERE EVENT_ID = ?
    EVENT_ID to be used is: 4703996961324730781
    java.sql.SQLException: ORA-01008: not all variables bound
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1597)
    at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:79
    8)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
    a:1674)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
    nt.java:1870)
    at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
    538)
    at Doc_Pub.FailedEventReader(Doc_Pub.java:334)
    at Doc_Pub.main(Doc_Pub.java:241)
    BinaryReader: Error coming out of MyReader!
    Exception in thread "main" java.lang.NullPointerException
    at Doc_Pub.FailedEventReader(Doc_Pub.java:461)
    at Doc_Pub.main(Doc_Pub.java:241)

    Hi:
    Thanks for your quick response.
    EVENT_ID was captured as type Long through one of my Java Clients from a Broker. However EVENT_ID is defined as type NUMBER in the Oracle table. Because I did need to join couple of Oracle tables using the Long type as key.
    Therefore I decided to insert this Long type in the Oracle as a Number.
    EVENT_ID NOT NULL NUMBER(38)
    I parse the command line argument as below before I setLong in the SELECT query.
    EVENT_ID = Long.valueOf(ID).longValue();
    Thanks

  • Conditional Mysql select statement

    HI Folks
    can anyone point me in the right direction with a MySQL statement.
    I will try to layout my thinking here:
    I have a form with three inputs area, name and search. I am trying to write a Mysql select statement that selects records from a single table if they match the criteria. Easy for two variables but I'm lost after that.
    1. The form includes these three inputs:
    area - drop down menu (Any as default)
    name - drop down menu (Any as default)
    search box - text area (Blank as default)
    2. The form submits to itself leaving me with these three variables
    $search=$_GET['search']
    $area=$_GET['area']
    $name=$_GET['area']
    SELECT * FROM database WHERE database.description LIKE '%$search%' AND database.area LIKE '$area' AND database.name LIKE '$name'
    3. This is where I get confused. How do I get the SQL to Select everything correctly. I have tried using PHP if/else code to fix it but I end up running around in circles with six different Select statements and haven't yet got that to work.
    So I have come to the conclusion that there must be an easier way.  I see search forms with dozens of  search criteria on websites every day an d I only have 3 - so it can't be this complicated. Right?
    I know I need to start from the beginning again but can anyone let me know how to approach it before I begin?
    Cheers
    Dave

    Typically, I would build the where clause dynamically, based upon the values in your form. If the form field contains 'Any', leave it out of the where clause. So you can test each field value and either append or not to the end of the where clause.

Maybe you are looking for

  • Edited footage from AE not playing correctly in PPro CS4

    First- I'm a novice. I captured footage from a Canon GL2 (shot on the Auto settings) into Premiere Pro CS4 that was shot in front of a blue screen. In the timeline, I selected the blue screen footage (avi file), photo for backgroundn (jpg), and audio

  • Trying to make a php file work with my email form

    Hello, Going slightly mad trying to link my php file with my html and actually getting it to work. It (the php file) keeps coming up with a syntax error on line 37 - code hinting may not work etc etc but there is no error from what I can see - can an

  • How video encoder continunously

    Hello everyone! I have a ADSP BF533 EZ kit lite and labview embedded for blackfin 2.5 module. I would connect Analog video input(composite video) and capture video frame then display on the my car GPS navigation with A/V input by running Videoecho ex

  • Approval Required In QM Priorites

    Dear Sir In our scenario we requires approval on priority,i had created notification with high priority mentioned start dt 08.09.2008 and end date 10.09.2008 if it is not completed it should move for approval to higer login and created login id in di

  • ITunes account got hacked

    I just downloaded OS4 the other day on my iPhone, and after that saw this Game Center app on my home screen. After playing WoW for years you'd think I would remember about keyloggers, duh. But I read that Game Center was supported by Apple so I didn'