List box for the select-options

Hi All
  Can anyone send me a sample code to create a list-box for the select-options.

Hi vighnesh vasudevan,
Do like this for your select options for low and high also.
Parameters:
    p_quat  TYPE char20
            AS LISTBOX VISIBLE LENGTH 30
            LOWER CASE OBLIGATORY.
*              AT SELECTION-SCREEN ON VALUE-REQUEST                    *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_quat.
  PERFORM fill_quarters.
  PERFORM display_quarters.
*&      Form  fill_quarters
*       text
FORM fill_quarters .
  DATA:
* Field string to fill quarters in the year
    lfs_quarters TYPE LINE OF vrm_values.
  REFRESH t_quarters.
  lfs_quarters-key  = '1'.
  lfs_quarters-text = text-qu1.
  APPEND lfs_quarters TO t_quarters.
  lfs_quarters-key  = '2'.
  lfs_quarters-text = text-qu2.
  APPEND lfs_quarters TO t_quarters.
  lfs_quarters-key  = '3'.
  lfs_quarters-text = text-qu3.
  APPEND lfs_quarters TO t_quarters.
  lfs_quarters-key  = '4'.
  lfs_quarters-text = text-qu4.
  APPEND lfs_quarters TO t_quarters.
ENDFORM.                    " fill_quarters
*&      Form  display_quarters
*       text
FORM display_quarters .
  CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id              = 'P_QUAT'
      values          = t_quarters[]
    EXCEPTIONS
      id_illegal_name = 1
      OTHERS          = 2.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                    " display_quarters
Note: I think we are not able to display the list box for select options because i am not ever seen the list box in select options . No Probs try like above code.
See the following like it may help for you
Listbox for Select Options
Regards,
Mahi.

Similar Messages

  • How to create the list box in the selection screen.

    hai friends..
    i want to create the list box for the selection screen input boxes.
    thanks,
    velu.

    hi..
    1. There are two important things :
    a)PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
    b) Fm VRM_SET_VALUES
    2. just copy paste
    3.
    REPORT abc.
    TYPE-POOLS : vrm.
    DATA : v TYPE vrm_values.
    DATA : vw LIKE LINE OF v.
    PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
    INITIALIZATION.
    vw-key = '1'.
    vw-text = 'Jan'.
    APPEND vw TO v.
    vw-key = '2'.
    vw-text = 'Feb'.
    APPEND vw TO v.
    vw-key = '3'.
    vw-text = 'Mar'.
    APPEND vw TO v.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
    id = 'A'
    values = v
    EXCEPTIONS
    id_illegal_name = 1
    OTHERS = 2.
    regards,
    veeresh

  • How to apply List box for multiple selection of rows  in ALV report ?

    Hi Exprots,
    1: How to apply List box for multiple selection of rows  in ALV report ?
    Thanking you.
    Subash

    hi,
    check the below program.
    REPORT zalv_dropdowns.
    *Type pools declarations for ALV
    TYPE-POOLS : slis.
    *data declarations for ALV container,ALV grid, Fieldcatalogues & layout
    DATA: g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo.*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
    DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
          wa_outtab TYPE t517a.
    START-OF-SELECTION.*Call to ALV
      CALL SCREEN 600.*On this statement double click  it takes you to the screen painter SE51.
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    Here we also call the subroutine for ALV output.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      PERFORM alv_output.
    ENDMODULE.                    "pbo OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    ENDMODULE.                    "pai INPUT
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat.
    DATA ls_fcat TYPE lvc_s_fcat.
    *Build the field catalogue
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'T517A'
        CHANGING
          ct_fieldcat      = gt_fieldcat.
    To assign dropdown in the fieldcataogue
      LOOP AT gt_fieldcat INTO ls_fcat.   
    CASE ls_fcat-fieldname.
       WHEN 'SLART'.
    *is the first list box
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
    is the second list box    
    WHEN 'ABART'.       
            ls_fcat-drdn_hndl = '2'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.   
    ENDCASE.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  ALV_OUTPUT
    FORM alv_output .*Create object for container
      CREATE OBJECT g_custom_container
             EXPORTING container_name = 'CCONT'.
    *create object for grid
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    Build fieldcat and set column
    *Assign a handle for the dropdown listbox.
      PERFORM build_fieldcat.
    *Build layout
      PERFORM build_layout.
    Define a drop down table.
      PERFORM dropdown_table.
    *fetch values from the T517A table
      SELECT * FROM t517a INTO TABLE gt_outtab.
    *Display ALV output
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_outtab       = gt_outtab.ENDFORM.                               "ALV_OUTPUT
    *&      Form  dropdown_table
          text
    -->  p1        text
    <--  p2        text
    FORM dropdown_table.*Declarations for drop down lists in ALV.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
    First SLART listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '01 Primary school'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '02 Lower Secondary'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '03 Upper Secondary'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '04 Professional School'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '05 College'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '06 University'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '09 Other Establishment'.
      APPEND ls_dropdown TO lt_dropdown.* Second ABART listbox (handle '2').  ls_dropdown-handle = '2'.
      ls_dropdown-value = '10 Primary School certificate'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '20 Lower secondary/Junior high'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '30 High school diploma(B-levels)'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '31 Vocational'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '32 Matriculation'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '40 Specialist vocational certificate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '50 College degree Level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '51 College degree Level2'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '52 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '60 Univ Degree level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '61 Bachelors degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '62 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '63 Licenciate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '64 Doctors Degree Ph.D'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '89 None'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '90 Unknown'.
      APPEND ls_dropdown TO lt_dropdown.*method to display the dropdown in ALV
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.ENDFORM.                               " dropdown_table
    *&      Form  build_layout
          text
    *layout for ALV output
    FORM build_layout .  gs_layout-cwidth_opt = 'X'.
      gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
      gs_layout-no_toolbar = 'X'.ENDFORM.                    " build_layout
    endform.
    Edited by: S.r.v.r.Kumar on Jun 1, 2009 2:48 PM

  • How do I get the list index for the selected list item

    How can I obtain the list index for the currently selected
    element in a list item? I'm trying to move the label and value
    from on list box to another by using the add_list_element built-
    in and it requires the list index.
    Thanks for your help...

    Hi,
    You can`t get the Index for the selected item..
    you can get the Value of then Tlist using :Block.ListName .
    maybe theis code will help you..
    PROCEDURE pr_PasarElementos(ls_Origen           varchar2,                    ls_destino          varchar2,          cValor                    varchar2 default null) IS
         nCont_Orig     number := 0;
         nCont_Dest     number := 0;
    begin
    nCont_Orig := GET_LIST_ELEMENT_COUNT(ls_Origen);          nCont_Dest := GET_LIST_ELEMENT_COUNT(ls_destino);
         Add_List_Element(ls_destino,nCont_Dest+1,cValor,cValor);
         for rec_Orig in 1..nCont_Orig loop
         if GET_LIST_ELEMENT_VALUE(ls_Origen,rec_Orig) = cValor then
         delete_list_element(ls_Origen,rec_Orig);
         end if;
         end loop;
    end;
    you can call the procedure with :
    pr_pasarElementos('control.ls_activos','control.ls_inactivos',:CONTROL.ls_activos);
    here I`m working with the Value equal to the Label... you would need to look for the Label of the origin (ls_Origen) list using the Value (cValor) you already have.
    I hope this help you.

  • Error message for the select options

    hi.
    i want to throw thw error message if the user enters the value not valid(not in the range) for the zregion1 of zbwcntry of the select options.
    and user should be able to correct it before moving ahead.
    Also,iis not a mandatory field,So if it is initial,it can b blank.
    but if the input doesnot lie in the range,it should give error message on the selction screen.
    please guid with the line of codes.

    Check out this code:
    TABLES: PERNR.
    SELECT-OPTIONS VO_PERNR FOR PERNR-PERNR.
    AT SELECTION-SCREEN ON VO_PERNR.
      IF VO_PERNR IS INITIAL.
        MESSAGE 'Enter some employee IDs' TYPE 'E' DISPLAY LIKE 'S'.
      ELSE.
        IF '000001' NOT IN VO_PERNR.
          MESSAGE 'Employee id: 1, not selected' TYPE 'E' DISPLAY LIKE 'S'.
        ENDIF.
      ENDIF.

  • Validation for the select option value range of selection screen

    Hi All.
    if i wish to validate the selection screen parameter for a value range(select options),is it possible?
    what should i write in code.Also,m using FM DD_DOMVALUES_GET to get the values for a specific domain name.
    Please reply.

    Hiii,
         Yes it is possible.... Can you give me the piece of code ... about the select option
    and also the value range against which you want to validate the select option.
    So that i can help you with the coding tips...
    Thanks in advance..

  • Deleting some of the entries in the Combo-box for the selection field

    Hi All,
      We are running on SRM 4.0(Classic).I have a query reagarding the List of values which get populated in the comb-box for the field "Status" on the SC screen when i click on the "CHECK STATUS" link.
      I need to delete some of these entries which appear in the combo-box.Can anyone tell me how this can be done(partcularly with some info on how these values are getting populated and from where?).Points will be awarded.
    Thanks & regards,
    Disha.

    Hi Disha,
    you will have to change standard ABAP code for this.
    SC status list for CHECK STATUS is build in FORM status_mixed_text_fill in include LBBP_PDH_SEARCHF27.
    Rgds
    Christophe
    PS: please reward points for helpfull answers

  • Drop down box for the selection screen field of the classical report

    Hi all.
    i want to have the drop down list to choose from, for the region(table:zbwcntry-field:zregion1) on the selection screen.
    what is to be added to the code for this requirement.Also,please note that this is the classical report.
    thanks for this answered.

    hi,
    data  : gv_name  TYPE vrm_id,        " used for vrm id
               gv_repid TYPE sy-repid,      " used to hold program name
    work area to provide drop down list
    DATA :  gs_value TYPE vrm_value,
    Internal table to provide drop down list
    DATA :  gt_values TYPE vrm_values,
    PARAMETER : p_run(12) TYPE c AS LISTBOX VISIBLE LENGTH 12
                                     DEFAULT 'DEFAULT' OBLIGATORY,
    CONSTANTS : gc_run(5) TYPE c VALUE 'P_RUN',    "constant for run mode
    gv_name = gc_run.
      gs_value-key = gc_v1.
      gs_value-text = text-010.
      APPEND gs_value TO gt_values.
      gs_value-key = gc_v2.
      gs_value-text = text-011.
      APPEND gs_value TO gt_values.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = gv_name
          values          = gt_values
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      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 is helpful.
    Rgds.,
    subash

  • Creating a list box to the selection screen field

    Hi folks,
             Could any one suggest me how to add a list box (drop down list) to a selection screen field.
              Thanks,
              Santosh.
    Edited by: shyam prasad on Apr 3, 2009 6:07 AM

    Hi,
    just follow the code like below,
    TYPE-POOLS: vrm.
    TABLES sscrfields.
    PARAMETERS: p_values AS LISTBOX VISIBLE LENGTH 10.
    PARAMETERS: p_key TYPE char40 DEFAULT '5',
                p_text TYPE char80 DEFAULT 'Motorcycle'.
    SELECTION-SCREEN PUSHBUTTON /10(10) but USER-COMMAND abc.
    DATA: i_val TYPE vrm_values,
          wa_val TYPE vrm_value.
    AT SELECTION-SCREEN OUTPUT.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = 'P_VALUES'
          values          = i_val
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      IF sy-subrc  0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    AT SELECTION-SCREEN.
      IF sscrfields-ucomm = 'ABC'.
        IF p_key IS INITIAL AND p_text IS INITIAL.
          MESSAGE e001(00) WITH 'Enter both Key and Text to add value'.
        ELSE.
          CLEAR: wa_val.
          wa_val-key = p_key.
          wa_val-text = p_text.
          APPEND wa_val TO i_val.
        ENDIF.
      ENDIF.
    INITIALIZATION.
      CLEAR: wa_val.
      wa_val-key = 1.
      wa_val-text = 'Bus'.
      APPEND wa_val TO i_val.
      CLEAR: wa_val.
      wa_val-key = 2.
      wa_val-text = 'Car'.
      APPEND wa_val TO i_val.
      CLEAR: wa_val.
      wa_val-key = 3.
      wa_val-text = 'Van'.
      APPEND wa_val TO i_val.
      CLEAR: wa_val.
      wa_val-key = 4.
      wa_val-text = 'Bicycle'.
      APPEND wa_val TO i_val.
    Hope it helps!!
    Regards,
    Pavan

  • How To... Change the Data Type for a SELECT-OPTIONS at run time.

    Hello,
    I am trying to restrict the values available for entry into a SELECT-OPTIONS at run time depending on user input.
    The logic is as follows. The user has two input fields. A PARAMETER field which has the type RSDIOBJNM and allows them to choose an InfoObject. And the user has a SELECT-OPTIONS field to allow them to select the Characteristic values for that InfoObject.
    I would like the following example to be possible:
    The user enters 0MATERIAL into the PARAMETER. When the user clicks on the SELECT-OPTIONS control code will derive a list of possible options the user can enter in the SELECT-OPTIONS. In this case only values found in the master data or at least no values greater than 18 characters.
    I have looked at the following function module SELECT_OPTIONS_RESTRICT and this do not appear to be helpful as they only restrict on the signs allowed for the values (unless I misunderstand, it is a complex function module!).
    The code I have so far is (thus the user enters a InfoObject into p_char1 and the select options so_char1 should only accept active values of that InfoObject):
    declaration of variables for user interface
      DATA c_char(32) TYPE c.
    declaration of count variable
      DATA i_count TYPE i.
    declaration of user interface
      SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
        PARAMETERS: p_ipack TYPE RSLOGDPID.
      SELECTION-SCREEN END OF BLOCK a1.
      SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
        PARAMETERS: p_char1 TYPE RSDIOBJNM.
        SELECT-OPTIONS: so_char1  for c_char NO INTERVALS.
        PARAMETERS: p_char2 TYPE RSDIOBJNM.
        SELECT-OPTIONS: so_char2  for c_char NO INTERVALS.
        PARAMETERS: p_char3 TYPE RSDIOBJNM.
        SELECT-OPTIONS: so_char3  for c_char NO INTERVALS.
      SELECTION-SCREEN END OF BLOCK b1.
    Is what I am trying to do possible???
    Thanks for any help. Ross.

    You really want to restrict possible values of a select-option based on another field, not change the length of type of the select-option field, right?
    Here is what you do:  Code a custom F4 value help for the select-option at event AT SELECTION-SCREEN ON VALUE REQUEST FOR..  The first thing you do here is read the value of the parameter field (p_ipack in your example).  You can use function module DYNP_VALUES_READ.  Based on this value, you can propose values for the select-option fields.  Note that the use can still enter whatever s(he) wishes in to the select-option field without pressing F4. In this case, you will have to code some input validations taking into account the value in the p_ipack field.

  • Index of Values in the List Boxes on a Selection Screen

    Hi,
    I have a list box on the selection screen for Month field. It has the values Jan, Feb, Mar....etc in it.
    These entries, I added thru the VRM_SET_VALUES.
    Now, I want to default the month to current month SY-DATUM+4(2).
    Is there any FM to which I can send this SY-DATUM+4(2) as an Index and the corresponding value gets set for the Month field.
    As an alternatvie, I could use<b> Case Sy-DATUM+4(2). when '01'. p_month = 'Jan'.  etc etc..</b> But I want to avoid this big case statement.
    Please suggest.
    Thanks,
    Suryakiran D.

    Hi Suryakiran,
      Try to use the func <b>MONTH_NAMES_GET</b>.It will
      return the month name along with the number.
      And also you can directly select from table <b>T247</b>
    Thanks&Regards,
    Siri.
    Message was edited by: Srilatha T

  • Suppress entries in the drop down list box for fields Priority and Category

    Hello,
    For the transaction type 'Service Process' , I want to suppress certain values in the drop down list box for the fields Priority and Category based on certain conditions.I couldn't find a suitable badi for this scenario.
    Is there a solution so that I can control the values displayed in the drop down list box ?
    Thanks,
    Sriram
    Edited by: Sriram Sundar Rajan on Mar 17, 2008 12:15 PM

    Hello,
    For the transaction type 'Service Process' , I want to suppress certain values in the drop down list box for the fields Priority and Category based on certain conditions.I couldn't find a suitable badi for this scenario.
    Is there a solution so that I can control the values displayed in the drop down list box ?
    Thanks,
    Sriram
    Edited by: Sriram Sundar Rajan on Mar 17, 2008 12:15 PM

  • To provide the list box for field

    hi experts
    my problem is in me53n screen.in that screen i have to provide the list box for the screen field 'requisitioner'.ple tell me whats the way to provide the list box for the field.

    Hi ,
           Use FM VRM_SET_VALUES
    which has a table of key and values .
    and import parameter for fieldname where listbox has to be provided.
    below is the code.
    form fill_list_box .
      data : s_listbox type vrm_value .
      data : t_listbox type standard table of vrm_value initial size 0 .
      s_listbox-key = '1' .
      s_listbox-text = 'Class/Interface' .
      append s_listbox to t_listbox .
      s_listbox-key = '2' .
      s_listbox-text = 'Description' .
      append s_listbox to t_listbox .
      s_listbox-key = '3' .
      s_listbox-text = 'Method' .
      append s_listbox to t_listbox .
      g_vrm_id =  'ZCW_LIST-T1' .
    *loop at t_listbox into s_listbox .
      set parameter id 'AUN' field space.
      call function 'VRM_SET_VALUES'
           exporting
                id              = g_vrm_id
                values          = t_listbox
           exceptions
                id_illegal_name = 1
                others          = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " fill_list_box

  • Disable the Select-options field in the viewcontainer

    Hi,
    I  have two select option fields(Date,Number) in a viewcontainer .
    Now i need to disable one of the select-option field(Date) in the view container based on the condition.If I give Enability for the view container then both the select options will get diasbled.Is there any way to disable only Date select-option field in the view container.
    Thanks in Advance.
    Regards,
    bala.

    Hi,
    I just tested this solution and it is working for me....Following on Thomas's suggestion...I did the following....
    I just had one select-option on my scr...but it can be done with two too...
    step1: 
    created three attributes at component level under the attribute tab ( as suggested by Thomas )
    ENABLE_PRI_SELECTOPTION type  WDY_BOOLEAN 
    M_HANDLER type ref to     IF_WD_SELECT_OPTIONS
    M_WD_SELECT_OPTIONS  type ref to     IWCI_WDR_SELECT_OPTIONS
    Note: all are with public check box checked....so that all your views can see these attributes
    I created a method at componenet controller leverl:  create_select_option....in this method i have following code:
    DATA:
      lt_range_table TYPE REF TO data,
    *  rt_range_table TYPE REF TO data,
      read_only TYPE abap_bool,
      typename TYPE string.
      DATA:
      lr_componentcontroller TYPE REF TO ig_componentcontroller,
      l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
    * create the used component
      l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
    * get a pointer to the interface controller of the select options
    *component
      wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
    * init the select screen
      wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
    * create a range table that consists of this new data element
      lt_range_table = wd_this->m_handler->create_range_table(
      i_typename = 'PERSNO' ).
    * add a new field to the selection
      wd_this->m_handler->add_selection_field(
      i_id = 'PERSNO'
    I_VALUE_HELP_TYPE = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
    I_VALUE_HELP_ID = 'ZHELP_WDA_PERNR'
    I_NO_INTERVALS = abap_true
      it_result = lt_range_table
      i_read_only = wd_this->ENABLE_PRI_SELECTOPTION ).   <-----pls see here how i am controlling the read only property
    I assume you know this much...already....but i am just putting everything down....
    step2:
    in my view where i want to display the select-options....i added this code under my wddoinit method
    DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
    lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
    lo_componentcontroller->ENABLE_PRI_SELECTOPTION = abap_false.    <--pls see initially we want this field to be open
      lo_componentcontroller->create_select_option(
    step3: 
    i did not have much logic to control the select option field so i added a button which if user presses the field become disable...
    under that button action method i added the following code:
    DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
    lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
    lo_componentcontroller->ENABLE_PRI_SELECTOPTION = abap_true.
       "<---pls see here how i am changing the global *attribute which Thomas has suggested for controlling the "read only" attibute for the select-option field....you can put this under *your "if" statement....
    "this step is very important if you do not remove the field you will get the dump...since it will try to add the same field again
    "which produces dump from system....
    lo_componentcontroller->m_handler->REMOVE_SELECTION_SCREEN_ITEM(
    i_id = 'PERSNO' ).
    "now call the same method which we created at component level to create the select_options...
    lo_componentcontroller->create_select_option(
    that is all....it works great for me.....let us know if still have any questions....
    Thanks...
    AS...

  • List Boxes on a Selection Screen

    Hi,
    I have a list box on the selection screen. In the At Selection Screen Output, I filled the List box with 12 Values.
    Now, I want to default the List box value with one of those values.
    So, after the CALL FM 'VRM_SET_VALUES', I say p_field = 'Value'.
    But this Value is being shown in the Drop down list twice.
    I could not understand the mistake.
    Please suggest.
    Thanks,
    Suryakiran D.

    Hi suryakiran,
    1. Its happening bcos
       u must be giving NAME
    2. give p_field  = Key
    3. ie. 1 for Jan
            2 for Feb etc
    in the FM VRM_SET_VALUES
    we are filling the parameter VALUES
    VALUES-key
    VALUES-TEXT
    so, give KEY, (and not text)
    after calling this FM.
    4.
    REPORT abc.
    TYPE-POOLS : vrm.
    DATA : v TYPE vrm_values.
    DATA : vw LIKE LINE OF v.
    PARAMETERS : a(10) TYPE c AS LISTBOX VISIBLE LENGTH 10.
    INITIALIZATION.
    vw-key = '1'.
    vw-text = 'Jan'.
    APPEND vw TO v.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = 'A'
          values          = v
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
          a = '1'.
    Problem
          a = 'Jan'.
    regards,
    amit m.
    Message was edited by: Amit Mittal

Maybe you are looking for