6 Replies Latest reply: Jul 23, 2008 8:49 AM by Rick Weigel RSS

ALV Tree with checked checkboxes

Rick Weigel
Currently Being Moderated

Hello colleagues,

 

I have built a ALV Tree with checkboxes.While running the ALV Tree it is no problem to retrieve all checked items from the object "CL_GUI_ALV_TREE".

(With the method GET_CHECKED_ITEMS)

 

But no I have the situation that some items have to checked when you START the ALV Tree. Unfortunately I do not find a method like "SET_CHECKED_ITEMS"...

Can you please help me?

 

Thanks a lot.

Best regards,

Rick

 

Edited by: Rick Weigel on Jul 22, 2008 8:57 AM

  • Re: ALV Tree with checked checkboxes
    Prabhu Peram
    Currently Being Moderated

    Hi ,

     

    how u are creating Tree with check Boxex ? ,y i am asking is , in the same way u can give Value for that check boxes.

     

     

    Regards

    Prabhu

  • Re: ALV Tree with checked checkboxes
    Sendil kumar
    Currently Being Moderated

    There are some sample programs provided by SAP on OOPS ALV.

    Check it in SE38:BCALV_EDIT_05.

     

    if it is helpful to you,then reward...

    Thanks,

    Sendil

  • Re: ALV Tree with checked checkboxes
    Rick Weigel
    Currently Being Moderated

    Hello colleagues,

     

    Thanks a lot for your help, but unfortunately I have not solved the problem :-(.

     

    It is no problem to get the information if a checkbox is check or which item is checked.

    The issue is, that I do not find out how to check a checkbox at the beginning of starting a report.

    If I take you example report BCALV_EDIT_05, it is not possible to check a checkbox before running this report. It is only possible to check the checkboxes during running.

     

    Best regards,

    Rick

  • Re: ALV Tree with checked checkboxes
    Narendran Muthukumaran
    Currently Being Moderated

    Hi,

     

    Try this..

     

    there is a proctected method UPDATE_CHECKED_ITEMS..using which you can use set the check box..

     

    To call this method in your program..do the following..

     

    Create a z class in your program by Inheriting the ALV TREE class CL_GUI_ALV_TREE..

     

    Then create a method in your Z class and then call the UPDATE_CHECKED_ITEMS method in that method..

     

    Hope I am clear..

     

    Thanks

    Naren

  • Re: ALV Tree with checked checkboxes
    Uwe Schieferstein
    Currently Being Moderated

    Hello Rick

     

    To create an entire new class for such a simple problem is an overkill. Take the sample report BCALV_TREE_DEMO. Routine ADD_COMPLETE_LINE adds the lines to the ALV tree containing the checkbox. Here you have to add a single statement:

     

    *&---------------------------------------------------------------------*
    *&      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   ps_sflight type sflight
                                   p_relat_key type lvc_nkey
                         changing  p_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 = tree1->c_hierarchy_column_name.
      ls_item_layout-class   = cl_gui_column_tree=>item_class_checkbox.
      ls_item_layout-editable = 'X'.
      ls_item_layout-chosen   = 'X'.  " <<<< That's all.
      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 =  ps_sflight-fldate.
    
      data: ls_node type lvc_s_layn.
      ls_node-n_image   = space.
      ls_node-exp_image = space.
    
      call method tree1->add_node
        exporting
          i_relat_node_key = p_relat_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          is_outtab_line   = ps_sflight
          i_node_text      = l_node_text
          is_node_layout   = ls_node
          it_item_layout   = lt_item_layout
        importing
          e_new_node_key   = p_node_key.
    endform.                               " add_complete_line

     

    Of course you need to add your logic which nodes should be marked and which not.

     

    Regards

      Uwe

  • Re: ALV Tree with checked checkboxes
    Rick Weigel
    Currently Being Moderated

    Hello Uwe,

     

    thanks a lot, that's the coding which I am searching

     

    Best regards,

    Rick

     

    Edited by: Rick Weigel on Jul 23, 2008 8:49 AM

Actions