Creating select-options dynamically

Hello Gurus,
I have following program with me.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = itab_display
IMPORTING
ep_table = d_ref.
ASSIGN d_ref->* TO <F_FS>.
SELECT * FROM (table) INTO CORRESPONDING FIELDS OF TABLE <F_FS>.
I want to select from table dynamically. i.e.
I want my select query as :
*SELECT * FROM (table) INTO CORRESPONDING FIELDS OF TABLE <F_FS> where field1 = ' x' and field2 = 'y' etc ....*
" field1 , field2 " ....i should be able to give using select-options.
Please tell me is it possible ?
Thanks.

Hi,
Check the Following code
DATA  tabname(10).
DATA: BEGIN OF wa,
        id   TYPE scustom-id,
        name TYPE scustom-name,
      END OF wa.
tabname = 'SCUSTOM'.
SELECT id name INTO CORRESPONDING FIELDS OF wa FROM (tabname).
  WRITE: / wa-id, wa-name.
ENDSELECT.
Cheers,
Kothand

Similar Messages

  • How to create select-options for 3 fields out of 5 by FREE_SELECTIONS_INIT

    Hi Experts,
    I am using the Function Modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG to create the select-options dynamically on the selection screen.
    My problem is that I am passing a field list of 10 fields in the FIELDS_TAB of the function.
    Now it creates the select-options for all 10 fields. I want to create select-options for only 5 fields initially and let the user select out of the remaining 5 fields to create the select-options.
    How to achieve this.?
    I tried by passing the 5 fields in FIELDS_NOT_SELECTED table but they get hidden and once hidden I am not able to get them back in my field list.
    Please help me out.
    Useful answers will be suitably rewarded.
    Thanks in advance.
    Regards,
    Himanshu

    Hi Experts,
    I am using the Function Modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG to create the select-options dynamically on the selection screen.
    My problem is that I am passing a field list of 10 fields in the FIELDS_TAB of the function.
    Now it creates the select-options for all 10 fields. I want to create select-options for only 5 fields initially and let the user select out of the remaining 5 fields to create the select-options.
    How to achieve this.?
    I tried by passing the 5 fields in FIELDS_NOT_SELECTED table but they get hidden and once hidden I am not able to get them back in my field list.
    Please help me out.
    Useful answers will be suitably rewarded.
    Thanks in advance.
    Regards,
    Himanshu

  • How to create select-options in module pool program

    Hi
    i am structed at this point could you please tell me
    how to create select-options in module pool program

    Steps to get SELECT-OPTIONS in module pool programs.
    <li>. Start one dialog program with SAPZ_TEST.
    <li>. Place the below code in the TOP include of the dialog program.
    PROGRAM SAPMZ_TEST.
    TABLES mara.
    SELECTION-SCREEN BEGIN OF SCREEN 2100 AS SUBSCREEN.
    SELECT-OPTIONS: matnr FOR mara-matnr.
    SELECTION-SCREEN END OF SCREEN 2100.
    <li>. Create one screen 2000 .
    <li>. Go to Layout of the screen and Define subscreen area on the screen and Name it as g_subscreen.
    <li>. Place the below code in the Flow logic of the screen.
    PROCESS BEFORE OUTPUT.
      CALL SUBSCREEN g_subscreen INCLUDING 'SAPMZ_TEST' '2100'.
    PROCESS AFTER INPUT.
      CALL SUBSCREEN g_subscreen.
    <li>. Activate all.
    <li>. Create Transaction code for the dialog program SAPZ_TEST.
    <li>. Execute the transaction code. You will see the select-option like we see on Selection-screen.
    I hope that it gets u clear idea.
    Thanks
    Venkat.O

  • How to create select-options in my own screen?

    Hi
    I create my screen and i wish to place select-options on screen. how to do that?

    There is no SAP standard way of creating select options on screen.However you can create your own select options by providing two fields on screen in which maximum and minimum values can be entered.
    screen fields :
    input1 : <minimum value>
    input2 : <maximum value>
    data :
    range for <some field>
    then you can fill a range with these values.For eg.
    range-low = <low value input field>.
    range-sign = 'I'.
    range-option = 'BT'.
    range-high = <high value input field>.
    append range.
    *Now write your select statement.
    select * from <some table> where <field> in <range>

  • How to creat select-option on module pool screen???

    Hi All,
       please tell me how to creat select-option on module pool screen???
    Regards
    Deepak

    Hi Deepak Kumar Sharma,
    There are Two ways to achieve it...
    1) How to create a select-options in a module pool screen.
    Method 1
    a) Create a subscreen area in your screen layout where you want to create the select options.
    b) In the top include of your module pool program declare a selection screen as a subscreen e.g.
    SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
    select-options s_matnr for mara-matnr.
    SELECTION-SCREEN END OF SCREEN.
    c) In the PBO and PAI of the main screen where the select options needs to be created do a call subscreen of the above screen (100).
    CALL SUBCREEN sub_area INCLUDING <program> <screen>
    This call subscreen statement is necessary for transport of values between screen and program.
    Note: All validations of the selection screen fields e.g. the s_matnr field created above should be done in selection screen events like AT SELECTION-SCREEN etc and not in PAI. These selection screen validations etc should be done in the top include only.
    Method 2
    a) Create 2 separate fields in your screen layout - one for the low value and one for the high value. Insert an icon beside the high value which will call the multiple selections popup screen on user command. Use function module COMPLEX_SELECTIONS_DIALOG to achieve this.
    struc_tab_and_field-fieldname = con_cust. " 'KUNNR'
    struc_tab_and_field-tablename = con_kna1. " 'KNA1'.
    CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
    EXPORTING
    TITLE = ' '
    text = g_titl1 " 'Customers'
    tab_and_field = struc_tab_and_field
    TABLES
    RANGE = rng_kunnr
    EXCEPTIONS
    NO_RANGE_TAB = 1
    CANCELLED = 2
    INTERNAL_ERROR = 3
    INVALID_FIELDNAME = 4
    OTHERS = 5.
    IF NOT rng_kunnr[] IS INITIAL.
    Read the very first entry of the range table and pass it to
    dynpro screen field
    READ TABLE rng_kunnr INDEX 1.
    IF sy-subrc = 0.
    g_cust = rng_kunnr-low.
    ENDIF.
    You can use the return table rng_kunnr to populate your own internal range table with the values entered by the user. Basically here you are just simulating the work of a select-options parameter by module pool screen elements.
    Also have a look on below threads
    how to make select option in module pool
    select option in module pool program
    Hope it will solve your problem..
    Thanks & Regards
    ilesh 24x7

  • To create select option in module pool prograaming.

    I want to create Select-option in module pool programming like a report where i want to enter range in my dialog  screen.
    Can anybody suggest me...with coding
    thanks
    kumar n

    It is possible .
    you can do that using COMPLEX_SELECTIONS_DIALOG mentioned by me or
    using the Subscreen approach mentioned by Rich in the below thread..
    https://forums.sdn.sap.com/click.jspa?searchID=15000207&messageID=1501162

  • Create select-options using internal table

    Hello,
    I have number of table-fields in one internal table.
    I need to create select-options on screen for each of the table field in that internal table.
    Can anybody please provide a code for it ?
    Thanks.

    hi,
    you can create in this way :
    select-options: <name> for itab-<field name>.
    example code:
    TABLES: vbak.    " standard table
    TYPE-POOLS: slis.
    *-- Structure to hold data from table
    TYPES: BEGIN OF tp_itab1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           werks LIKE vbap-werks,
           lgort LIKE vbap-lgort,
           END OF tp_itab1.
    *-- Data Declaration
    DATA: t_itab1 TYPE TABLE OF tp_itab1.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
    *                    Selection  Screen                                 *
    *--Sales document-block
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
                                 s_posnr FOR vbap-posnr,
                                 s_werks FOR vbap-werks,
                                s_lgort  FOR vbap-lgort.*
    SELECTION-SCREEN END OF  BLOCK b1.
    hope it will help you
    regards
    Rahul sharma
    Edited by: RAHUL SHARMA on Sep 19, 2008 8:25 AM

  • Populating select-options dynamically

    Hey Everybody,
    I've done some reports with Select-options, but all the fields directly related to some field in a transparent table. As many of you might have experienced, things changed with the latest report that I have to develop.
    I have to derive the drop-down for the select-options dynamically.
    Could anybody provide me with the details, code snippets, hints on how to do this.
    Thank You.
    Sumit.

    Here is an example program where you are generically defining the select-option and building its F4 help at runtime.
    report zrich_0001 .
    data: begin of ihelp occurs 0,
          field type char10,
          ftext type char50,
          end of ihelp.
    data: a_field(20) type c.
    select-options s_field for a_field.
    initialization.
      ihelp-field = 'A'.
      ihelp-ftext = 'Description A'.
      append ihelp.
      ihelp-field = 'B'.
      ihelp-ftext = 'Description B'.
      append ihelp.
      ihelp-field = 'C'.
      ihelp-ftext = 'Description C'.
      append ihelp.
    at selection-screen on value-request for s_field-low.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
           exporting
                retfield    = 'FIELD'
                dynprofield = 'S_FIELD'
                dynpprog    = sy-cprog
                dynpnr      = sy-dynnr
                value_org   = 'S'
           tables
                value_tab   = ihelp.
    start-of-selection.
    REgards,
    Rich Heilman

  • Can I put a text view next to a select-options dynamically aligned?

    Hello,
    I need a text view next to a select-options aligned.
    I think the only way to do it is dynamically and in the same container.
    I tried putting textviews beside the container and aligns them, but I couldn't.
    Thanks,
    Rodrigo.

    Hi,
    Can you please let me know what type of layout manager you are using?
    You may use Matrix layout to align the elements without using dummy textview.
    -Ashutosh

  • How to create select options

    Hi,
    Please guide me to implement select options in webdynpro.
    Regards,
    Ratheesh BS

    Hi Ratheesh,
    Sorry for the late reply. The m_handler is just a normal reference variable of type if_wd_select_options. Within the WDDOINIT methos you would be calling the interface controller method init_selection_screen to get the helper class. You just need to use this reference for calling the method set_global_options with your desired criteria. Just try go through the sample code fragment below:
    METHOD wddoinit .
      DATA: lr_select_options TYPE REF TO iwci_wdr_select_options.
      DATA lr_helper TYPE REF TO if_wd_select_options.
      DATA: lt_range TYPE REF TO data.
      DATA: lr_comp_usage TYPE REF TO if_wd_component_usage.
    " This code is to instantiate the component WDR_SELECT_OPTIONS
      lr_comp_usage = wd_this->wd_cpuse_select_options( ).
      IF lr_comp_usage->has_active_component( ) IS INITIAL.
        lr_comp_usage->create_component( ).
      ENDIF.
    " call the interface controller method init_selection_screen to get the helper class
      lr_select_options = wd_this->wd_cpifc_select_options( ).
    " You are getting the necessary reference to the component into lr_helper here
      lr_helper = lr_select_options->init_selection_screen( ).
    " Use the helper class to create a range table for the data element S_CARR_ID
      lt_range = lr_helper->create_range_table( i_typename = 'S_CARR_ID' ).
    " Add a Selection Screen Field
      lr_helper->add_selection_field( i_id   = 'S_CARR_ID'
                                   it_result = lt_range ).
    " Removing the Cancel button from the toolbar displayed
      lr_helper->set_global_options(  i_display_btn_cancel  = abap_false
                                      i_display_btn_check   = abap_true
                                      i_display_btn_reset   = abap_true
                                      i_display_btn_execute = abap_true ).
    ENDMETHOD.
    Hope this helps resolve your problem.
    Regards,
    Uday

  • How to create SELECT-OPTION in search help (search) field

    Hi All,
    We have created a search help using Help view as selection method.
    But, we want to have a SELECT-OPTION for one of the search parameters. How do we implement the same ?
    Regards,
    Ashish

    hi
    try  this
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
      EXPORTING
        TABNAME                   = 'YRJEMPDETAIL'
        FIELDNAME                 = 'L_NAME_LOW'
    *   SEARCHHELP                = ' '
    *   SHLPPARAM                 = ' '
       DYNPPROG                  = 'SAPMZRJ_HELP'
       DYNPNR                    = '9000'
       DYNPROFIELD               = 'LAST_NAME_LOW'
    *   STEPL                     = 0
    *   VALUE                     = ' '
    *   MULTIPLE_CHOICE           = ' '
    *   DISPLAY                   = ' '
    *   SUPPRESS_RECORDLIST       = ' '
    *   CALLBACK_PROGRAM          = ' '
    *   CALLBACK_FORM             = ' '
    *   SELECTION_SCREEN          = ' '
    * IMPORTING
    *   USER_RESET                =
    * TABLES
    *   RETURN_TAB                =
    * EXCEPTIONS
    *   FIELD_NOT_FOUND           = 1
    *   NO_HELP_FOR_FIELD         = 2
    *   INCONSISTENT_HELP         = 3
    *   NO_VALUES_FOUND           = 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.
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
      EXPORTING
        TABNAME                   = 'YRJEMPDETAIL'
        FIELDNAME                 = 'L_NAME_HIGH'
    *   SEARCHHELP                = ' '
    *   SHLPPARAM                 = ' '
       DYNPPROG                  = 'SAPMZRJ_HELP'
       DYNPNR                    = '9000'
       DYNPROFIELD               = 'LAST_NAME_HIGH'
    *   STEPL                     = 0
    *   VALUE                     = ' '
    *   MULTIPLE_CHOICE           = ' '
    *   DISPLAY                   = ' '
    *   SUPPRESS_RECORDLIST       = ' '
    *   CALLBACK_PROGRAM          = ' '
    *   CALLBACK_FORM             = ' '
    *   SELECTION_SCREEN          = ' '
    * IMPORTING
    *   USER_RESET                =
    * TABLES
    *   RETURN_TAB                =
    * EXCEPTIONS
    *   FIELD_NOT_FOUND           = 1
    *   NO_HELP_FOR_FIELD         = 2
    *   INCONSISTENT_HELP         = 3
    *   NO_VALUES_FOUND           = 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.
    hope this helps
    Regards
    Ritesh J

  • Create Select-Options in Modul-Pool

    Hi, i need to create a TabStrip Control, and the first tab needs a select-options.
    Is there any way to build it?
    Thanks.

    Try using this....
    SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-456.
    SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1
    NO INTERVALS.
    SELECT-OPTIONS SEL1 FOR SY-SUBRC.
    PARAMETERS PAR1 LIKE SPFLI-CARRID.
    SELECTION-SCREEN COMMENT /10(20) TEXT-COM.
    SELECTION-SCREEN END OF BLOCK BL1.
    SELECTION-SCREEN END OF SCREEN 123.
    CALL SELECTION-SCREEN 123 .
    Regards,
    Hemant.

  • Creating Selection List Dynamically or Through Code

    Has anyone created Selection Lists for Excel or Analyzer Dynamically Through Code? We have lists that could change quite often and would like to automate the process.

    Different methods for different situations. If you are just concerned about capturing newly added descendants/children of a dimension, it may be best to always begin the query at the appropriate parent level, then zooming/drilling to list all children/descendants at the time the query is run. Assigning attributes is another way to achieve this, assuming all the members which you wish to capture are similar in nature (eg. flavor, size, product category, etc.). After creating the attribute dimensions and assigning them to base dimensions, simply adding the attribute to the query dynamically filter the values returned. You can also drill/zoom on the attribute dimension in the query to view detail lists of the individual members which match.

  • Creating select option with the search help based on other select option

    Hi,
    I have displayed a selection screen with two select options S1 and S2.
    My requirement is that the values in the search help of S2 should get filled based on the values selected in S1.
    Note: User has option to select multiple values in S1.
    Does anybody know how to implement this?
    Thanks,
    Feroz

    >
    Sanjeeva wrote:
    > Hi,
    >
    > With standard f4 you cannot acheive this. You need to write customise with OVS or Simple value selector by reading S1 selected values.
    >
    > Thanks,
    > Sanjeev
    I'm getting fairly tired of seeing this completely incorrect information on this forum.  As stated before and already found out by this poster, you can map input and output values between multiple data dictionary search helps. You do NOT have to resort to using OVS for this option.

  • Disable the select-options dynamically based on value selected in listbox

    Hi friends,
    I have a peculiar problem in my program.
    I have a list box with two values.
    1) With Ref to Reservation No.
    2) Production order.
    I am doing the object for Transfer Posting ( Similar to MIGO).
    The contents of the listbox here are acting as the label to my select-options.
    I have two select-options in my program.
    1) Reservation No (s_rsnum for rsnum)
    2) Production Order (s_porder for aufnr)
    In runtime, based on the label selected in the listbox, the corresponding select-option should be in visible mode.
    for eg: if i select "With ref to Reservation No" S_rsnum should be enabled and vice-versa.

    Hi,
    here an example with listbox:
    TABLES: MARA.
    PARAMETERS: P0 DEFAULT 'KAUF' LIKE MARA-MTART AS LISTBOX VISIBLE LENGTH 8 USER-COMMAND DUMMY.
    SELECTION-SCREEN: SKIP 3.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR MODIF ID DI1.
    SELECTION-SCREEN: SKIP 3.
    SELECT-OPTIONS: S_MATKL FOR MARA-MATKL MODIF ID DI2.
    AT SELECTION-SCREEN OUTPUT.
      IF P0 = 'KAUF'.
        LOOP AT SCREEN.
          IF SCREEN-GROUP1 EQ 'DI1'.
            SCREEN-ACTIVE      = '1'.
            SCREEN-INPUT       = '1'.
            MODIFY SCREEN.
          ENDIF.
          IF SCREEN-GROUP1 EQ 'DI2'.
            SCREEN-ACTIVE      = '0'.
            SCREEN-INPUT       = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
      IF P0 <> 'KAUF'.
        LOOP AT SCREEN.
          IF SCREEN-GROUP1 EQ 'DI1'.
            SCREEN-ACTIVE      = '0'.
            SCREEN-INPUT       = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF SCREEN-GROUP1 EQ 'DI2'.
            SCREEN-ACTIVE      = '1'.
            SCREEN-INPUT       = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    use your own listbox in If-Clauses.
    Regards, Dieter

Maybe you are looking for