Application Development and Automation 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: 
Read only

Simple Tree Model Control Not Getting Data Refresh

Former Member
0 Likes
797

Hi All,

I am using SAP Simple Tree Model ,( Class CL_SIMPLE_TREE_MODEL ) to create a simple tree hierarchy .The hierarchy is populated based on some input from the user in the previous screen .So what happens is if a user select a node and goes back and changes the selection criteria tree hierarchy should also be refreshed but it is not happening .I have already called the

customer_container->free method and recreating the object again .

4 REPLIES 4
Read only

Former Member
0 Likes
608

Hi,

Can you put the code snippet, it will help to analyze the problem better.

Regards

Senthil

Read only

Former Member
0 Likes
608

Hi All,

There are 2 GUI screens :

Screen 1 ) User selects an hierarchy based on which the hierarchy is populated on Screen 2.

Screen 2) On the basis of the hierarchy selected on the first screen the tree is populated on the second screen .

create object gv_application.

DATA: lv_event TYPE cntl_simple_event,

lv_events TYPE cntl_simple_events.

  • create a container for the tree control

CREATE OBJECT gv_custom_container_resp

EXPORTING " the container is linked to the custom control with the

" name 'TREE_CONTAINER' on the dynpro

container_name = 'TREE_CONTAINER'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

IF sy-subrc <> 0.

  • message a001.

ENDIF.

  • create a simple tree model instance

CREATE OBJECT gv_tree

EXPORTING

node_selection_mode = cl_simple_tree_model=>node_sel_mode_single

EXCEPTIONS

illegal_node_selection_mode = 1.

IF sy-subrc <> 0.

  • message a001.

ENDIF.

  • create the view (control) of the tree model

CALL METHOD gv_tree->create_tree_control

EXPORTING

parent = gv_custom_container_resp

EXCEPTIONS

lifetime_error = 1

cntl_system_error = 2

create_error = 3

failed = 4

tree_control_already_created = 5.

IF sy-subrc <> 0.

  • message a001.

ENDIF.

  • define the events which will be passed to the backend

" node double click

lv_event-eventid = cl_simple_tree_model=>eventid_node_double_click.

lv_event-appl_event = 'X'. " process PAI if event occurs

APPEND lv_event TO lv_events.

CALL METHOD gv_tree->set_registered_events

EXPORTING

events = lv_events

EXCEPTIONS

illegal_event_combination = 1

unknown_event = 2.

IF sy-subrc <> 0.

  • message a001.

ENDIF.

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

SET HANDLER gv_application->handle_node_double_click FOR gv_tree.

  • add nodes to the tree model

PERFORM add_nodes.

Read only

Former Member
0 Likes
608

Hi ,

clear gv_tree as well . it should work .

Edited:

hi ,

im not sure at what point of time your are clearing fields.

but you have to clear those variable at exit command,please check SAP sample programs...


PAI:

WHEN 'BACK' 'CANCEL' or 'EXIT'.
  clear :gv_custom_container_resp
          call method gv_custom_container_resp->free
          exceptions
            cntl_system_error = 1
            cntl_error        = 2.
        if sy-subrc <> 0.
          message a000.
        endif.
 clear gv_tree.
  leave screen.

regards

Prabhu

Edited by: Prabhu Peram on Nov 9, 2011 10:02 AM

Read only

Former Member
0 Likes
608

I have already done that.I read on help.sap.com on SAP tree model that SAP tree model control buffers the data .Can anyone help me if we can explicitly clear this buffer because to me it looks like a buffer issue .