"WHERE field IN select-options" alternative

I currently have a report that uses
SELECT-OPTIONS so_num FOR qmih-qmnum.
SELECT * FROM qmih INTO TABLE t_qmih
   WHERE qmnum IN so_num.
Now, this works fine unless the user selects a large number of individual items in the select options, e.g. 7,000 individual qmnums, in which case I get an ABAP error.
The dump contains the following helpful information:
How to correct the error                                                                               
The SAP Open SQL statement must be divided into several smaller units.
If the problem occurred due to the use of an excessively large table  
in an IN itab construct, you can use the addition FOR ALL ENTRIES     
instead.                                                              
When you use this addition, the statement is split into smaller units 
according to the restrictions of the database system used.                                                                               
You may able to find an interim solution to the problem               
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:                                    
Could anyone give me an idea of how I could fix this?

Hi Chandrasekhar,
very interesting statement but not necessarily correct.
Select-options declares a range-type internal table with header line. The number of table rows is limited by the system memory storage available.
Oracle database has a fixed limit of 32KB for the length of the select statement. The open SQL database interface will resolve the range table resulting in the right number of comparison expressions.
If the user puts too many values into select-options, he will probably copy single values which are represented by SIGN = 'I' and OPTION = 'EQ'.
Try this (example):
select-options:
  s_matnr for mara-matnr.
data:
  lt_value like hashed table of s_matnr-low with unique key table_line. "avoid duplicates
fiels-symbols:
  <any> type any,
  <value> type any.
loop at s_matnr assigning <any>
  where sign = 'I' and option = 'EQ'.
  assign component 'LOW' of structure <any> to <field>.
  insert <field> into table t_value.
  delete s_matnr.
endloop.
select ...
  into table ...
  from ...
  for all entries in lt_value
  where matnr = lt_value-table_line.
if lines( s_matnr ) > 0.
select ...
  appending table ...
  from ...
  where matnr in s_matnr.
endif.
Now you've got them all.
Regards,
Clemens

Similar Messages

  • Innput field with Select option on custom screen

    Hi,
    I need to create an Input field with Select Option(No interval) button on Custom dialog screen .
    Is there any idea how can I create it on screen ?
    Thanks
    Sachin

    create a normal inputfield and place an icon next to it. then in the pai on click of that button use the following code.
    data: wf_tab_field like rstabfield occurs 0 with header line ,
          wf_exl_opt like rsoptions .
    refresh: wf_tab_field  .
        move: 'KOSTL' to wf_tab_field-fieldname ,
              'CSKS' to wf_tab_field-tablename .
        append wf_tab_field .
        clear wf_tab_field .
        move: 'X' to wf_exl_opt-bt ,
              'X' to wf_exl_opt-cp ,
              'X' to wf_exl_opt-ge ,
              'X' to wf_exl_opt-gt ,
              'X' to wf_exl_opt-le ,
              'X' to wf_exl_opt-lt ,
              'X' to wf_exl_opt-nb ,
              'X' to wf_exl_opt-np .
    call function 'COMPLEX_SELECTIONS_DIALOG'
         exporting
           title                   = 'Select Cost Centers'
           text                    = 'Cost Center'
    *         SIGNED                  = 'X'
    *         LOWER_CASE              = ' '
    *         NO_INTERVAL_CHECK       = ' '
    *         JUST_DISPLAY            = ' '
    *         JUST_INCL               = ' '
            excluded_options        = wf_exl_opt
    *         DESCRIPTION             =
            help_field              = 'CSKS-KOSTL'
    *          SEARCH_HELP             = 'KOST'
            tab_and_field           = wf_tab_field
          tables
            range                   = r_kostl
         exceptions
           no_range_tab            = 1
           cancelled               = 2
           internal_error          = 3
           invalid_fieldname       = 4
           others                  = 5
        if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        endif.
        if not r_kostl[] is initial .
          read table r_kostl index 1 .
          if sy-subrc eq 0 .
            move: r_kostl-low to wf_t_kostl .
          endif .
        endif .
    wf_t_kostl  is the screen field name.
    Raja

  • F4 help for PO number field with SELECT OPTIONS

    Hi all,
    I have a field (PO no) using SELECT OPTIONS on my selection screen.I need F4 help for this field.How shud i declare it?
    I have declared it as follows:
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    select-options sel_po for ZPO_LOI-zobject_id obligatory .
    SELECTION-SCREEN END OF BLOCK b1.
    ZPO_LOI is a table view with a z data element ZOBJECT_ID to which i have attached a search help which displays the required values for the PO field in the selection screen.But now the problem is i cant see the F4 icon for the field on the sel screen.
    Please help.

    Hi I have a sapmle code for this.
    *&                AT SELECTION SCREEN ON VALUE REQUEST
    *-- F4 help for IDOC numbers
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_docnum-low.
      PERFORM value_request_status USING 'S_DOCNUM-LOW'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_docnum-high.
      PERFORM value_request_status USING 'S_DOCNUM-HIGH'.
    *&      Form  value_request_status
          text
         -->fp_field  dynpro field that gets the return value
    FORM value_request_status  USING fp_field TYPE dynfnam.
      STATICS tl_values TYPE STANDARD TABLE OF tp_value.
      IF tl_values IS INITIAL.
         SELECT docnum FROM edidc UP TO 500 ROWS INTO TABLE tl_values
              WHERE credat   IN  s_credat
              AND   cretim   IN  s_cretim.
         IF sy-subrc eq 0.
            CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
             EXPORTING
              retfield        = 'DOCNUM'
              dynpprog        = syst-repid
              dynpnr          = syst-dynnr
              dynprofield     = fp_field
              value_org       = 'S'
             TABLES
              value_tab       = tl_values
             EXCEPTIONS
              parameter_error = 1
              no_values_found = 2
             OTHERS          = 3.
             IF sy-subrc IS NOT INITIAL.
               MESSAGE i999(zz) WITH 'No values found'(004).
             ENDIF.
          ENDIF.
        ENDIF.
    ENDFORM.                    " value_request_status
    Regards,
    Amit.

  • Search help for A field in select option which doesnt have search help in c

    u have table in QM which is QMFE in whihc field FECOD which doesnt have search help , but my requirement is that in select option in report to have users to see its search help, anyone there to help me

    Hi sridhar loganathan,
    For this goto SE11 and create a ZFECOD Search help for that field. In Defination Tab enter table name
    QMFE and Enter Z_F4_FECOD_EXIT in Search help Exit.
    Then create a FM in SE37 as Z_F4_FECOD_EXIT under a FG. And then write code as follows for example: 
    FUNCTION Z_F4_REG_EXIT.
    ""Local Interface:
    *"  TABLES
    *"      SHLP_TAB TYPE  SHLP_DESCR_TAB_T
    *"      RECORD_TAB STRUCTURE  SEAHLPRES
    *"  CHANGING
    *"     VALUE(SHLP) TYPE  SHLP_DESCR_T
    *"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
      TYPES: begin of ty_code,
              dam_code type  QMFE-FECOD ,
            end of ty_code.
      DATA : tw_code type ty_code,
             ta_code type table of ty_code.
       IF  "callcontrol-step <> 'SELONE' AND
            callcontrol-step <> 'SELECT' AND
            callcontrol-step <> 'DISP'.
          EXIT.
        ENDIF.
       IF callcontrol-step = 'SELECT'.
          CALL FUNCTION 'F4UT_PARAMETER_ALLOCATE'
            EXPORTING
                 PARAMETER         = 'FECOD'
            TABLES
                 SHLP_TAB          = shlp_tab
                 RECORD_TAB        = record_tab
            CHANGING
                 SHLP              = shlp
                 CALLCONTROL       = callcontrol
            EXCEPTIONS
                 OTHERS            = 3.
       ENDIF.
       IF callcontrol-step = 'DISP'.
    Get the Region
          CALL FUNCTION 'F4UT_PARAMETER_VALUE_GET'
             EXPORTING
                  PARAMETER         = 'FECOD'
                  FIELDNAME         = 'FECOD'
             TABLES
                  SHLP_TAB          = shlp_tab
                  RECORD_TAB        = record_tab
                  RESULTS_TAB       = ta_code
             CHANGING
                  SHLP              = shlp
                  CALLCONTROL       = callcontrol
             EXCEPTIONS
                  PARAMETER_UNKNOWN = 1
                  OTHERS            = 2.
           IF SY-SUBRC = 0.
              SORT TA_CODE BY DAM_CODE.
    Deleting duplicate damage codes in Internal Table ta_code
              DELETE ADJACENT DUPLICATES FROM TA_CODE COMPARING DAM_CODE.
    Passing changed Internal table to FM
              CALL FUNCTION 'F4UT_PARAMETER_RESULTS_PUT'
              EXPORTING
                 PARAMETER         = 'REGION'
                 FIELDNAME         = 'REGION'
              TABLES
                 SHLP_TAB          = shlp_tab
                 RECORD_TAB        = record_tab
                 SOURCE_TAB        = ta_code
              CHANGING
                 SHLP              = shlp
                 CALLCONTROL       = callcontrol
              EXCEPTIONS
                 PARAMETER_UNKNOWN = 1
                 OTHERS            = 2.
           ENDIF.
       ENDIF.
    ENDFUNCTION.
    Revert me for any clarifications.
    Regards,
    Suneel G.

  • Generating HANA where clause for select options having CP as the operator

    Hi All
    I am trying to generate where clause in HANA sql from the select options range table .
    I tried using the function modules  RSDS_RANGE_TO_WHERE and  RH_DYNAMIC_WHERE_BUILD .
    They are working for most of the cases . But  , when the range table has entries like
    Fieldname   sign opt  low high
    VBELN        I/E    CP  *4*
    Both of them fail to generate the right result .
    Could you suggest any other function modules , which take care of all such cases like include single values , exclude single values , incluse and excluse ranges , patterns etc .
    Thanks and Best Regards
    Varsha

    Hi Karthik,
    this is the api, I have done,
    create or replace
    FUNCTION get_where_clause_for_emp_req (
       emp_id       IN   NUMBER,
       salary            IN   NUMBER,
       job         IN   VARCHAR2,
       dept IN NUMBER
       RETURN VARCHAR2
    IS
       l_where_clause   VARCHAR2 (2000);
    BEGIN
       IF (    (emp_id IS NULL)
           AND (salary IS NULL)
           AND (job IS NULL)
           AND (deptIS NULL)
       THEN
          RETURN NULL;
       ELSE
          l_where_clause := 'WHERE ';
       END IF;
       IF (emp_id IS NOT NULL)
       THEN
          l_where_clause :=
                        l_where_clause || ' emp_id =' || emp_id || '';
       END IF;
       IF ((emp_id IS NOT NULL) AND (salary IS NOT NULL))
       THEN
          l_where_clause :=
                          l_where_clause || ' AND salary= ' || salary;
       ELSIF (salary IS NOT NULL)
       THEN
          l_where_clause := l_where_clause || ' salary= ' || salary;
       END IF;
       IF (((salary IS NOT NULL) AND (dept IS NOT NULL)) OR ((emp_id IS NOT NULL) AND (salary IS NULL) AND (dept IS NOT NULL)))
       THEN
          l_where_clause := l_where_clause || ' AND dept= ' || dept;
       ELSIF (status_i IS NOT NULL)
       THEN
          l_where_clause := l_where_clause || ' dept= ' || dept;
       END IF;
    l_where_clause := l_where_clause || ' ;';
       RETURN l_where_clause;
    END;I have done for three parameters, i need to include two more input parameters for this function, so I see going forward my testing cases will increases,
    so am looking for the best solution
    Thanks
    Edited by: NSK2KSN on Jul 7, 2010 3:11 PM

  • Finding a field in select options

    I am using select options WD component in my WD component. I have added some fields in the select options component using add_selection_field method.
    Is there any method using which I can check if i give an id of a particular field, the method should return if the field with that id already exists or not.
    Thanks,
    Reena

    Hi Reena,
    just go thru this thread, you may goet some useful infm regarding your query. I m noty sure but just go thru it once
    WD ABAP - Search help using Selection-options
    thnks

  • 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

  • Where is auto-select option in options bar?

    where is the option-select option in Options bar

    With the Move Tool selected, it's called Auto-Select Layer in photoshop elements 10.

  • Controlling the space between label and Input field in SELECT-OPTION

    Hi ,
    I am using WDR_SELECT_OPTIONS as a used component in order to dynamically generate the Select option in my WD Component.
    Can any one tell me if there is a way to control the spacing between Label and Input field?  This is because rest of the UI elements are in one particular order but for this dynamically generated UI.
    Please help me.
    Thanks,
    Kavitha

    Hi Kavitha,
    The label is required for accessibility reasons. It's not possible to remove it and to use your own label from outside the component to point to it. Labels cannot point to targets across views (and hence acress component) boundaries.
    Best regards,
    Thomas

  • Making to-field in select-option mandatory

    hi experts
    I defined an OBLIGATORY select-option with no-extension option. but the user wants not only the "from" field is OBLIGATORY but also the "to" filed.
    I know I can do it if I define 2 parameters in the same line. but is there any other option if using select-option
    many thanks
    Edited by: Thomas Zloch on Nov 4, 2010 9:54 AM - subject changed

    Use the FM [SELECT_OPTIONS_RESTRICT|http://www.sdn.sap.com/irj/scn/advancedsearch?query=select_options_restrict#sdn_content_category_value_wiki] in  the initialization of the report, and only allow "I/BT" records types.
    FORM restrict_select.
    * Local data
      DATA: restrict TYPE sscr_restrict,
            opt_list TYPE sscr_opt_list,
            *** TYPE sscr_***.
    * Create Options
    * - Option ALL : any selection allowed
      CLEAR opt_list.
      MOVE 'ALL' TO opt_list-name.
      MOVE 'X' TO: opt_list-options-bt,
                   opt_list-options-cp,
                   opt_list-options-eq,
                   opt_list-options-ge,
                   opt_list-options-gt,
                   opt_list-options-le,
                   opt_list-options-lt,
                   opt_list-options-nb,
                   opt_list-options-ne,
                   opt_list-options-np.
      APPEND opt_list TO restrict-opt_list_tab.
    * - Option RNG only ranges of values
      CLEAR opt_list.
      MOVE 'RNG' TO opt_list-name.
      MOVE 'X' TO: opt_list-options-bt.
      APPEND opt_list TO restrict-opt_list_tab.
    * Affect Options to actual select-options
    * - ALL by default
      CLEAR ***.
      MOVE: 'A'          TO ***-kind,
            '*'          TO ***-sg_main,
            'ALL'        TO ***-op_main.
      APPEND *** TO restrict-***_tab.
    * RNG to a single select-option
      CLEAR ***.
      MOVE: 'S'          TO ***-kind,
            'SO_FIELD'   TO ***-name,
            'I'          TO ***-sg_main,
            'RNG'        TO ***-op_main.
      APPEND *** TO restrict-***_tab.
    * Execute
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
           EXPORTING
                restriction = restrict
           EXCEPTIONS
                OTHERS      = 0.
    ENDFORM.                    " restrict_select
    Regards,
    Raymond

  • Hide Selection Field in Select-Option

    Hi,
    Is there any way to hide a selection field (not to delete and not to set as read only) in select-option component?
    Aviad

    Hi,
    I have several fields on the select-option view.
    One of those fields has a search help attached to it.
    The search-help needs additional data in order to filter unwanted results.
    If I add two more fields to the select-option view and bind them using the search-help structure (in all three fields) I can see only the desired results.
    The user, on the other hand, dos not need to see the additional fields, so I wish to hide them.
    Aviad

  • Include a field in selection options

    Hi,
    In my selection screen i want an output like this...
    a   _______ to ________
    b   _______ to ________
    c   ____________
    a and b will have a low and high but c needs to be just an input box.
    how to define this ??
    selection-screen begin of screen 0100 as subscreen.
    selection-screen begin of block b4.
    select-options: a for MARA-MATNR
    how to define c ???
    selection-screen end of block b4.

    Actually the syntax would be like so.  You can also add the NO- EXTENSION to the end to get rid of the "Multiple Selection" box.
    select-options: c for sy-datum no intervals no-EXTENSION.
    Regards,
    Rich Heilman

  • How would i go about making this?(menu where i can select options)

    http://i195.photobucket.com/albums/z100/micro5797/Kommitted/webpage.jpg
    I look at a lot of web pages looking for things that i would like to impliment into my web site. I came across this.
    I want to be able to have an expandable menu where i can choose different options.
    I don't know what this would even be called. That would be a good start, just knowing what it is called so that i can search further for it.
    Is it a type of a spry menu bar?
    Is this a widget of sorts?
    If anyone knows of a tutorial of how to do this, would you pleas post a link? Thanks.

    Thank you all for your helps and comments. It will take me a while to get through all of this information as i
    am learning it as i go. I will at a later date add the stars and check the answered question.
    @Brad Lawryk
    Even though the tutorial link that i posted is too simple for what i am trying to do. I am going through it via DW just to learn. I am starting to see what you are talking about in your posts. Thanks.
    @Nancy O.
    I was hesitant on posting a link to someone elses website as i am not trying to rip off/copy some one else, but make something similar, with my own ideas.
    http://www.digitalstormonline.com/comploadsaved.asp?id=430998

  • Comparing field with select-option

    HI
    i have one slect option
    s_bukrs for coas-bukrs.
    and
    loop..
    if w_bukrs eq s_bukrs"here is the problem,w_bukrs is
       "holding single value and s_bukrs a range,so in such
       "case how i can do comaprison
    endif.
    endloop

    Hi Sanju,
    Just use IN as said..
      if w_bukrs <b>IN</b> s_bukrs
    in case you want to compare a single value use..
    if w_bukrs <b>EQ</b> s_bukrs-low or
    if w_bukrs <b>EQ</b> s_bukrs-high
    regards
    satesh

  • Providing input  in one field should activate the req select -options field

    in mpool-pgming ,say i have 10 selct options in the selction screen of an application
    but first only one input field(one select-option) should be active i.e should be displayed
    and all should be inactive(invisible),on providing input inthat the remaining select options
    should get displayed,for this how to write code and in which event? is it PBO or PAI?
    please provide me the coding ,am in desperate need.

    Hi Kudala,
    You have to give a loop
      loop at screen.
        if screen-group2 eq value1
          screen-active    = 1.
         screen-invisible = 0.
        elseif screen-group2 eq value2.
          screen-active    = 0.
          screen-invisible = 1.
        endif.
        modify screen.
      endloop.
    where value1 and value2 are the ids you have defined for the text field in the layout editor.
    reward points if it helps

Maybe you are looking for