Skip to Content
author's profile photo Former Member
Former Member

ALV TREE-Checkbox

Hello folks,

After having built the tree, I am trying to set the checkbox to 'X' (i.e. marked) via the ABAP-program (not from screen), unfortunately to no avail.

The used technique is the checkbox-functionality, which is controlled by structure LVC_S_LACI and not by the field catalogue.

For example:

data: ls_layout_item type lvc_s_laci,

  • fill checkbox data

clear ls_layout_item.

ls_layout_item-fieldname = 'CHECKBOX'.

ls_layout_item-class = cl_gui_column_tree=>item_class_checkbox.

ls_layout_item-editable = 'X'.

ls_layout_item-u_class = 'X'.

ls_layout_item-u_editable = 'X'.

append ls_layout_item to lt_layout_item.

  • add node with checkbox

call method p_tree->add_node

exporting

i_relat_node_key = l_connid_key

i_relationship = cl_gui_column_tree=>relat_last_child

is_outtab_line = ls_outtab

i_node_text = l_node_text

is_node_layout = l_layout_leaf

it_item_layout = lt_layout_item.

When adding a node I can set the checkbox to marked by setting field 'CHOSEN' of structure 'LVC_S_LACI' to 'X'. But I have not yet succeeded to set the checkbox of an existing node to 'X'.

  • First try:

I set the checkbox to X and called method 'UPDATE_NODE' . As a result I got an X right to the checkbox, which inself remained unmarked.

  • Second try:

I filled the interface table ' IT_ITEM_LAYOUT' with data, set field 'CHOOSEN' to 'X' and called method 'CHANGE_ITEM'. But this does not work either.

I would be very happy if someone could help me in this matter.

Fouad Sebbane

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2004 at 03:28 AM

    Hi Karsten/Fouad,

    * fill checkbox data
    clear ls_layout_item.
    <b>ls_layout_item-fieldname = 'CHECKBOX'.</b>
    ls_layout_item-class = cl_gui_column_tree=>item_class_checkbox.
    ls_layout_item-editable = 'X'.
    ls_layout_item-u_class = 'X'.
    ls_layout_item-u_editable = 'X'.
    append ls_layout_item to lt_layout_item.
    

    In which internal table , do you have this field 'CHECKBOX' ?

    Try putting an 'X' in the field 'CHECKBOX' of the internal table, that you are using.

    Let us know, if it works.

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 07, 2004 at 11:22 AM

    Hi,

    the field 'CHECKBOX' is used in the internal Output table of the tree.

    I tried already that what you proposed and it did not work.

    Thanks,

    Fouad

    Add a comment
    10|10000 characters needed characters exceeded

    • Fouad Sebbane Durairaj Athavan Raja

      Hallo Raja,

      i tried as follow:

      I used the class cl_gui_alv_grid. In this class there is the protected varialbe object 'mr_column_tree'.

      I created a new class 'lcl_grid' and added the method 'set_checkbox_chosen'.

      Example:

      class lcl_tree definition inheriting from cl_gui_alv_tree.

      public section.

      .....

      method set_checkbox_chosen

      importing

      i_node_key type tv_nodekey

      i_item_name type tv_itemname

      i_chosen type as4flag.

      .....

      endclass.

      class lcl_tree implementation.

      method set_checkbox.

      call method me->mr_column_tree->item_set_chosen

      exporting

      node_key = i_node_key

      item_name = i_item_name

      chosen = i_chosen

      exceptions

      Failed = 1

      node_not_found = 2

      item_not_found = 3

      cntl_system_error = 4

      chosen_not_supported = 5

      others = 6.

      endmethod.

      After calling the method 'set_checkbox', i called the method 'frontend_update'.

      A message popup (Gui Control) with the following Information appears:

      Column not found

      LastError node key: 5

      LastError item name: CHECKBOX

      the node_key 5 however exists!

      Thanks,

      Fouad

  • author's profile photo Former Member
    Former Member
    Posted on Dec 16, 2004 at 02:09 PM

    Hello... did you solve this? "change_item" should work... it works here!

    Sample code:

    data: ls_laci TYPE lvc_s_laci,

    lv_child TYPE lvc_nkey.

    " ... get node key into lv_child

    ls_laci-fieldname = cl_alv_tree_base=>c_hierarchy_column_name.

    ls_laci-chosen = l_x. " " 'X'=checked, ' '=unchecked

    ls_laci-u_chosen = 'X'.

    CALL METHOD me->change_item

    EXPORTING i_node_key = lv_child

    i_fieldname = cl_alv_tree_base=>c_hierarchy_column_name

    i_data = ''

    i_u_data = ''

    is_item_layout = ls_laci.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.