This post resumes the "experiential" or "event-driven" tutorial on how to use the SAP-delivered WD-ABAP component WDR_TEST_UI_ELEMENTS as a pattern for a
generic
component that displaysa detail view from a tree view from a tray view
. Although there have been three posts in this tutorial to-date:JUST KIDDING !!!
Documentation, class, and procedural tutorialsARE
all integral parts of the WD-ABAP learning experience, and one shouldn't attempt the kind of "event-driven" self-tutorial I'm documenting hereuntil
one has gone thru the excellent WD-ABAP procedural tutorials already written by SAP and SDN folks. This is because going thru these procedural tutorials will make one's fingers smart at WD-ABAP editor navigation, as well as providing a rough initial idea of how WD-ABAP actually works. In fact, it is a good idea to doall seven
WD-ABAP procedural tutorials before trying an "event-driven" self-tutorial, if you are a bear of as little brain as me and have to be hit over the head by repetition before you really understand anything. (Note: the phrase "bear of little brain" is from the great children's classic "Winnie-the-Pooh" - (re-)reading it is a great way of getting some relief from the pressures of seeing how quickly one can become effective in WD-ABAP.)Logical DataBases
(custom tray)Programming Trees
(custom tray)Report Sets
(custom tray)ZWDR_TEST_UI_ELEMENTS
is to get this clone component to display the correct right-hand-side tree-view when one of the custom links is selected. To make this objective clear, it is important to note that:WDR_TEST_UI_ELEMENTS
opens with theSTANDARD
library selected and theBUTTON
link selected, so that the right-hand side tree-view already displays the "aggregation" for "Button
".STANDARD
tray (or if one opens a different tray and clicks on a link within it), the correct "aggregation" will appear in the right-hand-side tree view.ZWDR_TEST_UI_ELEMENTS
so that the same thing happens as in (ii) above when any of thecustom
trays and links above are selected, e.g. the custom trayLogical Databases
and the custom linkVendor Database
.WDR_TEST_UI_ELEMENTS
;very
patient.onActionDISPLAY_DETAIL
of theMain
view ofWDR_TEST_UI_ELEMENTS
is invoked;on_display_detail
of the SAP-delivered classCL_WDR_ALL_IN_ONE_UTIL
(since this is the class that has been declared as the handler of theMain
view ofWDR_TEST_UI_ELEMENTS
);swtich_ui_element2
method ofCL_WDR_ALL_IN_ONE_UTIL
;create
method of the SAP-delivered classCL_WDR_ALL_IN_ONE_UI_ELEM
(becausem_view_cur_element
has been set to this class - see earlier posts.)create_settings
method ofCL_WDR_ALL_IN_ONE_UI_ELEM
;most importantly
:aha!
: the create_settings method ofCL_WDR_ALL_IN_ONE_UI_ELEM
contains the code that displays the correct tree-root node at the top of the right-hand-side tree-view (i.e. "Button", or "Tree", or "Table", etc., depending on what left-hand-side tray link has been selected.)create_settings
that does this is:*********************************************************************
create an instance of the new view element
concatenate 'NEW_' (method_name)
parameter-table
lt_method_params.
add it to the hierarchy tree
m_hier_tree_context_element = m_hier_tree_context_node->create_element( ).
m_hier_tree_context_node->bind_element( new_item = m_hier_tree_context_element set_initial_elements = abap_false ).
m_hier_tree_context_element->set_attribute( name = 'EXPANDED' value = abap_false ).
m_hier_tree_context_element->set_attribute( name = 'HAS_CHILDREN' value = abap_false ).
m_hier_tree_context_element->set_attribute( name = 'TEXT' value = set_attribute( name = 'ICON' value = icon ).
**************************************************************************
And therefore, all we have to do to achieve our objective is to modify the above code as follows:
****************************************************************************
create an instance of the new view element
add it to the hierarchy tree
m_hier_tree_context_element = m_hier_tree_context_node->create_element( ).
m_hier_tree_context_node->bind_element( new_item = m_hier_tree_context_element set_initial_elements = abap_false ).
m_hier_tree_context_element->set_attribute( name = 'EXPANDED' value = abap_false ).
m_hier_tree_context_element->set_attribute( name = 'HAS_CHILDREN' value = abap_false ).
m_hier_tree_context_element->set_attribute( name = 'TEXT' value =