SELECT-OPTIONS in WHERE condition

Hi All,
SELECT-OPTIONS : S_TCODE FOR TSTCT-TCODE.
START-OF-SELECTION.
  SELECT * FROM TSTCT INTO TABLE IT_TSTCT
           WHERE TCODE = S_TCODE.
The same code results in SYNTAX ERROR in 4.7c.
In ECC 6.0, no such error resulted, but SUBRC is 4.
Why is it like this in ECC 6.0?
Regards,
R.Nagarajan.

hi,
You are right in ECC 6 this will not give any error as long as you are referencing to the work area of the Select-option, but will start giving error as soon as you refer to the table using the [] command beside the select-option the it will give you a syntax error in ECC 6.0 also.
The reason might be the unicode enabling started in ECC 6.0
Hope That Helps
Anirban M.

Similar Messages

  • Select-options with where condition

    Hello ABAPers,
    I want to create a select-options like s_operid for vbpa-kunnr but with a condition specified is VBPA-KUNNR where VBPA-PARVW = 'WE'.
    Thanks in advance. Pls reply asap. Points will definitely be rewarded.
    Ritu

    hi,
    use this
    PARAMETERS : TAB_ID TYPE ZALOAD_PROD_COMB-TAB_ID OBLIGATORY.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR TAB_ID.
    DATA : BEGIN OF INT_TAB_ID OCCURS 0,
                TAB_ID TYPE ZALOAD_PROD_COMB-TAB_ID,
             END OF INT_TAB_ID.
      DATA : LOC_MAX TYPE ZALOAD_PROD_COMB-TAB_ID.
      CLEAR INT_TAB_ID.
      REFRESH INT_TAB_ID.
      SELECT MAX( TAB_ID) INTO (LOC_MAX) FROM ZALOAD_PROD_COMB.
      COUNT = LOC_MAX + 1.
      DO 10 TIMES.
        MOVE COUNT TO INT_TAB_ID-TAB_ID.
        APPEND INT_TAB_ID.
        COUNT = COUNT + 1.
      ENDDO.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
         RETFIELD            = 'TAB_ID'                        u201C Internal table field name
         DYNPPROG         = 'PROG_NAME                  u201C Program name
         DYNPNR              = SY-DYNNR
         DYNPROFIELD   =  'TAB_ID'                        u201C Field where u need F4 help
         VALUE_ORG       = 'S'
       WINDOW_TITLE  = u2018Any descriptionu2019
        TABLES
          VALUE_TAB      = INT_TAB_ID.                   u201C Internal table name
    Mark the post answered once ur problem is solved ....

  • Limit size (in byte) of SELECT-OPTIONS in WHERE clauses

    hi,
    as far as I know there is a limit size (in byte) for SELECT-OPTIONS used in WHERE clauses. Is it true? What is the limit? If the SELECT-OPTIONS is based on lifnr (character type, 10 long) is the following calculation valid?
    sign - 1 byte
    option - 2 bytes
    low - 10 bytes
    high - 10 bytes
    23 bytes all together for one line, is this valid?
    thanks
    ec

    Hi,
    Check this link..
    https://forums.sdn.sap.com/click.jspa?searchID=6896082&messageID=2891787
    Regards,
    Omkar.

  • Select variable in where condition

    Hi Experts,
                   A field is stored in SAP, we want to add the same in where condition while selecting data thru IC. please guide.

    Hi, please clarify your question.
    Regards Mikhail

  • [PERSISTENCE CLASS] SELECT OPTION in WHERE statement

    Hi Gurus,
    I would like to know how could I code the WHERE statement with a SELECT OPTION, in Persistence Class ?
    Currenlty, I would like to code this kind of request :
              DELETE FROM      ziTab
                             WHERE   zdate IN so_date.      
    Do you know, how could I code it ?
    Many thx for helps.
    Best regards.
    Rachid.

    Sorry Glen,
    Unfortunately, I am trying to find the correct syntax to use a SELECT OPTION in a Query Request of Persistence Class:
    Something like that:
    SELECT-OPTIONS so_date     FOR    sy-datum                      .
    DATA lo_query_manager TYPE REF TO if_os_query_manager           .
    DATA lo_query         TYPE REF TO if_os_query                   .
    DATA lo_agent         TYPE REF TO zca_persistence_zint_rsbankinv.
    DATA lo_base          TYPE REF TO zcb_persistence_zint_rsbankinv.
    DATA lo_rsbankinv     TYPE REF TO zcl_persistence_zint_rsbankinv.
    DATA lo_table         TYPE        osreftab                      .
    DATA ls_table         TYPE REF TO zcl_persistence_zint_rsbankinv.
    DATA ls_tmp           TYPE REF TO object                        .
    DATA lv_string        TYPE        string                        .
    DATA lo_exception     TYPE REF TO cx_root                       .
    TRY .
       lo_agent    = zca_persistence_zint_rsbankinv=>agent.
    * Create Query
       lo_query_manager = cl_os_system=>get_query_manager( ).
       lo_query         = lo_query_manager->create_query( i_filter     = 'ZEXDAT IN PAR1' ).
       lo_table         =
       lo_agent->if_os_ca_persistency~get_persistent_by_query(
       i_query = lo_query
       i_par1  =  so_date
       LOOP AT lo_table INTO ls_tmp.
         ls_table ?= ls_tmp        .
         lv_string = ls_table->zget_all_fields( ).
         WRITE lv_string.
       ENDLOOP.
    CATCH cx_root INTO lo_exception.
       lv_string = lo_exception->get_text( ).
       WRITE lv_string.
    ENDTRY.
    But I have an error message :
    Syntax error when parsing a query : Excepected symbol 'IN' (row: O, column: 7)
    Any idea ?

  • Using Select option in Native SQL

    Hi,
    Can any one tell me, how to use select option value in native SQL.
    ie.,
    I want to use select option in where condition. Need to select all the records from table(non-SAP) where date in given range.
    Please suggest.
    Thanks,
    Amal

    Hi
    No!
    U need to find a way to convert a range of select-option to a range for Native SQL, probably it should be better doesn't use a select-option for the date but two parameters: one for date from and one for date to.
    Max

  • Select-Option and Dump

    Hi All,
    I have select-option on selection screen.
    Entered 7000 values to select-option.
    When executed it dumps, but small input values report is executed.
    Is their any limitation for input values in select-option.
    Moderator message: FAQ, please search for previous discussions of this topic.
    Edited by: Thomas Zloch on Sep 14, 2011 3:02 PM

    Hi,
    problem is not with select option, it can contain milions of entries.
    You are propably using select option in where condition of your select statement. You should keep limit about 1000-2000 entries, it depends on db system and memory.
    Regards
    Matus

  • Concatenation error - when i use text column value in where condition.

    Hi,
    i am creating Materialized view using few columns from two tables and as per requirement i need to prepare select statement with where condition in another column.(new column)
    i tried like below....
    create materialized view MAIN
    refresh force on demand
    as
    select
    a.table_name,
    a.column_name,
    b.trial_name,
    'select * from '||a.table_name||' where '||a.column_name|| ' = '|| b.trial_name||';' "QUERY"
    from
    exp_csv_tB a,
    exp_csv_tr b;
    a.table name value is : monitoring_table
    a.column_name value is : study
    b.trial_name = fty777
    Materialized view created with extra column but it is not added '' (codes) to text value in where condition.
    output which i got is :
    select * from monitoring_table where study = fty777;
    but
    i need output like
    select * from monitoring_table where study = 'fty777';
    fty777 value should be in codes like 'fty777'. i read some articles but didnt get this example.
    please help.

    Try this:
    CREATE MATERIALIZED VIEW main
    REFRESH FORCE ON DEMAND
    AS
    SELECT
    a.table_name,
    a.column_name,
    b.trial_name,
    'select * from '||a.table_name||' where '||a.column_name|| ' = '''|| b.trial_name||'';'' "QUERY"
    FROM
    exp_csv_tb a,
    exp_csv_tr b;
    You have to give double single codes for semi-colons ..
    Regards..

  • Default Values for Select-options In Webdynpro-ABAP

    Hi Freinds,
    Kindly,Help me in setting the Default values for the Select-options in Webdynpro ABAP.
    Here the Node and the Attributes are Created Dynamically, and then Displayed Select-options Component View.
    Regards,
    Xavier.P

    Xavier Reddy Penta sent me this question via email and I answered it directly yesterday. Here is the solution that I provided to him, so that it is stored with the original question:
    I believe your problem is that you are not setting the value into the range correctly.  You are setting it directly into the field symbol of the range like such:
    <FS> = L_STRING2.
    But ranges are deep objects. They have four fields: Sign, Option, High, and Low. This is from the online help:
    1.     sign of type c and length 1. The content of sign determines for every row whether the result of the condition formulated in the column is included or excluded in the entire resulting set for all rows. Evaluable values are "I" for include and "E" for exclude.
    2.     option of type c and length 2. option contains the selection option for the condition of the row in form of logical operators. Analyzable operators are "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP" if column high is initial, and "BT", "NB" if column high is not initial. With the options "CP" and "NP", the data type of the columns low and high must be of the data type c, and special rules apply for entries on the selection screen.
    3.     low of the data type defined after FOR. This column is designated for the comparison value or the lower interval limitation.
    4.     high of the data type defined after FOR. This column is designated for the upper interval limitation.
    So when you are moving the value into the field symbol you are setting it into the sign column.
    Here is an example of how you can access the components of the range:
    * create a range table that consists of this new data element
        lt_range_table =
          wd_this->lv_sel_handler->create_range_table(
               i_typename = l_typename ).
        IF l_fieldname = 'CARRID'.
          FIELD-SYMBOLS: <tab>         TYPE INDEX TABLE,
                             <struct>      TYPE ANY,
                             <wa>          TYPE ANY,
                             <option>      TYPE char2,
                             <sign>        TYPE char1,
                             <high>        TYPE ANY,
                             <low>         TYPE ANY,
                             <wa_values>   TYPE ANY.
          ASSIGN lt_range_table->* TO <tab>.
          APPEND INITIAL LINE TO <tab> ASSIGNING <wa>.
          ASSIGN COMPONENT 'OPTION' OF STRUCTURE <wa> TO <option>.
          ASSIGN COMPONENT 'HIGH' OF STRUCTURE <wa> TO <high>.
          ASSIGN COMPONENT 'LOW' OF STRUCTURE <wa> TO <low>.
          ASSIGN COMPONENT 'SIGN' OF STRUCTURE <wa> TO <sign>.
          <sign> = 'I'.
          <option> =  'EQ'.
          <low> = 'AA'.
        ENDIF.

  • MVC - Select-Options

    Hello All,
          I'm  creating an application with MVC model.Now I want a selection-screen page with select-options .
    but where to create these select-option fields and how to link them within my view ?
    Regards,
    Deepu.K

    Hi Deepu,
    I think, the best demo example for this/MVC is,Web log-BSP / HowTo: Exploring BSP Development with MVC-Craig Cmehil , Where you can get a lot of help.
    Pls check this at ;
    /people/sap.user72/blog/2005/03/29/bsp-howto-exploring-bsp-development-with-mvc
    Assign the points if info is useful**
    Also check these web logs.
    /people/ulli.hoffmann2/blog/2004/10/20/personalize-my-bsp-form-items
    /people/pankaj.kumar32/blog/2003/12/19/all-those-lids
    http://www.sapdevelopment.co.uk/webapps/bsp/mvchome.htm  - this is one of the best demo for sample apps.
    /people/sap.user72/blog/2005/05/05/bsphowto-filter-using-dropdown-in-tableview
    /people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators
    /people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
    Regards
    CSM Reddy
    Message was edited by: REDDY CSM

  • I want to design my database to get data with specified criteria. How do I do it without supplying common 'Where' condition?

    I have more than 100 tables and each table have 2 fields CompanyID And LocationNo.
    for example there is a table like Sales which is containing details about tax invoices. in this table invoice number can be duplicate with CompanyID and Location number. 
    CompID LocNo InvoiceNo
    1           1        1
    1           1        2
    1           2        1
    2           1        1
    1           1        3
    I want to get all invoice data where CompanyID is 1 and LocationNo also 1.
    I know i can do this with simple where condition Where CompanyID=1 AND LocationNo=1. but there are more than 100 tables which are containing same fields and also i want to get only those data where CompanyID=1 AND LocationNo=1. so i cannot put where condition
    everywhere in the whole project to get specified data only.
    Is there any whay to create any datasource or ODBC connection that will help me to get data from only specified criteria.
    More Information
    I want to do something like Tally ODBC Server which is creates temporary ODCB server to retrive data from the tally database. This server retrieves only those data which transaction date is selected in Tally Software.

    Thanks Satheesh for your reply.
    Your idea is good.But, CompanyID and LocationNo can be different on differnt place. So, i cannot fix it with 1 or any other value.
    if any way to pass both parameter into sql connection. So, when i execute only select query without where condition it will returns only specified data.
    If you have used Tally then you know it creates ODBC server for its custom database. We can retrieve data into excel using TallyODBC_9000 connection. 
    This connection retrieves only those data which transaction date is selected in tally software.
    I want to do something like this.

  • Where condition

    Hi all,
    My 2nd select query is not working.
    Plz tell where i m wrong.
    if itab_lfa1[] is not initial.
    if p_bukrs is  initial.
      select lifnr bukrs
      from lfb1
      into  corresponding fields of table i_lfb1
      for all entries in itab_lfa1
      where lifnr =  itab_lfa1-lifnr.
      else.
      select lifnr bukrs
        from lfb1
      into  corresponding fields of table i_lfb1
      for all entries in itab_lfa1
      where lifnr =  i_lfa1-lifnr
        and bukrs eq p_bukrs.
      endif.
      endif.
    Showing the error msg in 2nd select this:
    The WHERE condition does not refer to the FOR ALL ENTRIES table.           
    But when we remove for all entries in itab_lfa1,
    then it show no error, but doesn,t able to pick all records.
    Best Regards,
    Aastha.

    hi,
    Check out in this way  ..
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                      input = p_bukrs
              importing
                     output = p_bukrs.
    loop at itab_lfa1.
    call function 'CONVERSION_EXIT_ALPHA_INPUT'
              exporting
                      input = itab_lfa1-lifnr
              importing
                     output = itab_lfa1-lifnr.
      modify itab_lfa1 index sy-tabix.
    endloop.
    if not itab_lfa1[] is initial.
    select lifnr bukrs
    from lfb1
    into corresponding fields of table i_lfb1
    for all entries in itab_lfa1
    where lifnr = itab_lfa1-lifnr
    and bukrs = p_bukrs. " Assuming p_bukrs is declared as parameter
    endif.

  • Select query with optional where condition

    Hi,
    Can Anybody help me out in the following problem?
    I have the following query in a procedure.
    SELECT replace(shipper_name,'\',' ') as shipper,
    sum(teus / cntSailings) as teus
    FROM VW_CONTRIBUTION,
    VW_TOTAL_SAILINGS
    WHERE VW_CONTRIBUTION.dir = VW_TOTAL_SAILINGS.DIR
    AND VW_CONTRIBUTION.line = VW_TOTAL_SAILINGS.LINE
    AND VW_CONTRIBUTION.accounting_month = VW_TOTAL_SAILINGS.ACCOUNTING_MONTH
    AND VW_CONTRIBUTION.accounting_year = VW_TOTAL_SAILINGS.ACCOUNTING_YEAR
    AND VW_CONTRIBUTION.Principal = arg_principal
    AND VW_CONTRIBUTION.Dir = arg_direction
    AND VW_CONTRIBUTION.line in ( arg_service )
    AND VW_CONTRIBUTION.POL_country = arg_pol
    AND VW_CONTRIBUTION.POd_country = arg_pod
    AND VW_CONTRIBUTION.salesOffice = arg_SalesOffice
    AND VW_CONTRIBUTION.salesregion = arg_SalesRegion
    AND VW_CONTRIBUTION.cargo_type = arg_txtCargoType
    AND VW_CONTRIBUTION.eqgroup = arg_ContType
    AND VW_CONTRIBUTION.eq_size = arg_txtSize
    AND VW_CONTRIBUTION.acct_date between arg_from_date and arg_end_date
    GROUP BY shipper_name
    ORDER BY teus desc;
    Here some of the arguments are optional(Eg : VW_CONTRIBUTION.salesOffice, AND VW_CONTRIBUTION.eqgroup etc. ) and the values can be null. When they are null, I want them to be excluded from the where condition. Can anybody suggest me a solution for this?
    Thanks,
    Shalet.

    I guess i misunderstood your original question.
    The clause
    AND (VW_CONTRIBUTION.salesOffice = arg_SalesOffice OR VW_CONTRIBUTION.salesOffice IS NOT NULL)
    will cause the where clause to evaluate to FALSE anytime salesOffice IS NULL so the record will be excluded.
    I thought you were asking how to not compare the value if the field contained a NULL.
    Glad you found what you wanted.

  • Where condition with optional fields in select statement

    Hi,
    In a function module I have to fetch data based on 7 fields out of which 6 are optional.
    If we won't enter values for optional fields it will take default values as zeroes .
    So this is not fetching data. But for some fields some values has zero values.
    How to solve this condition?
    Regards,
    maha.

    Hi,
    For those import parameters for which its mentioned as optional, use like condition in the where clause of select statement in the function module.
    try like this,
    concatenate pfield2 '%' into pfield2.
    concatenate pfield3 '%' into pfield3.
    concatenate pfield4 '%' into pfield4.
    concatenate pfield5 '%' into pfield5.
    concatenate pfield6 '%' into pfield6.
    concatenate pfield7 '%' into pfield7.
    select *
    from db table
    into itab
    where field1 = pfield1 and
               field2  like pfield2 and
               field3  like pfield3 and
               field7 like pfield7.
    Now even if the optional fields are blank, data will be selected
    Regards,
    Vik

  • Dynamis where Condition using select-options

    Hi All,
    I am trying to form a dynamic where clause using values entered on a selection screen. I want that if a new entry is added in the selection screen the where clause can also be modified dynamically without any change in coding. The only change required should be addition of select-option statement in the selection screen declaration.
    Thanks in advance.
    Anju

    refer below example
    L_COND_SYNTAX = 'd2ext_status = l_status and d2ext_date ne c_intdate and '
    & 'd2~ext_uploaded = space'.
    SELECT D1TKNUM D1SHTYP D1TPLST D1ERNAM D1ERDAT D1BFART
    D1VSART D1ROUTE D1SIGNI D1EXTI1 D1~TPBEZ
    D1DATBG D1UATBG D1TDLNR D2VBELN D2~POSNR
    D2EXT_FAILED D2EXT_COUNT D2EXT_DATE D2EXT_TIME
    D2EXT_REP_DATE D2EXT_REP_TIME
    D2EXT_RES_DATE D2EXT_RES_TIME D2~EXT_ERR_TYPE
    INTO TABLE PA_GT_SHIP_HEADER
    FROM VTTK AS D1 INNER JOIN RIOZTM_DELSTAT AS D2
    ON D1TKNUM = D2TKNUM
    WHERE
    D1~TKNUM IN S_TKNUM AND
    D1~SHTYP IN S_SHTYP AND
    AND
    <b>(L_COND_SYNTAX).</b>
    Plz note the backet in L_COND_SYNTAX.
    Reward points if helpful

Maybe you are looking for

  • MAC Mini late 2014 Sleep Wake issue

    I just bought a MAC Mini late 2014 version with Yosemite pre-installed, and got a similar sleep wake problem. It's connected to an ASUS IPS 27" screen using HDMI interface. When the Mac goes to sleep after 15 min, or when I press the button to force

  • New blade for 4507

    Hi, I purchased a WS-X4248-RJ45V for a 4507R-E switch.  The sh ver and sh inventory output is below. Will this blade work in slot 6 of this device?  I believe from what I am seeing this is the only slot available. #sh ver Cisco IOS Software, Catalyst

  • How can i lock a cel so that you can't Change it

    How can i lock a cel so that you can't Change it (on iPad)

  • Delete function

    Once I open documents in Adobe Reader on my iPad and they are included in my document library, how do I delete them?

  • My computer fan has gone mental

    Hi guys I have a HP PAVILLION G6 NOTEBOOK running on windows 8.1 64bit. Literally a week after buying my computer the fan has gone absolutely mental. I have uninstalled software, cleaned, installed software to slow the fans but it sounds like a plane