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

ALV TREE refreshing problem

Former Member
0 Likes
784

Hello,

In my program I have to screen, the first one displays some lines of documents which I give the option to choose one or more documents to be displayed on the second screen within tree split on the right to 3 sub screens (alv screens) for data of the tree (nodes). On the right screens the data could be updated and I need to refresh all the 3 screens and also the tree & its nodes.

I have the same problem in few situations:

1- after refresh the tree (delete_all_nodes & create nodes again & call method frontend_update), when I double click on any node, it goes into the form with method "item_double_click" twice or as many times as I refresh the tree.

2- when I go back to the first screen and then go in the second screen, when I double click the node it goes into method "item_double_click" twice or as many as I go back and go in between the screens.

What should I use (methods) to prevent this situation

Thanks in advance,

Fariba

3 REPLIES 3
Read only

FredericGirod
Active Contributor
0 Likes
542

you cumulute call of your dynpro.

DYNP1 --> Action --> Call again DYNP1 --> action --> Call again DYNP1

and when you leave or anything else, you will need to close 3 times DYNP1.

have a look where you call and how, the screen.

Read only

Former Member
0 Likes
542

Hi,

I dont undrestand how to close the screens...

to remind you it happens even if I don't leave the screen and just try to refresh the tree by deleting nodes and rebuild them.

double click on nodes , multiply the method.

Read only

uwe_schieferstein
Active Contributor
0 Likes
542

Hello Fariba

I could imagine that you call the next screen from within your event handler method which probably causes the undesirable behaviour.

I prefer to call the next screen within the normal PAI logic of the dynpro. However, since control events usually do not trigger PAI add the following lines to your event handler method:


METHOD handle_item_double_click.

...
  CASE sender.  " add the optional IMPORTING parameter to the definition of the event handler method
    WHEN go_tree.
       CALL METHOD cl_gui_cfw=>set_new_ok_code
         EXPORTING
             ok_code = 'DISPLAY_DOC'.  " triggers PAI with ok-code = 'DISPLAY_DOC'.

    WHEN others.
     ...
  ENDCASE.

ENDMETHOD.

Now you can call in your PAI module USER_COMMAND_0100.


  ...
  CASE gd_okcode.
    WHEN 'BACK'    OR
               'EXIT'      OR
               'CANC'.
      IF ( syst-dynnr = '0200' ).
        set screen '0100'. leave screen.
      ELSE.  " ( syst-dynnr = '0100' )
        set screen 0. leave screen.
      ENDIF.

     WHEN 'DISPLAY_DOC'.
       CALL SCREEN '0200'.

     WHEN OTHERS.
     ENDCASE.

   CLEAR: gd_okcode.

Alternatively it may be sufficient to register event ITEM_DOUBLE_CLICK as application event (see routine CREATE_AND_INIT_TREE in sample report SAPSIMPLE_TREE_CONTROL_DEMO, SE83):


...
* define the events which will be passed to the backend
  " node double click
  event-eventid = CL_GUI_SIMPLE_TREE=>EVENTID_NODE_DOUBLE_CLICK.
  event-appl_event = 'X'. " process PAI if event occurs
  APPEND event to events.
...

Regards,

Uwe