Select all checkbox in ALV tree

Hi There,
I have developed a report using ALV tree with 3 level nodes. I have introduced checkbox in one of the column in the node..
By this I can select the checkbox individually. I have got the requirement to select all the checkboxes simultaneously using a button. I tried several things but no help..
Please help me with this..I have used class 'cl_gui_alv_tree' for designing the Tree.

Hi,
You need to add a button to the toolbar manually, when the button is pressed loop at all the nodes that have a checkbox and update the checkbox field.
Something like....
data:  go_tree1     type ref to cl_gui_alv_tree,
       go_toolbar   type ref to cl_gui_toolbar
* Add buttons to the toolbar
  call method go_tree1->get_toolbar_object
    importing
      er_toolbar = go_toolbar.
  check go_toolbar is not initial.
  call method go_toolbar->add_button
    exporting
      fcode     = 'SELALL'
      icon      = icon_select_all
      butn_type = cntb_btype_button
      text      = ''
      quickinfo = 'Select All'.
* Define an event handler
data: go_receiver  type ref to lcl_event_receiver.
class lcl_event_receiver definition.
  public section.
    methods:
      function_selected for event function_selected of cl_gui_toolbar
              importing fcode.
endclass.
class lcl_event_receiver implementation.
  method function_selected.
    case fcode.
      when 'SELALL'.
        perform select_all.
  endmethod.
* Register the event
  create object go_receiver.
  set handler go_receiver->function_selected for go_toolbar.
form select_all.
  data: lv_field type lvc_fname.
* Update the checkbox on each node of the ALV tree
  lv_field = 'CHECK'.   "Whatever you've called the checkbox
  call method go_tree1->change_item
    exporting
      i_node_key     = node_key   "<-- loop at the nodes and repeat for each one with a checkbox
      i_fieldname    = lv_field
      i_data         = ' '
    exceptions
      node_not_found = 1
      others         = 2.
  call method go_tree1->frontend_update.   "call this onces all updates have been made
endform.
Regards,
Darren

Similar Messages

  • How to set selected all checkboxes in all dataTable's rows?

    Hi there,
    I'm trying to perform this simple task: having a dataTable with a column containing checkboxes, how can I allow (with a button, a "super" checkbox or so) to simultaneously set selected all checkboxes in all rows?
    And - is it possible to do so without calling the submit of the page?
    Thanks to everyone!

    Yes, the paging for <h:dataTable> works pretty good, it manages the task through four methods created in the java code -- DataTable1_firstPageAction(), DataTable1_previousPageAction(), DataTable1_nextPageAction(), DataTable1_lastPageAction() -- without adding any javascript in the jsp page.
    Maybe I could test if a java script similar to the <ui:table>'s one fit also the dataTable...
    thanks

  • Needed select all button in alv report

    Dear Experts,
                    In alv report i want first field as button selectall then remaining fields must be displayed
    this is my code,,
    DEFINE m_fieldcat.
      is_fieldcat-fieldname = &1.
      is_fieldcat-hotspot   = &2.
      is_fieldcat-seltext_m = &3.
      is_fieldcat-col_pos   = &4.
      is_fieldcat-outputlen = &5.
      is_fieldcat-emphasize = &6.
      is_fieldcat-Checkbox  = &7.
      append is_fieldcat to it_fcat.
      clear is_fieldcat.
    END-OF-DEFINITION.
    m_fieldcat 'SLNO'     ''        text-112   '1'   '5'   'C310' ''.
    m_fieldcat 'KPI'      ''        text-110   '2'   '30'  'C310' ''.
    m_fieldcat 'PWEEK'    'X'       text-109   '3'   '16'  'C310' ''.
    m_fieldcat 'CWEEK'    'X'       text-111   '4'   '16'  'C310' ''.
    m_fieldcat 'MONTH'    'X'       text-122   '5'   '16'  'C310' ''.
    m_fieldcat 'PMONTH'   'X'       text-132   '6'   '16'  'C310' ''.
    m_fieldcat 'UOM '      ''       text-138   '7'   '10'  'C310' ''.
    Thanks,
    Thiru. R

    Hi,
    You can keep first field as checkbox. 'Select All' button is present in ALV whnever you use 'REUSE_ALV_GRID' F.M.
    You can click on select all button that appears in ALV grid toolbar and all your checkboxes that appears in first field will get selected. Similar to 'Select All' there is 'Deselct All' button also in ALV grid.
    Regards,
    Saba

  • HOW TO PERFORM SELECT ALL BUTTON IN ALV

    Hi ,
    i displayed output by using list display. in my status i have one button i.e. select all. when i click that button it has to select all the chckboxes in my list display.
    anybody can send me the code please.
    i am sending my code below.
    report zmahi6.
    type-pools : slis.
    tables : zuser_secobjects.
    data: t_header1 like zvfrcsthdr.
    data : begin of t_header occurs 0 .
             include structure t_header1.
    data :  customer_name like zvsfrcsthdr-customer_name,
             kukla like kna1-kukla,
            end of t_header.
    data : t_header1 like zuser_secobjects.
    data : begin of it_secobjects occurs 0.
            include structure t_header1.
    data :  box,
            input(1) type c,
          end of it_secobjects.
    *data : it_secobjects like zuser_secobjects occurs 0 with header line.
    data : i_field type slis_t_fieldcat_alv with header line.
    data : w_field like line of i_field.
    data : i_sort type slis_t_sortinfo_alv.
    data : w_sort like line of i_sort.
    data : it_filt1 type slis_t_filter_alv with header line.
    data:
    i_tabname type tabname,
    i_repid like sy-repid,
    is_lout type slis_layout_alv.
    data : chk_box type slis_fieldname.
    selection-screen: begin of block b1 with frame title text-t01.
    parameters : p_appln type zuser_secobjects-appln.
    parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
    p_partnr type zuser_secobjects-appln_partner,
    p_ptype type zuser_secobjects-partner_type default '02',
    p_upostn type zuser_secobjects-user_position,
    p_sdate like likp-erdat default sy-datum,
    "type zuser_secobjects-start_date
    p_edate(10) default '12/31/9999',
    type zuser_secobjects-end_date,
    p_revnum type zuser_secobjects-revnum,
    p_cted type zuser_secobjects-created_by,
    p_cdate type zuser_secobjects-creation_date,
    p_ctime type zuser_secobjects-creation_time,
    p_chnby type zuser_secobjects-changed_by,
    p_cdate1 type zuser_secobjects-changed_date,
    p_ctime1 type zuser_secobjects-changed_time.
    selection-screen: end of block b1.
    start-of-selection.
      perform get_data.
      check sy-subrc eq 0.
      set pf-status 'ZMAHEE'.
      perform prepare_fieldcatalog.
      perform alv_list_display.
      form user_command using r_ucomm like sy-ucomm
                          rs_selfield type slis_selfield.
      case r_ucomm.
        when 'DELETE'.
          perform delete.
      endcase.
    ENDFORM.
    *& Form PREPARE_FIELDCATALOG
    text
    --> p1 text
    <-- p2 text
    form prepare_fieldcatalog.
      clear: w_field,i_field.
      refresh:i_field.
      i_field-key = 'X'.
      i_field-col_pos = 1.
      i_field-ddictxt = 'S'.
      i_field-seltext_s = '@11@'.
      i_field-checkbox = 'X'.
      i_field-input = 'X'.
      i_field-fieldname = 'HEADER'.
      i_field-outputlen = 0.
      append i_field.
      clear i_field.
      w_field-fieldname = 'APPLN'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-seltext_l = text-m01.
      w_field-outputlen = '10'.
      w_field-col_pos = 1.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_USER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
    endform. " PREPARE_FIELDCATALOG
          FORM pf_status_set                                            *
    -->  RT_EXTAB                                                      *
    form pf_status_set using rt_extab type slis_t_extab.
      set pf-status '0001'.
    endform.
    *form user_command using r_ucomm like sy-ucomm
                           rs_selfield type slis_selfield.
    *form user_command using r_ucomm like sy-ucomm
                         rs_selfield type slis_selfield.
    case r_ucomm.
       when 'DELETE'.
         perform delete.
    endcase.
    *endform.
    *& Form ALV_LIST_DISPLAY
    text
    --> p1 text
    <-- p2 text
    form alv_list_display.
      i_repid = sy-repid.
      call function 'REUSE_ALV_LIST_DISPLAY'
      exporting
      i_callback_program = i_repid
      i_callback_pf_status_set = 'PF_STATUS_SET'
      i_callback_user_comomand = 'USER_COMMAND'
      is_layout = is_lout
      it_fieldcat = i_field[]
    it_sort = i_sort
    it_events = it_evts[]
      tables
      t_outtab = it_secobjects.
    endform. " ALV_LIST_DISPLAY
    *& Form GET_DATA
    text
    --> p1 text
    <-- p2 text
    form get_data.
      select * from zuser_secobjects
      into table it_secobjects.
    endform. " GET_DATA
    *&      Form  delete
          text
    -->  p1        text
    <--  p2        text
    form delete.
      data : lines type i.
      do lines times.
        clear it_secobjects.
        read line sy-index field value it_secobjects-box.
        read table it_secobjects with  key appln = it_secobjects-appln
                                     appln_user = it_secobjects-appln_user.
        if it_secobjects-input ne 'X'.
          it_secobjects-box = 'X'.
          modify line sy-index
               field value it_secobjects-box.
        else.
          it_secobjects-box = space.
          modify line sy-index
          field value it_secobjects-box.
        endif.
      enddo.
    endform.                    " delete
    this program is not working when i select select all button. this button exist in pf status 0001.
    anybody can modify the code and send me the code again.
    thanks,
    maheedhar.t

    HI Rich,
    i tried in this way also but i didnt get the output. i am sending my code again plz do the necessary changes and resend it to me if possible,
    report zmahi6.
    type-pools : slis.
    tables : zuser_secobjects.
    data: t_header1 like zvfrcsthdr.
    data : begin of t_header occurs 0 .
             include structure t_header1.
    data :  customer_name like zvsfrcsthdr-customer_name,
             kukla like kna1-kukla,
            end of t_header.
    data : t_header1 like zuser_secobjects.
    data : begin of it_secobjects occurs 0.
            include structure t_header1.
    data :  box,
            input(1) type c,
            checkBOX(1) type c,
          end of it_secobjects.
    data : wa_ita like line of it_secobjects.
    *data : it_secobjects like zuser_secobjects occurs 0 with header line.
    data : i_field type slis_t_fieldcat_alv with header line.
    data : w_field like line of i_field.
    data : i_sort type slis_t_sortinfo_alv.
    data : w_sort like line of i_sort.
    data : it_filt1 type slis_t_filter_alv with header line.
    data:
    i_tabname type tabname,
    i_repid like sy-repid,
    is_lout type slis_layout_alv.
    data : chk_box type slis_fieldname.
    selection-screen: begin of block b1 with frame title text-t01.
    parameters : p_appln type zuser_secobjects-appln.
    parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
    p_partnr type zuser_secobjects-appln_partner,
    p_ptype type zuser_secobjects-partner_type default '02',
    p_upostn type zuser_secobjects-user_position,
    p_sdate like likp-erdat default sy-datum,
    "type zuser_secobjects-start_date
    p_edate(10) default '12/31/9999',
    type zuser_secobjects-end_date,
    p_revnum type zuser_secobjects-revnum,
    p_cted type zuser_secobjects-created_by,
    p_cdate type zuser_secobjects-creation_date,
    p_ctime type zuser_secobjects-creation_time,
    p_chnby type zuser_secobjects-changed_by,
    p_cdate1 type zuser_secobjects-changed_date,
    p_ctime1 type zuser_secobjects-changed_time.
    selection-screen: end of block b1.
    start-of-selection.
      perform get_data.
      check sy-subrc eq 0.
      set pf-status 'ZMAHEE'.
      perform prepare_fieldcatalog.
      perform alv_list_display.
    END-OF-SELECTION.
    AT USER-COMMAND.
    CASE SY-UCOMM.
    when 'DELETE'.
          loop at it_secobjects.
    it_secobjects-checkBOX = 'X'.     "<-this would be the name of the
             modify it_secobjects.
          endloop.
        rs_selfield-refresh = 'X'.
         PERFORM ALV_LIST_DISPLAY.
    endcase.
    *ENDCASE.
    *ENDFORM.
    *& Form PREPARE_FIELDCATALOG
    text
    --> p1 text
    <-- p2 text
    form prepare_fieldcatalog.
      clear: w_field,i_field.
      refresh:i_field.
      i_field-key = 'X'.
      i_field-col_pos = 1.
      i_field-ddictxt = 'S'.
      i_field-seltext_s = '@11@'.
      i_field-checkbox = 'X'.
      i_field-input = 'X'.
      i_field-fieldname = 'HEADER'.
      i_field-outputlen = 0.
      append i_field.
      clear i_field.
      w_field-fieldname = 'APPLN'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-seltext_l = text-m01.
      w_field-outputlen = '10'.
      w_field-col_pos = 1.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_USER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
    endform. " PREPARE_FIELDCATALOG
          FORM pf_status_set                                            *
    -->  RT_EXTAB                                                      *
    form pf_status_set using rt_extab type slis_t_extab.
      set pf-status '0001'.
    endform.
    *form user_command using r_ucomm like sy-ucomm
                           rs_selfield type slis_selfield.
    *form user_command using r_ucomm like sy-ucomm
                         rs_selfield type slis_selfield.
    case r_ucomm.
       when 'DELETE'.
         perform delete.
    endcase.
    *endform.
    *form user_command using p_ucomm like sy-ucomm
    *rs_selfield type slis_selfield.
    case p_ucomm.
       when 'DELETE'.               " SELALL is the FCODE of ur push
    *button
         loop at it_secobjects  into wa_ita.
           it_secobjects-check = 'X'.
           modify it_secobjects from wa_ita.
         endloop.
    endcase.
    *endform.
    form user_command using r_ucomm like sy-ucomm
                                           rs_selfield type slis_selfield.
    case r_ucomm.
    when 'DELETE'.
          loop at it_secobjects.
    it_secobjects-checkBOX = 'X'.     "<-this would be the name of the
    *checkbox field in your internal table.
             modify it_secobjects.
          endloop.
         rs_selfield-refresh = 'X'.
         PERFORM ALV_LIST_DISPLAY.
    endcase.
    endform.
    *& Form ALV_LIST_DISPLAY
    text
    --> p1 text
    <-- p2 text
    form alv_list_display.
      i_repid = sy-repid.
      call function 'REUSE_ALV_LIST_DISPLAY'
      exporting
      i_callback_program = i_repid
      i_callback_pf_status_set = 'PF_STATUS_SET'
      i_callback_user_comomand = 'USER_COMMAND'
      is_layout = is_lout
      it_fieldcat = i_field[]
    it_sort = i_sort
    it_events = it_evts[]
      tables
      t_outtab = it_secobjects.
    endform. " ALV_LIST_DISPLAY
    *& Form GET_DATA
    text
    --> p1 text
    <-- p2 text
    form get_data.
      select * from zuser_secobjects
      into table it_secobjects.
    endform. " GET_DATA
    *&      Form  delete
          text
    -->  p1        text
    <--  p2        text
    form delete.
      data : lines type i.
      do lines times.
        clear it_secobjects.
        read line sy-index field value it_secobjects-box.
        read table it_secobjects with  key appln = it_secobjects-appln
                                     appln_user = it_secobjects-appln_user.
        if it_secobjects-input ne 'X'.
          it_secobjects-box = 'X'.
          modify line sy-index
               field value it_secobjects-box.
        else.
          it_secobjects-box = space.
          modify line sy-index
          field value it_secobjects-box.
        endif.
      enddo.
    endform.                    " delete
    thanks,
    maheedhar.t

  • Select ALL rows in ALV by an ACTION

    Hi All -
    Is possible to have a button with an Action "select all" and when the user trigger that action all the records in the ALV are selected?
    i.e ALV has 10 records (lines or rows) and user click on a button with text "SELECT ALL" and once they click that button all the rows/lines are selected.
    Thanks!
    Jason P-V

    Hi ,
    yes it can be done....
    here is the procedure to do it.....
    first we need to make the context node "selection" property equals to "0..n"  you can find this property at your component controller level.....where you set your "cardinality" as well...
    than create a button in your view layout where the alv is being displayed and write the following code for button action:
    DATA lo_nd_alv_table TYPE REF TO if_wd_context_node.
    navigate from <CONTEXT> to <alv_table> via lead selection
       lo_nd_alv_table = wd_context->get_child_node( name = wd_this->wdctx_alv_table ).
    DATA counter TYPE i.
      counter =   lo_nd_alv_table->get_element_count( ).
      DO counter TIMES.
          lo_nd_alv_table->set_selected(
        EXPORTING
        index = sy-index ).
      ENDDO.
    I just tested this...and it worked for me....
    Thanks...
    AS...
    Just forgot to mention....if you want to de-select them all...you can use the method:
    lo_nd_alv_table->CLEAR_SELECTION(
    the above code can be put in in the btn action method.....say you have two btns one to select all rows and one to de-select all....
    this code can go under de-select all btn action method.....
    Edited by: J Are on Dec 11, 2009 8:53 PM

  • Selecting all rows in ALV on a button click

    Hi Experts
    Hi,
    I have a dynamic ALV table. I also have a button 'Select All Rows'. On clicking the button I want all the rows in the ALV table selected which is done by using set_selected method at the context node.
    All the rows in the alv is selected after clicking select_all except for the first row.
    Need your inpts to solve the same.
    Regards
    Karthick

    Use the folowing code
    *... get model
      data:
        lr_model type ref to cl_salv_wd_config_table.
      lr_model ?= me->r_model.
    *... get columns
      data:
        ls_column type salv_wd_s_column_ref,
        lt_column type salv_wd_t_column_ref.
      lt_column = lr_model->if_salv_wd_column_settings~get_columns( ).
      data:
        l_selected type abap_bool.
      loop at lt_column into ls_column.
        l_selected = abap_false.
        read table value transporting no fields with key column = ls_column-id.
        if sy-subrc eq 0.
          l_selected = abap_true.
        endif.
        try.
            me->if_salv_bs_model_column~set_selected(
              column = ls_column-id
              value = l_selected ).
          catch cx_salv_bs_sc_object_not_found.             "#EC NO_HANDLER
        endtry.
      endloop.

  • Function Module to select all entries in  ALV output

    Hi,
      I have an ALV report and Select ALL and Deselect ALL Buttons added to it .
      When the Select ALL button is pressed,all entries of the ALV report should be selected.
      When the Deselect ALL button is pressed,all entries of the ALV report should be deselected.
      Is there any function module to select all entries of the output and vice versa.
      Thanks in advance.
    Regards,
    Navas

    Hi Navas,
    I have written a part of the code you can use.
      TYPE-POOLS: slis.
      DATA : ls_event TYPE slis_alv_event.
    Set PF Status
      ls_event-name = slis_ev_pf_status_set .
      ls_event-form = slis_ev_pf_status_set .
      APPEND ls_event TO gt_event.
      CLEAR  ls_event.
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'Z_STATUS'.
    ENDFORM  .                 "set_pf_status
    (no need for any perform. This will be called automatically).
    While calling the FM for ALV, pass the internal table gt_event in it_events parameter.
    Double click on Z_STATUS and add two buttons in Application Toolbar.
    1. Select All - Give function code name as &ALL,
    2. Deselect All - Give function code name as &SAL.
    Hope this helps.
    Thanks,
    Dawood.
    Edited by: Dawood.S.Ghasletwala on Apr 3, 2009 3:51 PM

  • Removing the select all icon from ALV

    Hi
    I'm using CL_GUI_ALV_GRID to display an ALV grid. Can I get rid of the standard "select all" icon from the top left corner of the grid? I don't want the user to be able to use this icon, but can't see a way of removing it.
    Regards
    Phil

    Hi Phil
    That means you do not want the user to select multiple rows. Because letting the user to select multiple rows always gives him the opportunity to select all rows even without using the button you mentioned.
    Then you must set the "sel_mode" of the layout structure to "B" to make user select one row only.
    Regards
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • How to select all checkbox by clicking one button

    Hi all,
    I have ALV with one column as checkbox.
    I have pushbutton on menubar.
    No i want that on clicking on that button all checkbox should get checked.
    can u pl. tell me how can i achive this...
    Thanks,
    Chintan

    In the user_command subroutine you can write the code
    FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM....
    CASE P_UCOMM.
      WHEN 'SELALL'.                      " SELALL is the FCODE of ur push button
            loop at itab into wA_itab.
                 itab-check = 'X'.
                 modify itab from wa_itab.
            endloop.
    ENDCASE.
    ENDFORM.

  • Mark all line in alv tree

    HI
    I'm using alv list tree  and the problem is that the user can
    mark the all line (node or item ) just when he choose on the folder (icon ) and can
    choose for the text and not all the line is marked (this is confusing for the user since
    when he mark the text and press on right click noting happen just when he mark the all
    line include the folder and press right click its open a popup )
    what i want is on the tree is similar behavior for se 80 when user open the tree and choose a line
    (node or item ) all the line is marked (for instance if choose class is se8o and you expend the
    tree and choose method - mark the line all the line is marked include the icon the problem is
    in my case that just the text is marked and not the all line )
    how can i solve this issue?
    i am using this following class and events its work but not mark the all line
    cl_gui_list_tree=>eventid_node_context_menu_req
    and
           on_node_context_menu_select
    Regards
    James
    Edited by: James Herb on Jul 21, 2010 9:29 PM

    I think you can use parameter itemselection_ in the constructor to have this behavior.
    Check this link:
    Link: [http://help.sap.com/saphelp_47x200/helpdata/en/1b/2a75bda9fd11d2bd6f080009b4534c/content.htm]

  • Multiple selection of Checkboxes in ALV

    Hi All
    I have created an ALV Report in which Final Internal Table(Fields to be displayed) is having a Field as CheckBox.
    Problem is when I'm clicking multiple checkboxes only single field of table is getting updated but I want multiple rows to be updated. I have tried by using loop also but no use.
    Please check the code.
      case r_ucomm.
        when '&DATA_SAVE'.
          loop at it_data into wa_data.
              read table it_fpla into wa_fpla with key vbeln = wa_data-vbeln.
              if sy-subrc = 0.
            if wa_data-check = 'X'.
               read table it_fplt into wa_fplt index rs_selfield-tabindex.
                if sy-subrc = 0.
                  update fplt
                         set faksp = ' '
                     where fplnr = wa_fplt-fplnr and fkdat = wa_fplt-fkdat.
                endif.
              endif.
            endif.
          endloop.
    Regards.

    Hi Nikhil,
    u need to use this fm to capture the changes done in the checbox 'GET_GLOBALS_FROM_SLVC_FULLSCR' and this method check_data_changed....
    check this sample code
    FORM user_command USING r_ucomm TYPE sy-ucomm
                        rs_selfield TYPE slis_selfield  .
      DATA:p_valid,
            l_repid TYPE sy-repid.
      MOVE: sy-repid TO l_repid.
      CASE r_ucomm .
        WHEN 'EXEC' .
          REFRESH: it_smart.
          CLEAR p_ref1.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              e_repid = l_repid
              e_grid  = p_ref1.
          CALL METHOD p_ref1->check_changed_data
            IMPORTING
              e_valid = p_valid.
          LOOP AT it_output INTO wa_output WHERE cbox EQ 'X'.
            READ TABLE it_mard INTO wa_mard WITH KEY matnr = wa_output-matnr werks = wa_output-werks lgort = wa_output-lgort.
            IF sy-subrc EQ 0.
              wa_smart-lgpbe = wa_mard-lgpbe.
            ENDIF.
            wa_smart-matnr =  wa_output-matnr.
            wa_smart-maktx =  wa_output-maktx.
            READ TABLE it_meins INTO wa_meins WITH  KEY matnr = wa_output-matnr.
            IF sy-subrc EQ 0.
              wa_smart-meins = wa_meins-meins.
            ENDIF.
    *        wa_smart-meins =  wa_output-meins.
            wa_smart-bldat =  wa_output-bldat.
            wa_smart-no_cop = wa_output-menge.
            APPEND wa_smart TO it_smart.
            CLEAR: wa_smart,wa_output.
          ENDLOOP.

  • How to handle the check box in the alv tree display

    Hello,
    in my ALV Tree Report i have a check box in the output.
    I have one check box in the selection screen as select all .
    if this is selected then all the check boxes in the output must be selected that is (X).
    am using CL_GUI_ALV_TREE  for this.
    Please give me some input how to make that check boxes 'X' in the above mentioned case.
    With Regards,
    Sumodh.P

    Sumodh,
    check this
    Re: Select all checkbox in ALV tree
    please search before posting
    Thanks
    Bala Duvvuri

  • Datagrid Checkbox - Select All Headerrenderer

    i have a datagrid that utilizes an itemrenderer and headerrender for the same column to have checkboxes and also a select all checkbox in the column header...as such:
    <mx:DataGrid width="100%" height="100%" id="dg" dataProvider="{employees}" sortableColumns="false"
                                draggableColumns="false">
                                <mx:columns>
                                    <mx:DataGridColumn width="30" textAlign="center">
                                        <mx:headerRenderer>
                                            <mx:Component>
                                                <mx:CheckBox/>
                                            </mx:Component>
                                        </mx:headerRenderer>
                                        <mx:itemRenderer>
                                            <mx:Component>
                                                <mx:CheckBox selected="{(data.@isSelected == 'true')?true:false}" click="{data.@isSelected = (data.@isSelected != 'true') ? 'true' : 'false';}"/>
                                            </mx:Component>
                                        </mx:itemRenderer>
                                    </mx:DataGridColumn>
                                    <mx:DataGridColumn headerText="Item ID" dataField="@id" width="60"/>
                                    <mx:DataGridColumn headerText="Date" dataField="@date" width="85"/>
                                </mx:columns>
                            </mx:DataGrid>
    my XMLList is as follows (that populates the datagrid):
    <mx:XMLList id="employees">
            <request id="720" date="Aug 21 09" isSelected="false"/>
            <request id="721" date="Aug 21 09" isSelected="false"/>
            <request id="722" date="Aug 21 09" isSelected="false"/>
            <request id="723" date="Aug 21 09" isSelected="false"/>
    </mx:XMLList>
    Now, if I select a rows checkbox, it works fine and updates the XMLList with the new value of isSelected for that row.
    My question is this: how do I make it so that clicking on the checkbox inside the headerrenderer selects all the checkboxes in the itemrenderer?  I know that Flex doesn't build rows that are not in view yet, so what needs to happen here in order to a) select the itemrenderer checkboxes and b) update the related XMLList so all isSelected update to either true/false.
    Thanks!

    Thanks for putting me on the right track for this...quick question:
    My arrayCollection looks like this:
    [Bindable]
    private var myAC:ArrayCollection = new ArrayCollection([
        {id:1, date: 'Bob Jones', isSelected: true},
        {id:2, date: 'Jane Smith', isSelected: true},   
        {id:3, date: 'Doug Johnson', isSelected: false},
        {id:4, date: 'Bob Jones', isSelected: true},
        {id:5, date: 'Jane Smith', isSelected: true},   
        {id:6, date: 'Doug Johnson', isSelected: false},
        {id:7, date: 'Bob Jones', isSelected: true},
        {id:8, date: 'Jane Smith', isSelected: true},   
        {id:9, date: 'Doug Johnson', isSelected: false},      
    And the datagrid displays this correctly, so no problems there.
    Now, I have a function that gets called when the checkbox in the header is selected, but am stuck here as to how to update all of the isSelected values in myAC to true.
    This is what I tried with no success...any thoughts?
    public function checkAll():void {
        for(var i:int=0; i < myAC.length; i++){
            myAC.itemUpdated(myAC.getItemAt(i).isSelected, false, true);
    Thanks!

  • 'Select ALL' not working for WD ABAP ALV

    Hi all,
    I have a web dynpro application with a tab strip with 9 tabs. Each tab has an ALV embedded in it. Each ALV is mapped to the same  node in component controller. When the application is executed 'Select ALL' works for first ALV on the first tab. However if i select a different tab i get the select all option on the left hand corner but it does nothing when chosen.
    I also tried creating custom button on ALV toolbar for this functinality. Here i am looping over all elements of the node (bound to ALV) and using method  set_selected( abap_true ) ( method of if_wd_context_element ). This also works for first ALV on the
    first tab. However again get the same issue if i choose any other tab.
    Node cardinality : 0.... n
    Node selection :  0.....n
    ALV selection mode set to MULTI using method SET_SELECTION_MODE( CL_WD_TABLE=>E_SELECTION_MODE-MULTI ) of cofig class cl_salv_wd_config_table.
    All your inputs/suggestions to resolve this issue will be greatly appreciated.
    Thanks,
    Vivek Priyadarshi

    Hi Aditya,
    Thanks for your reply. I am using 9 comp. usage of SALV_WD_TABLE to display 9 alv and all are mapped to the same comp. controller context node. The context node has the master structure with all fields, based on the chosen tab i am populating this context node with records and setting config model for ALV accordingly.
    I tried your trick, clicked on select all on first ALV (all records chosen, works correctly here) then chose the second tab on tabstrip, however records in the new (second) ALV were not selected. When i clicked 'Select all' it did nothing, no records were chosen ( original issue ).
    Did you invalidate the common node when you navigate between tabs?In my case i am populating this node with new data every time i navigate between tabs.
    One new thing i noticed. On the first tab i am able to select individual rows by clicking on the row selection buttons on the left edge of every row. However when i go the second tab clicking on row selection button it does not get selected, only way to select a row in this case is by doing CLTR+click, something doesn't feel right about this application.
    I am going to create a new context node to check if sharing a common context node is causin this issue.
    -Vivek

  • Drop down list in alv tree

    Hi,
    I am developing an ALV TREE. I need help Its really urgent. In the output screen there will be 2 level nodes. in the item line 1 field should be input enabled using which the database table is to be modified.when user left clicks on this field a drop down list will appear from which he selects his choice.
    I looked into BCALV_TREE_SIMPLE_DEMO reports available in SAP.
    I would also like to know what is register_events, what is an handler.
    help me.
    Edited by: Sudipa Das on Oct 4, 2008 11:53 AM
    Edited by: Sudipa Das on Oct 4, 2008 11:53 AM
    Edited by: Sudipa Das on Oct 4, 2008 11:54 AM

    Hello Sudipa
    I do not think you can have editable fields other than checkboxes in ALV trees. In sample report ZUS_SDN_ALV_TREE_DEMO_1 I have set the fieldcatalog property LS_FCAT-EDIT = 'X' for all fields yet only LOEVM is editable because it is defined as checkbox, too.
    However, you may use the LINK_CLICK of the ALV tree (set LS_FCAT-HOTSPOT = 'X' in fieldcatalog) to trigger e.g. a seach help for input.
    *& Report  ZUS_SDN_ALV_TREE_DEMO
    *& Thread: drop down list in alv tree
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1074082"></a>
    *& Thread: alv tree checbox problem when attempt to get the selected checjboxes
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1050473"></a>
    *& Thread: alv tree checkbox problem
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1046535"></a>
    *& Thread: double click in ALV tree output????
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="742412"></a>
    *& Flow logic of screen '0100' (contains no screen elements):
    **  PROCESS BEFORE OUTPUT.
    **    MODULE STATUS_0100.
    **  PROCESS AFTER INPUT.
    **    MODULE USER_COMMAND_0100.
    *& user-command (for command window): DISPLAY, SELECTED_NODES
    REPORT  zus_sdn_alv_tree_demo_1.
    CLASS cl_gui_column_tree DEFINITION LOAD.
    CLASS cl_gui_cfw DEFINITION LOAD.
    TYPE-POOLS: abap, shlp.
    TYPES: BEGIN OF ty_s_key.
    TYPES: nkey       TYPE lvc_nkey.
    TYPES: parent_key TYPE lvc_nkey.
    TYPES: END OF ty_s_key.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knvv AS data.
    INCLUDE TYPE ty_s_key AS key.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA: gt_outtab    TYPE ty_t_outtab.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syst-repid,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_tree          TYPE REF TO cl_gui_alv_tree.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
        handle_node_double_click
          FOR EVENT node_double_click OF cl_gui_alv_tree
          IMPORTING node_key,
        handle_item_double_click
          FOR EVENT item_double_click OF cl_gui_alv_tree
          IMPORTING node_key
                    fieldname,
        handle_checkbox_change
          FOR EVENT checkbox_change OF cl_gui_alv_tree
          IMPORTING checked
                    fieldname
                    node_key,
        handle_link_click
          FOR EVENT link_click OF cl_gui_alv_tree
          IMPORTING fieldname
                    node_key.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_node_double_click.
        MESSAGE 'Event=Double-Click on Node' TYPE 'I'.
        CALL TRANSACTION 'XD03'.
      ENDMETHOD.                    "handle_node_double_click
      METHOD handle_item_double_click.
        MESSAGE 'Event=Double-Click on Item' TYPE 'I'.
        CALL TRANSACTION 'VA03'.
      ENDMETHOD.                    "handle_item_double_click
      METHOD handle_checkbox_change.
        DATA: ls_outtab     TYPE ty_s_outtab.
        BREAK-POINT.
        IF ( fieldname = 'LOEVM' ).
          CALL METHOD go_tree->get_outtab_line
            EXPORTING
              i_node_key     = node_key
            IMPORTING
              e_outtab_line  = ls_outtab
    *          e_node_text    =
    *          et_item_layout =
    *          es_node_layout =
            EXCEPTIONS
              node_not_found = 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.
          ls_outtab-loevm = checked.
          MODIFY gt_outtab FROM ls_outtab
            TRANSPORTING loevm
            WHERE ( nkey = node_key ).
        ENDIF.
        " Trigger PAI
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'REFRESH'
    *        IMPORTING
    *          rc       =
      ENDMETHOD.                    "handle_checkbox_change
      METHOD handle_link_click.
        data: ls_shlp         type SHLP_DESCR,
              lt_retvalues    type STANDARD TABLE OF DDSHRETVAL.
        BREAK-POINT.
        CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
          EXPORTING
            shlpname       = 'USER_COMP'
    *       SHLPTYPE       = 'SH'
          IMPORTING
            SHLP           = ls_shlp.
        CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
          EXPORTING
            shlp                = ls_shlp
    *       DISPONLY            = ' '
    *       MAXRECORDS          = 500
    *       MULTISEL            = ' '
    *       CUCOL               = SY-CUCOL
    *       CUROW               = SY-CUROW
    *     IMPORTING
    *       RC                  =
          tables
            return_values       = lt_retvalues.
      ENDMETHOD.                    "handle_link_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      PERFORM init_controls.
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      container                   =
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          lifetime_dynpro_dynpro_link = 3
          OTHERS                      = 4.
      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 SCREEN '0100'.
    ** NOTE: no elements on screen
    **  PROCESS BEFORE OUTPUT.
    **    MODULE STATUS_0100.
    **  PROCESS AFTER INPUT.
    **    MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      TRANSLATE gd_okcode TO UPPER CASE.
      CASE gd_okcode.
        WHEN 'BACK'  OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'REFRESH'.
          CALL METHOD go_tree->update_calculations
    *        EXPORTING
    *          no_frontend_update =
        WHEN 'SELECTED_NODES'.
          PERFORM get_selected_nodes.
        WHEN 'DISPLAY'.
          PERFORM display.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  init_controls
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          OTHERS = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * create tree control
      CREATE OBJECT go_tree
        EXPORTING
          parent                      = go_docking
          node_selection_mode         = cl_gui_column_tree=>node_sel_mode_multiple
          item_selection              = 'X'  " required for double-click event on item
          no_html_header              = ''
          no_toolbar                  = ''
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    * create Hierarchy-header
      DATA ls_hierarchy_header TYPE treev_hhdr.
      PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
    * create emty tree-control
      CALL METHOD go_tree->set_table_for_first_display
        EXPORTING
    **      i_structure_name     = 'KNVV'
          is_variant           = gs_variant
          i_save               = 'A'
    *      i_default            = 'X'
          is_hierarchy_header  = ls_hierarchy_header
    *      is_exception_field   =
    *      it_special_groups    =
    *      it_list_commentary   =
    *      i_logo               =
    *      i_background_id      =
    *      it_toolbar_excluding =
    *      it_except_qinfo      =
        CHANGING
          it_outtab            = gt_outtab
    *      it_filter            =
          it_fieldcatalog      = gt_fcat.
    * create hierarchy
      PERFORM create_hierarchy.
    * register events
      PERFORM register_events.
    * adjust column_width
      CALL METHOD go_tree->column_optimize.
    ENDFORM.                    " init_controls
    *&      Form  build_hierarchy_header
    *       build hierarchy-header-information
    *      -->P_L_HIERARCHY_HEADER  strucxture for hierarchy-header
    FORM build_hierarchy_header CHANGING
                                   p_hierarchy_header TYPE treev_hhdr.
      p_hierarchy_header-heading = 'Hierarchy Header'.          "#EC NOTEXT
      p_hierarchy_header-tooltip =
                             'This is the Hierarchy Header !'.  "#EC NOTEXT
      p_hierarchy_header-width = 30.
      p_hierarchy_header-width_pix = ''.
    ENDFORM.                               " build_hierarchy_header
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog .
      DATA: ls_fcat   TYPE lvc_s_fcat.
      REFRESH: gt_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNVV'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
          i_bypassing_buffer           = 'X'
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      DELETE gt_fcat FROM 10.
      ls_fcat-tech = 'X'.
      MODIFY gt_fcat FROM ls_fcat
        TRANSPORTING tech
        WHERE ( key = 'X' ).
      ls_fcat-edit = 'X'.
      MODIFY gt_fcat FROM ls_fcat
        TRANSPORTING edit
        WHERE ( key NE 'X' ).
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'LOEVM'.
      IF ( syst-subrc = 0 ).
        ls_fcat-checkbox = 'X'.
        ls_fcat-edit     = 'X'.
    **    ls_fcat-hotspot  = 'X'.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDIF.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'ERNAM'.
      IF ( syst-subrc = 0 ).
        ls_fcat-hotspot  = 'X'.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDIF.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'TREE'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  create_hierarchy
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM create_hierarchy .
      DATA: ls_knvv     TYPE sflight,
            ld_idx      TYPE i,
            ls_outtab   TYPE ty_s_outtab,
            lt_outtab   TYPE ty_t_outtab.
    * get data
      SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE lt_outtab
                            UP TO 20 ROWS .                 "#EC CI_NOWHERE
      SORT lt_outtab BY kunnr vkorg.
    * add data to tree
      DATA: ld_root_key  TYPE lvc_nkey,
            ld_kunnr_key TYPE lvc_nkey,
            ld_vkorg_key TYPE lvc_nkey,
            ld_last_key  TYPE lvc_nkey.
      ld_idx = 0.
      LOOP AT lt_outtab INTO ls_outtab.
        AT FIRST.
          PERFORM add_root_line USING    ls_outtab-data
                                  CHANGING ld_root_key.
          ADD 1 TO ld_idx.
          ls_outtab-nkey       = ld_root_key.
          ls_outtab-parent_key = space.
          MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
            TRANSPORTING key.
        ENDAT.
        ON CHANGE OF ls_outtab-kunnr.
          PERFORM add_customer_line USING    ls_outtab-data
                                             ld_root_key
                                  CHANGING ld_kunnr_key.
          ADD 1 TO ld_idx.
          ls_outtab-nkey       = ld_kunnr_key.
          ls_outtab-parent_key = ld_root_key.
          MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
            TRANSPORTING key.
        ENDON.
        ON CHANGE OF ls_outtab-vkorg.
          PERFORM add_salesorg_line USING    ls_outtab-data
                                             ld_kunnr_key
                                  CHANGING ld_vkorg_key.
          ADD 1 TO ld_idx.
          ls_outtab-nkey       = ld_vkorg_key.
          ls_outtab-parent_key = ld_kunnr_key.
          MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
            TRANSPORTING key.
        ENDON.
        PERFORM add_complete_line USING  ls_outtab-data
                                         ld_vkorg_key
                                CHANGING ld_last_key.
        ADD 1 TO ld_idx.
        ls_outtab-nkey       = ld_last_key.
        ls_outtab-parent_key = ld_vkorg_key.
        MODIFY gt_outtab FROM ls_outtab INDEX ld_idx
          TRANSPORTING key.
      ENDLOOP.
    * calculate totals
      CALL METHOD go_tree->update_calculations.
    * this method must be called to send the data to the frontend
      CALL METHOD go_tree->frontend_update.
    ENDFORM.                    " create_hierarchy
    *&      Form  add_customer_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_root_line USING     us_data TYPE ty_s_outtab-data
                                 ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@3Q@'.  " icon_overview
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  'Overview: Sales Areas'.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_root_line
    *&      Form  add_customer_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_customer_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@A0@'.  " icon_customer.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-kunnr.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_customer_line
    *&      Form  add_salesorg_line
    *       add hierarchy-level 1 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_salesorg_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value,
            ls_data TYPE ty_s_outtab-data.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-t_image = '@DS@'.  " ICON_PARTNER_SALES_ACTIVITY
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-style   =
                            cl_gui_column_tree=>style_intensifd_critical.
      APPEND ls_item_layout TO lt_item_layout.
    * add node
      l_node_text =  us_data-vkorg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = l_node_text
          is_outtab_line   = ls_data
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_salesorg_line
    *&      Form  add_cmplete_line
    *       add hierarchy-level 3 to tree
    *      -->P_LS_SFLIGHT  sflight
    *      -->P_RELEATKEY   relatkey
    *     <-->p_node_key    new node-key
    FORM add_complete_line USING     us_data TYPE ty_s_outtab-data
                                     ud_relat_key TYPE lvc_nkey
                         CHANGING  cd_node_key TYPE lvc_nkey.
      DATA: l_node_text TYPE lvc_value.
    * set item-layout
      DATA: lt_item_layout TYPE lvc_t_layi,
            ls_item_layout TYPE lvc_s_layi.
      ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
      ls_item_layout-editable = 'X'.
      APPEND ls_item_layout TO lt_item_layout.
    **  clear: ls_item_layout.
    **  ls_item_layout-fieldname = 'BEGRU'.
    **  ls_item_layout-class   = cl_gui_column_tree=>ITEM_CLASS_CHECKBOX.
    **  ls_item_layout-editable = 'X'.
    **  APPEND ls_item_layout TO lt_item_layout.
    **  CLEAR ls_item_layout.
    **  ls_item_layout-fieldname = 'PLANETYPE'.
    **  ls_item_layout-alignment = cl_gui_column_tree=>align_right.
    **  APPEND ls_item_layout TO lt_item_layout.
      l_node_text =  us_data-vtweg.
      DATA: ls_node TYPE lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
      CALL METHOD go_tree->add_node
        EXPORTING
          i_relat_node_key = ud_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = us_data
          i_node_text      = l_node_text
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        IMPORTING
          e_new_node_key   = cd_node_key.
    ENDFORM.                               " add_complete_line
    *&      Form  register_events
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM register_events.
    * define the events which will be passed to the backend
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
    * define the events which will be passed to the backend
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
      APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_header_click.
    **  APPEND l_event TO lt_events.
    **  l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
    **  APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_link_click.
      APPEND l_event TO lt_events.
      CALL METHOD go_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
    * set Handler
      SET HANDLER:
        lcl_eventhandler=>handle_node_double_click FOR go_tree,
        lcl_eventhandler=>handle_item_double_click FOR go_tree,
        lcl_eventhandler=>handle_checkbox_change   FOR go_tree,
        lcl_eventhandler=>handle_link_click        FOR go_tree.
    **  DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
    **  CREATE OBJECT l_event_receiver.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_node_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_request
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_item_ctmenu_selected
    **                                                        FOR tree1.
    **  SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
    ENDFORM.                               " register_events
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display .
      DATA: ls_outtab   TYPE ty_s_outtab,
            ls_line     TYPE ty_s_outtab,
            ld_msg      TYPE bapi_msg.
      BREAK-POINT.
      LOOP AT gt_outtab INTO ls_outtab
              WHERE ( loevm = 'X' ).
        CONCATENATE 'Checkbox:'
                    ls_outtab-kunnr
                    ls_outtab-vkorg
                    ls_outtab-vtweg
                    ls_outtab-spart
                    ls_outtab-loevm
          INTO ld_msg SEPARATED BY space.
        MESSAGE ld_msg TYPE 'I'.
      ENDLOOP.
      IF ( syst-subrc NE 0 ).
        MESSAGE 'No marked checkboxes found' TYPE 'I'.
      ENDIF.
      PERFORM get_selected_nodes.
    ENDFORM.                    " DISPLAY
    *&      Form  GET_SELECTED_NODES
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_selected_nodes.
    * define local data
      DATA: ld_msg        TYPE bapi_msg,
            lt_nodes      TYPE lvc_t_nkey,
            ls_outtab     TYPE ty_s_outtab,
            ld_nkey       TYPE lvc_nkey,
            lt_items      TYPE lvc_t_layi,
            ls_item       TYPE lvc_s_layi.
      CALL METHOD go_tree->get_selected_nodes
        CHANGING
          ct_selected_nodes = lt_nodes
        EXCEPTIONS
          cntl_system_error = 1
          dp_error          = 2
          failed            = 3
          OTHERS            = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CHECK ( lt_nodes IS NOT INITIAL ).
      BREAK-POINT.
      LOOP AT lt_nodes INTO ld_nkey.
        CALL METHOD go_tree->get_outtab_line
          EXPORTING
            i_node_key     = ld_nkey
          IMPORTING
            e_outtab_line  = ls_outtab-data
    *        e_node_text    =
            et_item_layout = lt_items
    *        es_node_layout =
          EXCEPTIONS
            node_not_found = 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.
        LOOP AT lt_items INTO ls_item
                         WHERE ( chosen = 'X' ).
          CONCATENATE 'Item:'
                      ls_outtab-kunnr
                      ls_outtab-vkorg
                      ls_outtab-vtweg
                      ls_outtab-spart
                      ls_outtab-loevm
            INTO ld_msg SEPARATED BY space.
          MESSAGE ld_msg TYPE 'I'.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    " GET_SELECTED_NODES
    Regards
      Uwe

Maybe you are looking for

  • How can I reduce video file size?

    I have a WMV file (4.6 MB) that has a bad sound track. I started a new Premiere project and placed the MP4 file, split the audio track, and used Audition to fix the problems with the sound. Then I opened the file in Media Encoder (2014) and I've trie

  • File size in Aperture

    I am a new Aperture user.  When I try to attach photos from Aperture to an email, the file size is significantly decreased (5.4 MB down to 617 KB).  This does not happen in iPhoto.  I tried "exporting" to the desktop in original size and then attachi

  • Will not search for a word in pdf file. Using Windows 7

    Like most I have used Acrobat reader for viewing PDF files for years.  I recently upgraded to Windows 7 from XP.  I have tried to search a PDF file for a word and it always comes up with none found even though I search for a word that is displayed in

  • How do I create a paginated pdf from Indd?

    Hello, Can somebody please tell me how to create a paginated pdf from Indesign CC? it used to be so simple to "print a booklet" as a ps, and then distill it. Now I can't seem to do that anymore

  • Activation of sub-totals button in ALV grid

    hi experts Execute the module pool program BCALV_GRID_DEMO .in the o/p screen - how to activate the subtotals button explicitly.