Skip to Content
0
Former Member
Jun 08, 2007 at 06:44 AM

how to develop drop down menu on ever table cell

123 Views

Hi Gurus,

Does anybody know how to develop drop down menu on <b>every</b> tableview cell?

Kindly refer to the below url at the 3rd screenshot where the drop down menu is.

/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator

I need this menu to be appeared into all my table cell. Any suggestion on how to those menus to be applied into my codes? Below are my codes.

<b>Layout</b>

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title="Modify table " >
    <htmlb:form>
      <htmlb:tray id     = "tray1"
                  title  = "Period Control Data"
                  design = "BORDER" >
        <htmlb:trayBody>
          <htmlb:tableView id             = "TV"
                           table          = "<%= itab %>"
                           design         = "ALTERNATING"
                           onRowSelection = "MyEventRowSelection"
                           selectionMode  = "MULTILINEEDIT"
                           columnWidth    = "150%"
                           filter         = "SERVER"
                           visibleRowCount = "16"
                           sort            = "SERVER"
                           iterator        = "<%= lw_iterator %>"/>
 
          <br>
          <br>
          <center>
          <htmlb:button id       = "update"
                        text     = "Update Record"
                        onClick  = "onInputProcessing"
                        design   = "emphasized"
                        disabled = "false" />
          </center>
        </htmlb:trayBody>
      </htmlb:tray>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

<b>Event Handler (OnInputProcessing)</b>

* To get the selected RowIndex...
CLASS cl_htmlb_manager DEFINITION LOAD.
 
DATA: tv          TYPE REF TO cl_htmlb_tableview,
      event       TYPE REF TO cl_htmlb_event,
      table_event TYPE REF TO cl_htmlb_event_tableview.
 
 
 
 
FIELD-SYMBOLS <i> LIKE LINE OF selectedrowindextable.
 
tv  ?= cl_htmlb_manager=>get_data( request = request
                                   name    = 'tableView'
                                   id      = 'TV' ).
 
IF tv IS NOT INITIAL.
  table_event = tv->data.
  CLEAR selectedrowindextable.
  selectedrowindextable = table_event->prevselectedrowindextable.
  IF table_event->event_type EQ cl_htmlb_event_tableview=>co_row_selection.
    READ TABLE selectedrowindextable WITH KEY table_line = table_event->row_index TRANSPORTING NO FIELDS.
    IF sy-subrc EQ 0.
      DELETE selectedrowindextable INDEX sy-tabix.
    ELSE.
      APPEND INITIAL LINE TO selectedrowindextable ASSIGNING <i>.
      <i> = table_event->row_index.
      zindex = table_event->row_index.
 
    ENDIF.
  ENDIF.
ENDIF.
 
 
 
 
* get the button event.
IF event_id = cl_htmlb_manager=>event_id.
  event = cl_htmlb_manager=>get_event( runtime->server->request ).
 
  IF event->name = 'button' AND event->event_type = 'click'.
    DATA : button_event TYPE REF TO cl_htmlb_event_button.
    button_event ?= event.
  ENDIF.
 
  CASE event->id.   " Use this for specifying code for different buttons.
    WHEN 'update'.          " This is the button id.
      tv ?= cl_htmlb_manager=>get_data(
             request      = request
             name         = 'tableView'
             id           = 'TV' ).
 
      IF tv IS NOT INITIAL.
        DATA : tv_data TYPE REF TO cl_htmlb_event_tableview .
        tv_data = tv->data.
*get values from screen to work-area...get_cell_value is for tableView and get_data is for other objects like inputfield
 
        wa-class     = tv_data->get_cell_value(
                                         row_index     = zindex
                                         column_index  = 1 ).
 
 
        wa-fiscper3  = tv_data->get_cell_value(
                                         row_index     = zindex
                                         column_index  = 2 ).
 
        wa-fiscyear  = tv_data->get_cell_value(
                                         row_index     = zindex
                                         column_index  = 3 ).
 
 
        wa-zg_pver   = tv_data->get_cell_value(
                                         row_index     = zindex
                                         column_index  = 4 ).
 
 
        MODIFY itab INDEX  zindex FROM wa .
 
        MODIFY ZRM_PERIOD_CTRL FROM wa.
 
 
      ENDIF.
  ENDCASE.
ENDIF.