Drop down in alv based on data in other calumn of same row

Hi Guys,
I need to provide drop down in an ALV based on data in other calumn in same row.
if i have two calumns country and region in my alv then drop down values for region should come depending upon country value.
i went through lot of blogs and forum threads but none seems to solve my problem.
I'm able to achieve this in Table but not in ALV. I'm using DropdownbyIndex Ui element.

Hi Guys finally i am able to get my dropdown data visible.
I am posting the code here so that others can make use of it.
In your context node add an attribute type WDR_CONTEXT_ATTR_VALUE_LIST
after getting data into your context node table fill the above attribute as shown in the below code
LOOP AT lt_mara INTO ls_mara.
clear: lv_indx.
lv_indx = sy-tabix.
clear ls_valueset.
*refresh: lt_valueset.
ls_valueset-value = ls_mara-mtart.
ls_valueset-text = ls_mara-mtart.
APPEND ls_valueset to ls_mara-valueset.
clear ls_valueset.
*ls_valueset-text = ls_mara-matnr.
APPEND ls_valueset to ls_mara-valueset.
*lr_element = lo_nd_mara->get_element( lv_indx ).
*lr_child_node = lr_element->get_child_node( 'DDVALUE' ).
*lr_child_node->bind_table( lt_valueset ).
MODIFY lt_mara FROM ls_mara INDEX lv_indx.
CLEAR ls_mara.
ENDLOOP. lo_nd_mara->bind_table( lt_mara ).
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
*---set data
lo_interfacecontroller->set_data( r_node_data = lo_nd_mara ).
DATA lv_value TYPE REF TO   cl_salv_wd_config_table.
  lv_value = lo_interfacecontroller->get_model(
*----dropdown logic
data: lr_col type ref to CL_SALV_WD_COLUMN,
      lr_ddn type ref to cl_salv_wd_uie_dropdown_by_idx.
CALL METHOD lv_value->if_salv_wd_column_settings~get_column
  EXPORTING
    id     = 'MTART'
  receiving
    value  = lr_col
*lr_ddn ?= lr_col->get_cell_editor( ).
CREATE OBJECT lr_ddn
  EXPORTING
    selected_key_fieldname = 'MTART'
CALL METHOD lr_ddn->set_valueset_fieldname
  EXPORTING
    value  = 'VALUESET'
lr_ddn->set_selected_key_fieldname( value = 'MTART' ).
CALL METHOD lr_ddn->set_type
  EXPORTING
    value  = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>type_key_value
CALL METHOD lr_col->set_cell_editor
  EXPORTING
    value  = lr_ddn
lv_value->if_salv_wd_table_settings~set_read_only( abap_false ).
Just follow the above code you will be able to achieve dropdown by index in your alv.

Similar Messages

  • How does one come to know this..drop down in ALV in WD

    Hello Friends,
                          I had a requirement of adding a drop down in ALV, i eventually got it but I have some questions about it
    I used the following code and got the drop down
    lr_column = lr_column_settings->get_column( 'BWART' ).
      CREATE OBJECT lr_input_field
        EXPORTING
          value_fieldname = 'BWART'.
      lr_column->set_cell_editor( lr_input_field ).
    DATA : LR_DROPDOWN TYPE REF TO CL_SALV_WD_UIE_DROPDOWN_BY_KEY.
    CREATE OBJECT LR_DROPDOWN EXPORTING SELECTED_KEY_FIELDNAME = 'BWART'.
    LR_COLUMN->SET_CELL_EDITOR( LR_DROPDOWN ).
    DATA: LT_VALUESET TYPE TABLE OF WDR_CONTEXT_ATTR_VALUE,
    LS_VALUESET TYPE WDR_CONTEXT_ATTR_VALUE,
    LR_NODE TYPE REF TO IF_WD_CONTEXT_NODE,
    LR_NODEINFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO.
    LR_NODE = WD_CONTEXT->GET_CHILD_NODE( 'RETURN_NODE' ).
    LR_NODEINFO = LR_NODE->GET_NODE_INFO( ).
    LS_VALUESET-VALUE = '973'.
    LS_VALUESET-TEXT = '973'.
    APPEND LS_VALUESET TO LT_VALUESET.
    LS_VALUESET-VALUE = '222'.
    LS_VALUESET-TEXT = '222'.
    APPEND LS_VALUESET TO LT_VALUESET.
    LR_NODEINFO->SET_ATTRIBUTE_VALUE_SET( EXPORTING NAME = 'BWART' VALUE_SET = LT_VALUESET ).
    My question is ... how does 1 know which class to use? how to use that class... most of concepts about OOPS are clear.. but i still cant figure out how does 1 find out which class to use.. is it all by expericence..

    In short: Yes, by experience. Then again, for WD4A there is a class for each UI-Element available. Once you know this, you can easily search se24 for CLWD<UI-NAME>* or the like.

  • Drop down list item to select date

    I am using oracle form 6i, i want to use drop down list item to select date
    I was able to manipulate my codes to get values for the three drop down list items year, month and day
    but at when list change trigger on month to populate day , it populated accordingly but at point if I selected other month, it added the days of the new month selected to
    the days of already selected month. And delete list_element command failed to provide solution..
    Can any one help me out -- <email address removed by moderator so that you won't get spammed for all Eternity>

    1976 as year and march as month
    declare
    last_date date;
    nDays number;
    cursor days(v_last_date in date,vnDays in number) is
    select first_day(v_last_date)+rownum-1 sdate from dual
    connect by rownum<vnDays+1;
    begin
    select last_day(to_date(monthITEM||yearITEM,'MonthYYYY')) from dual;
    // the month is in the monthITEM
    // the year is in the yearITEM
    // last_day will have the last day of that month.
    //now you have to find the no. of days.
    select to_char(last_Date,'dd') into nDays from dual;
    for dates in days
    loop
    add_list_element(listname,dates.sdate,dates.sdate,1);
    end loop;
    end;

  • How do i insert a drop down calender to insert the date field.

    How do i insert a drop down calender to insert the date field i my create a form

    Hi,
    You can use the date object FormsCentral provides. When you test the form in browser, the date field will show a pulldown calendar when clicked upon.
    Thanks,
    Wenlan

  • Change field value in a table, based on another field value in the same row (for each added row)

    Please Help, I want to change field value in a table, based on another field value in the same row (for each added row)
    I am using this code :
    <HTML>
    <HEAD>
    <SCRIPT>
    function addRow(tableID) {
    var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    var colCount = table.rows[0].cells.length;
    for(var i=0; i<colCount; i++ ) {
    var newcell = row.insertCell(i);
    newcell.innerHTML = table.rows[1].cells[i].innerHTML;
    switch(newcell.childNodes[0].type) {
    case "text":
    newcell.childNodes[0].value = "";
    break;
    case "checkbox":
    newcell.childNodes[0].checked = false;
    break;
    case "select-one":
    newcell.childNodes[0].selectedIndex = 0;
    break;}}}
    function deleteRow(tableID) {
    try {var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    for(var i=0; i<rowCount; i++) {
    var row = table.rows[i];
    var chkbox = row.cells[0].childNodes[0];
    if(null != chkbox && true == chkbox.checked) {
    if(rowCount <= 2) {
    alert("Cannot delete all the rows.");
    break;}
    table.deleteRow(i);
    rowCount--;
    i--;}}}catch(e) {alert(e);}}
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
    <INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
    <TABLE id="dataTable" width="350px" border="1">
    <TR>
    <TD width="32"></TD>
    <TD width="119" align="center"><strong>Activity</strong></TD>
    <TD width="177" align="center"><strong>Cost</strong></TD>
    </TR>
    <TR>
    <TD><INPUT type="checkbox" name="chk"/></TD>
    <TD>
    <select name="s1" id="s1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </TD>
    <TD><input type="text" name="txt1" id="txt1"></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

    Hi,
    Let me make sure u r working with table control.
    First u have to create a event(VALIDATE) to do the validation.
    Inside the event,
    1. First get the current index where user has pointed the curson
    2. Once u get the index read the internal table with index value.
    3. Now u can compare the col1 and col2 values and populate the error message.
    1. DATA : lo_elt TYPE REF TO if_wd_context_element,
                   l_index type i.
    lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
         CALL METHOD LO_ELT->GET_INDEX( RECEIVING  MY_INDEX = l_index.
    above code should be written inside the event.
    Thanks,

  • Insert data in drop down in alv at run time.

    Hi Gurus,
    I have to insert data in the dropdown wich is in alv at run time.According to my requirement i have i fill my drop down in the init but depend upon some conditions i have to insert one more vaule in the drop down at the run time.
    My problem is that i have filled the drop down with new data but it is not displayed in at the alv output.It is working fine without alv.
    Thanks & Regards.

    Hi,
    As per my understanding you want to update values in the drop down, on enter event of some other field.
    For that you have written the code for drop down twice 1) in the init method 2) in the on enter event of one field, right?
    If the code is not working in the on enter event, I think you can still use 'WDDOMODIFYVIEW' method. Follow the below steps:
    1) create one attribute of type char1 in the attributes tab of the view
    2) Set the value of that attribute to 'X' in the on enter event of other field (where you have written the code for drop down)
    3) In 'WDDOMODIFYVIEW' method, check the value of attribute. If this is 'X' run the code for updating drop down, then clear the value of attribute
    Regards,
    Saket.

  • Abt Drop Down For ALV Data cells

    Hi,
    I m unable to create drop down for each cell of ALV table.
    Reply me as soon as possible.
    Thks.

    You need to create an object of type CL_SALV_WD_UIE_DROPDOWN_BY_KEY, which is the UI element for dropdown by key, and set that to be your individual cell editor.
    For whichever column you want a dropdown box, use the method set_cell_editor to make the editor as a dropdown box. Hope this helps.
    Regards
    Nithya

  • Drop down in ALV for Webdynpro ABAP

    Hi Experts,
    I was trying to implement one Web dynpro ABAP application that will show one ALV and ALV will content one dropdown so that user can select data from the drop down. Addtion to that, my dropdown should have data based on another column of ALV.
    I have followed one article which is available in Net.
    At the end of development, ALV is displayed with dropdown. Also dropdown has data binded. However, no data is visible in dropdown.
    I have created one context node having four dictionary element and one elemt for dispplaying the dropdown.
    In the DoInit method of view, i have written below code:
    Data Declaration
      DATA:
            lo_node_cskt  TYPE REF TO if_wd_context_node,
            lo_el_cskt    TYPE REF TO if_wd_context_element,
            ls_cskt       TYPE wd_this->element_cskt,
            lt_cskt       TYPE wd_this->elements_cskt,
            lo_cmp_usage  TYPE REF TO if_wd_component_usage,
            lv_value      TYPE REF TO cl_salv_wd_config_table,
            lr_column     TYPE REF TO cl_salv_wd_column,
            lr_drdn       TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
            ls_value_set  TYPE wdr_context_attr_value,
            lv_tabix      TYPE sy-tabix,
            lv_count(2)  TYPE c,
            lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.
    Navigate from <CONTEXT> to <CSKT> via lead selection:
      lo_node_cskt = wd_context->get_child_node( name = wd_this->wdctx_cskt ).
    get element via lead selection
      lo_el_cskt = lo_node_cskt->get_element( ).
    Get Data:
      SELECT kokrs kostl datbi ktext FROM cskt  INTO CORRESPONDING FIELDS OF TABLE lt_cskt.
      lv_count = 0.
    Populate value set
      LOOP AT lt_cskt INTO ls_cskt.
        lv_tabix = sy-tabix.
        CLEAR ls_cskt-ktext.
        DO 3 TIMES.
          lv_count = lv_count + 1.
          CONCATENATE 'TEST' lv_count INTO ls_value_set-text.
          CONCATENATE 'TEST' lv_count INTO ls_value_set-value.
          if lv_tabix = 2.
           if sy-index = 2.
             EXIT.
           endif.
          endif.
          APPEND ls_value_set TO ls_cskt-valueset.
        ENDDO.
        MODIFY lt_cskt FROM ls_cskt INDEX lv_tabix TRANSPORTING ktext valueset.
      ENDLOOP.
    Bind data
      lo_node_cskt->bind_table( lt_cskt ).
    Instantiate ALV
      lo_cmp_usage = wd_this->wd_cpuse_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
    Bind Data to Interface Controller Node
       lo_interfacecontroller->set_data(
            r_node_data = lo_node_cskt
    Get ALV reference table
       lv_value = lo_interfacecontroller->get_model( ).
    Make KTEXT column as drop down
       CALL METHOD lv_value->if_salv_wd_column_settings~get_column
       EXPORTING
         id = 'KTEXT'
       RECEIVING
         value = lr_column.
    Create Object for Drop down
      CREATE OBJECT lr_drdn
       EXPORTING
         selected_key_fieldname = 'KTEXT'.
      CALL METHOD lr_drdn->set_valueset_fieldname
      EXPORTING
        value = 'VALUESET'.
      CALL METHOD lr_drdn->set_type
      EXPORTING
        value = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>TYPE_KEY_CONVERT_TO_VALUE.
      CALL METHOD lr_column->set_cell_editor
      EXPORTING
        value = lr_drdn.
      CALL METHOD  lv_value->if_salv_wd_table_settings~set_read_only
      EXPORTING
        value = abap_false.
    I am still finding the answer why data in drop down is not visible. However, I can select by clicking dropdown and blank elements (since data is not visible) can be selected.

    Hey
    i am using  the same code except i have just modified little bit the select statement to restrict the number of entries.
    and also besides writing the code in wddoinit i have added the compenent usage of alv component and added the node
    having the structure ckst and after that deleting the dictionary reference to add the attribute valueset in both places
    component controller and view controller and mapped them and mapped the data node of interface controller of comp
    usage to this node in comp contrlr.
    and adding the view container and embeding table view of alv comp there.
    that's it
    and here is the code which is almost same as yours except small change in select statement.
    method WDDOINIT .
      DATA:
    lo_node_cskt TYPE REF TO if_wd_context_node,
    lo_el_cskt TYPE REF TO if_wd_context_element,
    ls_cskt TYPE wd_this->element_cskt,
    lt_cskt TYPE wd_this->elements_cskt,
    lo_cmp_usage TYPE REF TO if_wd_component_usage,
    lv_value TYPE REF TO cl_salv_wd_config_table,
    lr_column TYPE REF TO cl_salv_wd_column,
    lr_drdn TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
    ls_value_set TYPE wdr_context_attr_value,
    lv_tabix TYPE sy-tabix,
    lv_count(2) TYPE c,
    lo_interfacecontroller TYPE REF TO iwci_salv_wd_table.
    * Navigate from <CONTEXT> to <CSKT> via lead selection:
    lo_node_cskt = wd_context->get_child_node( name = wd_this->wdctx_cskt ).
    * get element via lead selection
    lo_el_cskt = lo_node_cskt->get_element( ).
    * Get Data:
    SELECT kokrs kostl datbi ktext FROM cskt INTO CORRESPONDING FIELDS OF TABLE lt_cskt up to 10 rows .
    lv_count = 0.
    * Populate value set
    LOOP AT lt_cskt INTO ls_cskt.
    lv_tabix = sy-tabix.
    CLEAR ls_cskt-ktext.
    DO 3 TIMES.
    lv_count = lv_count + 1.
    CONCATENATE 'TEST' lv_count INTO ls_value_set-text.
    CONCATENATE 'TEST' lv_count INTO ls_value_set-value.
    if lv_tabix = 2.
    if sy-index = 2.
    EXIT.
    endif.
    endif.
    APPEND ls_value_set TO ls_cskt-valueset.
    ENDDO.
    MODIFY lt_cskt FROM ls_cskt INDEX lv_tabix TRANSPORTING ktext valueset.
    ENDLOOP.
    * Bind data
    lo_node_cskt->bind_table( lt_cskt ).
    * Instantiate ALV
    lo_cmp_usage = wd_this->wd_cpuse_alv( ).
    IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
    ENDIF.
    lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
    * Bind Data to Interface Controller Node
    lo_interfacecontroller->set_data(
    r_node_data = lo_node_cskt
    * Get ALV reference table
    lv_value = lo_interfacecontroller->get_model( ).
    * Make KTEXT column as drop down
    CALL METHOD lv_value->if_salv_wd_column_settings~get_column
    EXPORTING
    id = 'KTEXT'
    RECEIVING
    value = lr_column.
    * Create Object for Drop down
    CREATE OBJECT lr_drdn
    EXPORTING
    selected_key_fieldname = 'KTEXT'.
    CALL METHOD lr_drdn->set_valueset_fieldname
    EXPORTING
    value = 'VALUESET'.
    CALL METHOD lr_drdn->set_type
    EXPORTING
    value = IF_SALV_WD_C_UIE_DRDN_BY_INDEX=>TYPE_KEY_CONVERT_TO_VALUE.
    CALL METHOD lr_column->set_cell_editor
    EXPORTING
    value = lr_drdn.
    CALL METHOD lv_value->if_salv_wd_table_settings~set_read_only
    EXPORTING
    value = abap_false.
    endmethod.
    thanks
    sarbjeet

  • Issue in value set Drop down for ALV in Webdynpro with Index

    Hi Experts,
    We are unable to get the Drop down values in the ALV Table as shown below.
    Code:
       DATA lo_nd_table TYPE REF TO if_wd_context_node.
        DATA lt_table TYPE wd_this->elements_table.
       DATA ls_table TYPE wd_this->element_table.
       DATA: lr_input TYPE REF TO cl_salv_wd_uie_input_field,
             lr_column TYPE REF TO cl_salv_wd_column,
             lt_node_info TYPE wdr_context_attr_info_map,
             ls_node_info TYPE wdr_context_attribute_info,
             lr_dropdown TYPE REF TO cl_salv_wd_uie_dropdown_by_idx,
             lr_info TYPE REF TO if_wd_context_node_info.
       DATA:lt_columns TYPE salv_wd_t_column_ref,
             ls_columns TYPE salv_wd_s_column_ref,
             lv_tabix TYPE sy-tabix,
             lv_count TYPE c.
       DATA: ls_valueset TYPE wdr_context_attr_value,
             lt_valueset TYPE wdr_context_attr_value_list.
       TYPES:BEGIN OF ty_name,
       name TYPE string,
       END OF ty_name.
       DATA: lt_name TYPE TABLE OF ty_name,
       ls_name TYPE ty_name.
    *   navigate from <CONTEXT> to <TABLE> via lead selection
       lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).
       SELECT * FROM zemp_table INTO CORRESPONDING FIELDS OF TABLE lt_table UP TO 10 ROWS.
       LOOP AT lt_table INTO ls_table.
         lv_tabix = sy-tabix.
         CLEAR: ls_table-leave_values.
         DO 1 TIMES.
           lv_count = lv_count + 1.
           CONCATENATE 'Open' lv_count INTO ls_valueset-value.
           CONCATENATE 'Open' lv_count INTO ls_valueset-text.
           APPEND ls_valueset TO ls_table-leave_values.
           CLEAR ls_valueset.
           CONCATENATE 'Approved' lv_count INTO ls_valueset-value.
           CONCATENATE 'Approved' lv_count INTO ls_valueset-text.
           APPEND ls_valueset TO ls_table-leave_values.
           CLEAR ls_valueset.
           CONCATENATE 'Rejected' lv_count INTO ls_valueset-value.
           CONCATENATE 'Rejected' lv_count INTO ls_valueset-text.
           APPEND ls_valueset TO ls_table-leave_values.
           CLEAR ls_valueset.
         ENDDO.
         MODIFY lt_table FROM ls_table INDEX lv_tabix TRANSPORTING leave_status leave_values.
       ENDLOOP.
       DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
       lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
       IF lo_cmp_usage->has_active_component( ) IS INITIAL.
         lo_cmp_usage->create_component( ).
       ENDIF.
       DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
       lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
       DATA lo_value TYPE REF TO cl_salv_wd_config_table.
       lo_value = lo_interfacecontroller->get_model(
    *  lo_interfacecontroller->set_data( r_node_data = lo_nd_value_set ).
    **Get the context node information
       lr_info = lo_nd_table->get_node_info( ).
       lt_node_info = lr_info->get_attributes( ).
       LOOP AT lt_node_info INTO ls_node_info.
         ls_name-name = ls_node_info-name.
         APPEND ls_name TO lt_name.
       ENDLOOP.
    *Get all the columns to make row editable
       CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
         RECEIVING
           value = lt_columns.
    * Make the field dropdown
       CALL METHOD lo_value->if_salv_wd_column_settings~get_column
         EXPORTING
           id    = 'LEAVE_STATUS'
         RECEIVING
           value = lr_column.
    * Create Object for dropdown
       CREATE OBJECT lr_dropdown
         EXPORTING
           selected_key_fieldname = 'LEAVE_STATUS'.
       CALL METHOD lr_dropdown->set_valueset_fieldname
         EXPORTING
           value = 'LEAVE_VALUES'.
       CALL METHOD lr_dropdown->set_type
         EXPORTING
           value = if_salv_wd_c_uie_drdn_by_index=>type_key_convert_to_value.
       CALL METHOD lr_column->set_cell_editor
         EXPORTING
           value = lr_dropdown.
    *Set the table Editable
       lo_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
       lo_nd_table->bind_table( new_items = lt_table ).
    Please suggest me where we are going wrong.
    Thanks in advance...!!!
    Best Regard's,
    Shashi Kanth

    Hi Shashi,
    Your code looks okay.  Debug & check if everything goes fine and all the required list of values getting bound to node.
    Is any code after this logic, which sets data to table ? if so, that logic is wiping out the drop down list values from context node.
    Final check point:
    Read the context node 'TABLE' and fetch records into internal table in WDDOMODIFYVIEW( ) method to make sure that, every row of your table contains the drop down list entries in "LEAVE_VALUES" attribute
    Hope this helps you.
    Regards,
    Rama

  • Drop Down in ALV  ABAP and NOT in OO - ABAP

    Hello Everyone....
    I m workin on an ALV which is in simple ABAP and not in OO-ABAP. There is some selection criteria on the first screen , as soon as the user fulfills the requirement an ALV GRID is displayed in which the last column is editable.
      But the Problem is that i wanna make that editable field in ALV as drop down which would contain values from the database table.
      Suggest me some method , so that i dont have to do much changes in my code .
      A Sample code will be very benificial .
    Thanx n Regards,
    Harpreet.

    Hi Harpreet,
    [compiled from sap online help - always a good chice]
    To make an input/output field into a list box, you must set the value L or LISTBOX in the Dropdown attribute in the Screen Painter. The visLg attribute determines the output width of the list box and the field. You can assign a function code to a list box field. In this case, the PAI event is triggered as soon as the user chooses a value from the list, and the function code is placed in the SY-UCOMM and OK_CODE fields. If you do not assign a function code, the PAI event must be triggered in the usual way – that is, when the user chooses a pushbutton or an element from the GUI status.
    If you have assigned a list box to an input/output field, you can use the Value list attribute of the screen element to determine how the value list should be compiled. There are two options:
    Value list from input help (recommended)
    If you do not enter anything in the value list attribute, the text field uses the first column displayed in the input help assigned to the screen field. The input help can be defined in the ABAP Dictionary, the screen, or a POV dialog module. It should be laid out in two columns. The key is automatically filled.
    Value list from PBO modules (not recommended).
    If you enter A in the value list attribute, you must fill the value list yourself before the screen is sent (for example, in the PBO event) using the function module VRM_SET_VALUES. When you do this, you must pass an internal table with the type VRM_VALUES to the import parameter VALUES of the function module. VRM_VALUES belongs to the type group VRM. The line type is a structure consisting of the two text fields KEY (length 40) and TEXT (length 80). In the table, you can combine possible user entries from the KEY field with any texts from the TEXT component. You specify the corresponding input/output field in the import parameter ID.
    Examples
    Example
    Dropdown box with a value list from input help (recommended)
    *& Report DEMO_DROPDOWN_LIST_BOX                                 *
    REPORT demo_dropdown_list_box.
    *& Global Declarations                                           *
    * Screen Interfaces
    TABLES sdyn_conn.
    DATA   ok_code TYPE sy-ucomm.
    * Global data
    TYPES: BEGIN OF type_carrid,
             carrid type spfli-carrid,
             carrname type scarr-carrname,
           END OF type_carrid.
    DATA itab_carrid TYPE STANDARD TABLE
         OF type_carrid WITH HEADER LINE.
    *& Processing Blocks called by the Runtime Environment           *
    * Event Block START-OF-SELECTION
    START-OF-SELECTION.
    CALL SCREEN 100.
    * Dialog Module PBO
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    * Dialog Modules PAI
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'SELECTED'.
          MESSAGE i888(sabapdocu) WITH sdyn_conn-carrid.
    ENDCASE.
    ENDMODULE.
    * Dialog Module POV
    MODULE create_dropdown_box INPUT.
      SELECT carrid carrname
                    FROM scarr
                    INTO CORRESPONDING FIELDS OF TABLE itab_carrid.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'CARRID'
                value_org       = 'S'
           TABLES
                value_tab       = itab_carrid
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc <> 0.
    ENDIF.
    ENDMODULE.
    The next screen (statically defined) for screen 100 is 100. The only input field on the screen is the component SDYN_CONN-CARRID. Its Dropdown attribute is set to L, and it has the output length 20. The Value list attribute is empty, and it has the function code SELECTED. The function codes of the buttons EXECUTE and CANCEL. CANCEL are defined in the GUI status as having the function type E.
    The screen flow logic is as follows:
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
    PROCESS AFTER INPUT.
      MODULE cancel AT EXIT-COMMAND.
      MODULE user_command_0100.
    PROCESS ON VALUE-REQUEST.
      FIELD sdyn_conn-carrid MODULE create_dropdown_box.
    Users cannot enter any values into the screen fields. When they choose the input field on screen 100, the system displays a list box. The Value list attribute is empty, so the system launches the input mechanism. In this case, the event block PROCESS ON VALUE-REQUEST is created in the screen flow logic. This event block controls all other mechanisms. A two-column internal table is filled in the appropriate dialog module and passed to the input help using the F4IF_INT_TABLE_VALUE_REQUEST function module. The system inserts the two columns of the table into the list box.
    When the user chooses a line in the list box, the PAI event is triggered using the function code SELECTED and the value in the first column of the internal table is copied to the input field.
    Regards,
    Clemens

  • Check box and Drop down in ALV

    Hi all ,
    I am using ALV to display my output . I am narrating my question in a example ,
    For eg :  In my ALV in 1st column i am getting check boxes in all the rows but i want the check boxes oly in specific line no's and in the 3rd column i want to use dropdown list , so user can select some datas from the list , Depend upon the user selection in the drop down list i want to display the values in the 4th column .For every  selection in a drop down list
    4th column should refresh and give the values . So kindly provide some inputs to finish this task .
    Note : I am using set table for 1st display and Function Module  LVC_FIELDCATALOG_MERGE .

    Hi Saravanan.
    FOLLOW THIS .
    data    :   gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
                 gd_repid     LIKE sy-repid.
    TYPES:  BEGIN OF TY_ITAB,,
                   LINE TYPE CHAR10,
                   CHECK TYPE CHAR1,
                    .....................................END OF TY_ITAB..
    DATA: ITAB TYPE TABLE OF TY_ITAB,
                WA TYPE TY_ITAB.
      wa_fieldcat-fieldname   = 'CHECK'.
      wa_fieldcat-scrtext_m   = 'CHECK BOX'.
      wa_fieldcat-col_pos     = 8.
       wa_fieldcat-edit     = 'X'.
      wa_fieldcat-checkbox = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    loop at itab into wa.
         if  wa-line <> 3 or  6 or 7.
          ls_stylerow-fieldname = 'CHECK' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                                 "set field to disabled
          APPEND ls_stylerow  TO wa-field_style.
          MODIFY itAB FROM wa.
         ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
           EXPORTING
                i_callback_program      = gd_repid
                i_callback_user_command =  USER_COMMAND
                is_layout_lvc               = gd_layout                              " Use this Parameter
                it_fieldcat_lvc             = it_fieldcat
                i_save                  = 'X'
           TABLES
                t_outtab                = ITAB
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
    REGARDS
    MURTHY.

  • Drop Down in ALV

    Hi,
    i have a problem to insert value in drop down list in ALV. (I want to use  this call function CALLFUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' or 'REUSE_ALV_GRID_DISPLAY)
    How can i  insert directly in ABAP 3 value. Example of code you can test this :
    report ZCO_AFFACT_TEST.
    * type pools
    TYPE-POOLS: SLIS.
    * declarations for alv and internal tables
    DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
    WA_FIELDCAT TYPE LVC_S_FCAT,
    WA_LAYOUT TYPE LVC_S_LAYO,
    V_POSITION TYPE I ,
    LS_CELLCOLOR TYPE LVC_S_SCOL,
    L_INDEX TYPE SY-TABIX.
    DATA: BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN,
    POSNR LIKE VBAP-POSNR,
    flag  LIKE ztypfac-flag,
    CELLCOLOR TYPE LVC_T_SCOL,
    END OF IT_VBAP.
    * start of selection
    start-of-selection .
    *---get data from db table
    perform get_data .
    *---build layout for alv
    perform build_layout .
    *---build fieldcat for alv
    perform build_fieldcat .
    *---modify fieldcat for colors in alv
    Perform modify_fieldcat .
    *---display alv
    perform display_alv .
    *& Form get_data
    FORM get_data .
    SELECT VBELN
    POSNR
    UP TO 25 ROWS
    INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
    FROM VBAP.
    ENDFORM. " get_data
    *& Form build_fieldcat
    FORM build_fieldcat .
    WA_FIELDCAT-FIELDNAME = 'VBELN'.
    WA_FIELDCAT-REPTEXT   = 'VBELN'.
    WA_FIELDCAT-edit      = 'X'.
    WA_FIELDCAT-drdn_hndl = '1'. "I have had
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'POSNR'.
    WA_FIELDCAT-REPTEXT = 'POSNR'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    WA_FIELDCAT-FIELDNAME = 'FLAG'.
    WA_FIELDCAT-REPTEXT = 'FLAG'.
    APPEND WA_FIELDCAT TO IT_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. " build_fieldcat
    *& Form build_layout
    FORM build_layout .
    WA_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
    WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM. " build_layout
    *& Form modify_fieldcat
    FORM modify_fieldcat .
    LOOP AT IT_VBAP.
    L_INDEX = SY-TABIX.
    if l_index = 5 or l_index = 15.
    LS_CELLCOLOR-FNAME = 'VBELN'.
    LS_CELLCOLOR-COLOR-COL = '6'.
    LS_CELLCOLOR-COLOR-INT = '1'.
    APPEND LS_CELLCOLOR TO IT_VBAP-CELLCOLOR.
    MODIFY IT_VBAP INDEX L_INDEX TRANSPORTING CELLCOLOR.
    endif.
    if l_index = 10 or l_index = 20.
    LS_CELLCOLOR-FNAME = 'VBELN'.
    LS_CELLCOLOR-COLOR-COL = '4'.
    LS_CELLCOLOR-COLOR-INT = '1'.
    APPEND LS_CELLCOLOR TO IT_VBAP-CELLCOLOR.
    MODIFY IT_VBAP INDEX L_INDEX TRANSPORTING CELLCOLOR.
    endif.
    if it_vbap-VBELN is initial .
    delete it_vbap.
    endif.
    ENDLOOP.
    ENDFORM. " modify_fieldcat
    *& Form display_alv
    FORM display_alv .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
    I_CALLBACK_PROGRAM  = SY-REPID
    IS_LAYOUT_LVC       = WA_LAYOUT
    IT_FIELDCAT_LVC     = IT_FIELDCAT
    TABLES
    T_OUTTAB = IT_VBAP .
    ENDFORM. " display_alv
    Thank you for your answers!
    Edited by: Emilien P. on Jun 30, 2010 10:42 AM

    Finaly i have user OO because all the example use the Object...
    With my old ALV i have used User command and Hotspot, it is very easy to use.
    Now with the OO i have a problem to manage the hot spot and a cell, when i am in mode debug /h when i click on the cell with the hotspot nothing happen !!! I don't undertand what is missing
    report ZCO_AFFACT_TEST.
    Tables : VBRK, VBRP,ZTYPFAC.
    *-- Global data definitions for ALV
    *--- ALV Grid instance reference
    DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .
    *--- Name of the custom control added on the screen
    DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV' .
    *--- Custom container instance reference
    DATA gr_ccontainer TYPE REF TO cl_gui_custom_container .
    *--- Field catalog table
    DATA gt_fieldcat TYPE lvc_t_fcat .
    *--- Layout structure
    DATA gs_layout TYPE lvc_s_layo.
    types : begin of wls_facture,
           ...        END OF wls_facture.
    types : begin of wls_resultat,
          ...        END OF wls_resultat.
    data : wlt_facture type TABLE OF wls_facture,
           wls_facture type          wls_facture,
           wlt_final   type TABLE OF wls_resultat,
           wls_final   type          wls_resultat.
    PERFORM BUILD_DATA.
    PERFORM display_alv.
    end-of-selection.
    call SCREEN 1000.
    "display_alv OUTPUT
    *&      Form  display_alv
    *       text
    FORM display_alv .
      IF gr_alvgrid IS INITIAL .
    *----Creating custom container instance
        CREATE OBJECT gr_ccontainer
          EXPORTING
            container_name              = gc_custom_control_name
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            others                      = 6.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT gr_alvgrid
          EXPORTING
            i_parent          = gr_ccontainer
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            others            = 5.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Preparing field catalog.
        PERFORM prepare_field_catalog CHANGING gt_fieldcat .
    *----Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout .
        PERFORM prepare_drilldown_values.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
        CALL METHOD gr_alvgrid->set_table_for_first_display
            EXPORTING
         is_layout                     = gs_layout
            CHANGING
          it_outtab                    = wlt_final
          it_fieldcatalog              = gt_fieldcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4 .
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
      ELSE .
        CALL METHOD gr_alvgrid->refresh_table_display
          EXCEPTIONS
            finished       = 1
            OTHERS         = 2 .
      ENDIF .
    ENDFORM .                    "display_alv
    If anybody  have an idea Thanks a lot !
    Emilien
    Edited by: Emilien P. on Jul 1, 2010 4:21 PM

  • Drop Down in ALV Flashes and Disappears.

    Hi All,
    I have a strange issue going on. In an ALV (built on CL_GUI_ALV_GRID) I have got an editable field with a drop down option.Now lets say I have 10 rows in an ALV. I chose an entry from the drop down in one of the rows (this happens OK) and immediately after that I go on a click on drop down for any other row. What happens is that the drop down for the new row that I am in flashes and disappears. Now if I click for the drop down again the drop down appears. Basically whenever an entry is selected in one of the rows, drop down function immediately after that does not work. I have a feeling that it has something to do with the data _changed event but I am not sure how to handle that event.
    I saw a similar thread  [ALV Menu Flash|ALV HANDLE_DATA_CHANGED_FINISHED; but could not figure it out.
    Any suggestions ?
    Thanks
    Anuj

    Hi,
    Let us see the code and check it
    Make the necessary changes at the fieldcatalog
    clear ls_fcat.
    ls_fcat-fieldname = 'COURSE'.
    ls_fcat-col_pos = 5.
    ls_fcat-coltext = 'Course'.
    ls_fcat-outputlen = 10.
    ls_fcat-DRDN_HNDL = 25.
    ls_fcat-edit = 'X'.
    APPEND ls_fcat to lt_fcat.
    and in the class cl_gui_alv_grid we have one method  SET_DROP_DOWN_TABLE
    and it is having one parameter called  iT_DROPDOWN of type  LVC_T_DROP
    generate the internal table and call the method set_drop_down_table
    clear ls_drop.
    ls_drop-handle = '25'.
    ls_drop-value = 'ABAP'.
    append ls_drop to lt_drop.
    clear ls_drop.
    ls_drop-handle = '25'.
    ls_drop-value = 'CRM'.
    append ls_drop to lt_drop.
    clear ls_drop.
    ls_drop-handle = '25'.
    ls_drop-value = 'WEBDYNPRO'.
    append ls_drop to lt_drop.
      CALL METHOD o_grid->set_drop_down_table
        EXPORTING
          it_drop_down       = lt_drop.
    Thanks & Regards.
    Raghunadh.K

  • Can you display a calendar in a drop down menu to select a date

    I would like to display a calendar in a drop down menu like in
    outlook's calendar appointments. Is this possible with forms
    and how can it be done. I haven't been able to find anything in
    the book I have. Any help would be appreciated
    Thanks
    Jim

    I am sure this is possible. There is a calendar object on the Forms and Demos CD but I have created my own calendar just using a single form that is called from every date field.
    Create your calendar using a single date item that is populated by a parameter - this will be either the date from the field or sysdate. Create the other elements of the calendar as calculated items based on the first item +1, +2 etc. Use a when-mouse-click trigger to get the user's selection and pass it back to the date field via a global variable or a shared PL/SQL library.
    To make it more like the Outlook calendar you will have to add a button next to every date field and add code to position the calendar according to the field position. You may prefer not to bother to do that - I just open the calendar centrally on screen and activate it using key-listval and/or a pop-up menu.
    Hope this gives you an idea.
    Regards
    Nigel Simpson

  • Search Item drop-down does not show any data for Advanced Search.

    Hi,
    I have a requirement to add a new criteria to the existing Advanced Search region of 'My Employee Information' in Manager Self Service responsibility. I substituted the AdvancedSearchVO to include the new column. Using personalization i did the below steps to show the new column in the page,
    1) Created a 'Message Styled Text' item under Table Layout region to display the result. I associated the View Instance (AdvancedSearchVO1) and View Attribute (AttrColumn).
    2) In Advanced Search Panel created a new CriteriaRow and set the 'Search Allowed' property to True.
    3) In Advanced Search Mappings i tried to create the new mapping but the Search Item drop-down does not show any of the CriteriaRow item. But Results Item shows the 'Message Styled Text' item created in step 1 above.
    Any idea what i would be missing becasue of which 'Search Item' property does not show any data?
    I am using OAF version 12.1.1.
    Thanks, Suresh

    Hi,
    I faced the same situation but i still waiting for the solution.. this is my problem's thread..
    Addition of LOV Search Filter using Personalization
    But when i tried to create a new custom page with advanced table and created a new LOV column via personalization. i was able to create new search mapping.. but this is not happening in the seeded page case :(.
    I m also looking for solution...if any one can provide some inputs on it , will be highly appreciated.
    Thanks
    Renu

Maybe you are looking for

  • I want to change my apple id but keep my contacts

    I am sharing my apple ID with my parents, not sure if it has anything to do with me not receieving text messages or vise versa. Now if I were to change my parents apple ids , how can they get access to their contacts? and will they be able to keep th

  • Table to be displayed in ALV format in WD.

    Hi Experts,Gurus. I want to display data in the ALV format in my web dynpro component. Can any please tell the procedure to achieve this Regards, Yugesh

  • IMessage interface Comp Controller (JAVA file) generated incompletely

    Hi Experts, I am doing a web dynpro java component, it has two views A & B (Comp view) I have rebuild the DC but not yet deployed it so no class files yet When i checked on the java code of my component controller it implements the IMessage interface

  • Master Detail Link Between Hierarchy column and graph

    Hi all, I have created report using hierarchy columns of project dimension. Project total -> Project Group -> Project subgroup ->Project Name When I click Project Group of hierarchy column , Graph has to change with respect to that column. Help me as

  • Urgent help: inputstream

    Hi, I m defining a BufferedReader and a Inputstream. for example:      in = new BufferedReader(new InputStreamReader(socket.getInputStream()));                inStream = socket.getInputStream(); The BufferedReader is use for reading Strings but i als