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: 

Question on logic of re-entrant "docked tree" screen

Former Member
0 Kudos

I have a program where the customer can enter a "docked tree" screen more than once - in particular - the customer can enter the "docked tree" screen, back out of it without doing anything, and then come into it again with a different "root".

The program is working fine, but I have a couple of questions about what exactly it is doing and whether I could do things slightly differently.

Before I ask the questions, I want to provide you with snapshots of the relevant modules/forms.

So, here is the PBO logic for this screen:

**********************************

PROCESS BEFORE OUTPUT.

MODULE STATUS_0200.

MODULE TREE_AND_DOCKING.

***********************************

And here is the "TREE_AND_DOCKING" module:

**********************************************

MODULE TREE_AND_DOCKING OUTPUT.

  • docking control

IF v_first_time = 'Y'.

v_first_time = 'N'.

PERFORM CREATEDOCKINGCONTROL.

ENDIF.

DESCRIBE TABLE i_node_lookup LINES v_cnt_node_lookup.

IF v_cnt_node_lookup = 0.

PERFORM CREATETREECONTROL.

ENDIF.

ENDMODULE. " TREE_AND_DOCKING OUTPUT

***********************************************************

And here is the "CREATEDOCKINGCONTROL" form:

***********************************************************

FORM CREATEDOCKINGCONTROL.

  • create container for alv-tree

CREATE OBJECT G_CONTAINER_OBJECT

EXPORTING SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_LEFT

EXTENSION = 450

REPID = G_REPID

DYNNR = '0200'.

ENDFORM. " CREATEDOCKINGCONTROL

***********************************************************

And here is the top of the "CREATETREECONTROL" form:

***********************************************************

FORM CREATETREECONTROL.

DATA: NODE_TABLE TYPE NODE_TABLE_TYPE.

IF NOT CONTROLS_CREATED = SELECTED.

CONTROLS_CREATED = SELECTED.

  • create Event Receiver

CREATE OBJECT TREE_EVENT_RECEIVER.

ENDIF.

  • create tree control

CREATE OBJECT TREE1

EXPORTING

PARENT = G_CONTAINER_OBJECT

NODE_SELECTION_MODE = CL_GUI_SIMPLE_TREE=>NODE_SEL_MODE_SINGLE

EXCEPTIONS

LIFETIME_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

FAILED = 4

ILLEGAL_NODE_SELECTION_MODE = 5.

*******************************************************

My first question is:

1) when the customer enters the "docked tree" screen the second time (not the first) and the "create object" fires inside the "createtreecontrol" form, does this create a second instance of cl_gui_simple_tree? Or is the first instance automatically destroyed by SAP when the customer leaves the "docked tree" screen (after getting into it the first time)?

And my second question is:

2) If the answer to question 1 is "yes - you have two instances", then what is the right way to destroy the first instance of the object so that there is only one instance around?

Thanks for whatever authoritative help anyone can provide. Please - authoritative answers only - no guesses.

djh

1 REPLY 1

former_member181923
Active Participant
0 Kudos

answered in ABAP Objects forum by Rich and Max ...