Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle check box events in alv tree.

srajendran
Explorer
0 Kudos

hi,

i am working in CL_GUI_COLUMN_TREE class.Also using Check box. Now i want to handle events for check box . I am new to ABAP Objects.

Pls expaline in detail or send code

thanks in advance,

senthil kumar.r

5 REPLIES 5

Former Member
0 Kudos

Hi Senthil,

Refer sample prog:

BCALV_TREE_VERIFY

Also Example:

DATA: lt_item_layout TYPE lvc_t_layi,

ls_item_layout TYPE lvc_s_layi,

v_alv type ref to cl_gui_alv_tree.

ls_item_layout-fieldname =v_alv->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.

Reward points if this Helps.

Manish

0 Kudos

hi Manish Kumar ,

here my question is , suppose if i selected a check box of one node , it should check all items in the same node. how to handle?

Thanks

senthil kumar.r

uwe_schieferstein
Active Contributor
0 Kudos

Hello Senthil

Have a look at the sample report

SAPCOLUMN_TREE_CONTROL_DEMO

. The crucial points are:

<b>(1) Register the required events at the control</b>

* define the events which will be passed to the backend
...
  " checkbox change
  event-eventid = CL_GUI_COLUMN_TREE=>EVENTID_checkbox_change.
  event-appl_event = 'X'.
  append event to events.
...


  CALL METHOD G_TREE->SET_REGISTERED_EVENTS
    EXPORTING
      EVENTS = EVENTS
    EXCEPTIONS
      CNTL_ERROR                = 1
      CNTL_SYSTEM_ERROR         = 2
      ILLEGAL_EVENT_COMBINATION = 3.
  IF SY-SUBRC <> 0.
    MESSAGE A000.
  ENDIF.

<b>(2) Set the event handler</b>

  • assign event handlers in the application class to each desired event

...
  SET HANDLER G_APPLICATION->HANDLE_CHECKBOX_CHANGE FOR g_tree.
...

<b>(3) Define and implement event handler method</b>

  METHOD  HANDLE_CHECKBOX_CHANGE.
    " this method handles the checkbox_change event of the tree
    " control instance

    " show the key of the node and the name of the item
    " of the clicked checkbox in a dynpro field
    G_EVENT = 'CHECKBOX_CHANGE'.
    G_NODE_KEY = NODE_KEY.
    G_ITEM_NAME = ITEM_NAME.
    CLEAR  G_HEADER_NAME.
  ENDMETHOD.

Regards

Uwe

0 Kudos

hi Uwe Schieferstein ,

i applied all your code. still it is not working.

thanks

senthil

Former Member
0 Kudos

Hi Senthil,

When you check the higher node, then you should be able to get all the child nodes. Just check if the Parent node is checked 'X' then, update the child node accordingly.

Hope this helps.

Manish