[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 ?

Similar Messages

  • Select options and loop statement

    Dear forum,
    I have the scenario where i need to restrict the loop from the select-options.
    in the select-options, user enter currency.
    then in the loop i need to loop base on the currency user enter.
    may i know what steps should i use for the loop as loop cannot support where.
    thanks

    HI Gengis
    I have the scenario where i need to restrict the loop from the select-options.
    in the select-options, user enter currency.
    then in the loop i need to loop base on the currency user enter.
    may i know what steps should i use for the loop as loop cannot support where.
    as per your requirement.
    you have some data in your internal table also you have a select-options to input values.
    on the basis of the values in your select option you want to fetch the values from your internal table. right???
    then there should be a field like your select option in your internal table.
    select-option: s_matnr for mara-matnr.
    let assume you have an internal table with matnr and other fields also and your select-options is for mara-matnr.
    then you need to select the values in your internal table according to the values in your select-options like below.
    SELECT MATNR field1 field2........ from dbtable into table itab where matnr = s_matnr.
    the above code will give you the values matching the values in your select-options.
    you need not to apply loop becasue you already have only those values for which yo u have found records in the DBTABLE.
    in case you want to apply loop on an internal table on the basis of s_matnr's values, then you can write.
    in this scenario you need to define 2 internal table one with already fethced values and another in which we will fetch the values according to select-options.
    loop at itab into wa_itab.
    read table itab1 into wa_itab1 where matnr = wa_itab-matnr.
    write statement........
    endloop.
    before that youwill have to fetch values in itab according to s_matnr.
    I hope this will clear your query.
    Thanks
    Lalit Gupta.

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

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

  • 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

  • CHECK SELECT-OPTIONS not allowed in ECC6.0

    HI,
    Obsolete Statement 4.7 version and Ecc 6.0 Version,
    CHECK SELECT-OPTIONS not allowed
    The construct SELECT-OPTIONS in the statement CHECK is not allowed in ABAP Objects.
    Error message in ABAP Objects if the following syntax is used:
    CHECK SELECT-OPTIONS.
    Correct syntax:
    CHECK f IN seltab.
    Reason:
    This form of the statement CHECK is intended only for use during the event GET during execution of type-1-programs with logical databases. The statement checks whether the content of the work area, which was filled by the logical database for the current GET event, meets the conditions in all the selection tables that are connected with the database table read. The name of the database table is taken statically from the next higher GET statement in the ABAP program. Thus the statement does not make sense outside of an GET event block. However, the previous event concept of the ABAP runtime environment, that is, the previous way of processing logical databases, is not supported by ABAP Objects.
    I want the simple example program for Correct syntax .Can any one send me with example program and pinpoint information of the statement.
    Regards,
    venkat
    Moderator message: please search for available information.
    Edited by: Thomas Zloch on Jan 8, 2011 10:32 AM

    Hey i have the same issue with this FM
    Did u find any solution to this..?
    plz help me ... urgent..!!

  • 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

  • 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

  • Passing select-options to class methods

    Hi,
    I want to pass a select-option filled in the selection screen by the user to a method of my class. Since select-options are hold as an internal table with fields sign option low high, and passing internal tables to methods require typing, what should I write as the name of this internal table type?
    For example;
    select-options: so_carid for spfli-carrid.
    I want to pass the contents of so_carid to my method defined in a class

    hI
    Triggering and Handling events
    At the moment of implementation, a class defines its:
             Instance events (using the EVENTS statement)
            Static events (using the CLASS-EVENTS statement)
    Classes or their instances that receive a message when an event is triggered at runtime and want to react to this event define event handler methods. Statement: METHODS
    CLASS IC1_VEICHLE DEFINATION.
    PUBLIC SECTION.
    METHOD CONSTRUCTOR IMPORTING
    EVENTS VEICHEL_CREATION.
    ENDCLASS
    CLASS LC1_VEICHLE IMPLIMENTATION.
    METHOD CONSTRUCTOR
    RAISE EVENT VEICHLE_CREATION.
    REWARD IF USEFULL

  • Issue with Select options in select statement - ABAP Question

    Hi
    I am facing an issue with select options. Select statement is returning sy-subrc as 4.
    I wrote the program as below:
    SELECT-OPTIONS:
    s_kunnr FOR bsad-kunnr,
    s_lifnr FOR bsak-lifnr,
    s_gjahr FOR bsad-gjahr,
    s_bukrs FOR bsad-bukrs,
    s_saknr FOR bsad-saknr,
    s_budat FOR bsak-budat.
    In start of selection I have written the select statement as
    SELECT * FROM bsak INTO TABLE lt_bsak
    WHERE bukrs IN s_bukrs AND lifnr = s_lifnr AND gjahr IN s_gjahr AND budat IN s_budat AND saknr IN s_saknr.
    In selection screen I have not entered any values and executed the program. I am not getting any result. When I debug that, sy-subrc is 4 at above select statement. But table has records.
    If am removing the "lifnr = s_lifnr " condition in select then select is returning values.
    I am not getting where I made the mistake. Please suggest.
    Thank you
    Hanu

    Hi,
    The problem here with where condition select option lifnr = s_lifnr.
    Use below select query.
    SELECT * FROM bsak INTO TABLE lt_bsak
    WHERE bukrs IN s_bukrs
        AND lifnr     IN s_lifnr
        AND gjahr   IN s_gjahr
        AND budat  IN s_budat
        AND saknr  IN s_saknr.
    s_lifnr is a select option and you are passing it as parameter lifnr = s_lifnr.
    if you want to pass this s_lifnr as single vale then pass in below mentioned way.
    lifnr = s_lifnr-low
    BR,
    Vijay

  • Problem in passing select-options to class meathods , type any table

    <h1>how to pass type any table to class meathod</h1>
    <h3>hi all
           i'm trying to build class to validate the selection screen , like select-options and parameters
           while writing meathod to validate the select-options
           its throwing parameter mismath error</h3>
    <h4>i tried like made import parameter in class meathod as 'TYPE ANY TABLE' and tried to pass select-options from my program it is saying type mismatch , how to overcome this problem </h4>
    <h4>and i want to pass any select option , either of type lfa1-lifnr or mara-matnr or any other</h4>
    Moderator message : Don't shout, use proper font size for explaining the question. This has been discussed in ABAP forums before. Search for available information. Thread locked.
    Edited by: Vinod Kumar on Sep 14, 2011 11:20 AM

    hI
    Triggering and Handling events
    At the moment of implementation, a class defines its:
             Instance events (using the EVENTS statement)
            Static events (using the CLASS-EVENTS statement)
    Classes or their instances that receive a message when an event is triggered at runtime and want to react to this event define event handler methods. Statement: METHODS
    CLASS IC1_VEICHLE DEFINATION.
    PUBLIC SECTION.
    METHOD CONSTRUCTOR IMPORTING
    EVENTS VEICHEL_CREATION.
    ENDCLASS
    CLASS LC1_VEICHLE IMPLIMENTATION.
    METHOD CONSTRUCTOR
    RAISE EVENT VEICHLE_CREATION.
    REWARD IF USEFULL

  • SELECT OPTIONS use in select statement

    hi,
    I have defined my selection screen in the main program.
    selection-screen begin of screen 0101 as subscreen.
    selection-screen begin of block b1.
    select-options:  S_KUNNR for  KNA1-KUNNR,
    selection-screen end of block b1.
    selection-screen end of screen 0101.
    then in an include in the same module pool, i try to use this in select statement
    SELECT * INTO CORRESPONDING FIELDS OF XXX FROM ZPPP WHERE KUNNR IN S_KUNNR.
    I get  an error saying " the IN operator with S_KUNNR is neither followed by an internal table nor by a valuelist "..what does this mean ?
    thks

    Check the sample code...
    REPORT  ztest_mod.
    DATA: kunnr TYPE kunnr.
    * Custom Selection Screen 0200
    SELECTION-SCREEN BEGIN OF SCREEN 0200 AS SUBSCREEN.
    SELECT-OPTIONS: s_kunnr FOR  kunnr.
    SELECTION-SCREEN END OF SCREEN 0200.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_kunnr-low.
      BREAK-POINT.
    START-OF-SELECTION.
      "in this screen i have a button with function code 'SEARCH'
    " and a subscreen area with name sub
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS'.
    ENDMODULE.                    "status_0100 OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    MODULE user_command_0100 INPUT.
      DATA: it_kunnr TYPE TABLE OF kna1.
      CASE sy-ucomm.
        WHEN 'SEARCH'.
          SELECT * FROM kna1
          INTO TABLE it_kunnr
          WHERE kunnr IN s_kunnr.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                    "user_command_0100 INPUT
    in the flow logic..
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
      CALL SUBSCREEN sub INCLUDING sy-repid '0200'.
    PROCESS AFTER INPUT.
      MODULE user_command_0100.
    Regards
    Vijay Babu Dudla

  • Why we use Tables statement in case of using SELECT-OPTIONS:

    hi all,
    Why we use Tables statement in case of using the following coding in an ABAP program ...
    tables: vbak.
    SELECT-OPTIONS: s1 for vbak-vbeln.
    here if we dont provide the tables statement why it does not work ????
    pls answwer ....???

    Hi
    This statement is not allowed in classes and declares a data object table_wa as a table work area whose data type is adopted from the identically named structured data type table_wa from the ABAP Dictionary. table_wa must be defined as a flat structure in the ABAP Dictionary. You can specify database tables or Views for table_wa.
    Work table areas declared with TABLES are interface work areas and should only be declared in the global declaration section of a program for the following purpose:
    reward if usefull
    The statement TABLES is required for exchanging data between screen fields that were defined in a program screen when transferring from the ABAP Dictionary and the ABAP program. For the screen event PBO, the content of the table work area is transferred to identically named screen fields; for PAI, the system adopts the data from identically named screen fields.
    In executable programs, flat table work areas can be used for adopting data that were provided for the event GET table_wa from a linked logical database. TABLES is synonymous with the statement NODES for this purpose.
    Work table areas declared with TABLES behave like the data declared with the addition COMMON PART, meaning the data are used by the programs of a program group.
    Table work areas declared with TABLES can be declared in subroutines and
    function modules. However, this is not recommended. A table work area declared in a procedure is not local but belongs to the context of a framework program. The table work area can be viewed starting from the declaration in the framework program and lives as long as the framework program. In contrast to normal program-global data, the content of the table work areas declared in subroutines and function modules is stored temporarily when these subroutines and function modules are called. Value assignments that were made during runtime of the procedure are preserved until the procedure is completed. When exiting the procedure, the table work areas are filled with the contents that they contained when the procedure was called. Table work areas declared in procedures behave like global data to which the statement LOCAL is applied in the procedure.
    The form TABLES * is obsolete.

  • Select statement for generic select options

    Hello,
    I have a problem implementing a SELECT-Statement. I have a generic number of select options on my selection screen and I have a range table for each select option. How can a generate a database select for these generic number of range tables?
    Thank you very much in advance & regards,
    Alexander

    the answer I gave you will work if you have a ranges table for every possible select-options and refer to every ranges table in your where clause.... that way, you don't have to know which are populated and which are not at the time of SELECT.
    You could also choose to create a dynamic where clause, based upon what you had select-options for and use with
    WHERE ( whereclause ).
    Edited by: BreakPoint on Mar 2, 2011 4:31 PM

Maybe you are looking for