Спасибо, baboon, еще раз. Всё получилось и сам бы ни в жизнь не написал бы так.
Привожу код для справки, может кому-то пригодится...
Code:
data: l_style type i,
l_wa_rm_list type rsscm,
l_rm_list type standard table of rsscm initial size 2,
l_parentid type int4,
l_owner_repid type syrepid,
l_dynnr type sydynnr,
l_handle type cntl_handle,
l_selected_item type rsscm-pfid,
l_typetext like text_for_node,
l_nametext type tdobjname,
l_captiontext type tdtext.
l_dynnr = sy-dynnr.
l_owner_repid = sy-repid.
l_style = ws_child + ws_border + ws_tabstop + ws_thickframe.
if l_parentid is initial.
l_parentid = dynpro_default.
endif.
call function 'CONTROL_CREATE'
exporting
clsid = 'SAP.RightMouseMenuControl.1' "#EC NOTEXT
shellstyle = l_style
parentid = l_parentid
owner_repid = l_owner_repid
dynpro_number = l_dynnr
changing
h_control = l_handle
exceptions
others = 0.
perform get_type_and_name using p_node_current-handle
changing l_typetext
l_nametext
l_captiontext.
if p_node_current-handle->nodetype eq c_node_event.
* display event description as its name
l_nametext = l_captiontext.
endif.
l_wa_rm_list-pfid = 1.
l_wa_rm_list-enabled = 'X'.
concatenate 'Unter dem Knoten'(d01) l_nametext into l_wa_rm_list-text
separated by space.
l_wa_rm_list-fcode = c_dd_fcode_first_child.
append l_wa_rm_list to l_rm_list.
l_wa_rm_list-pfid = 2.
l_wa_rm_list-enabled = 'X'.
concatenate 'Nach dem Knoten'(d02) l_nametext into l_wa_rm_list-text
separated by space.
l_wa_rm_list-enabled = 'X'.
l_wa_rm_list-fcode = c_dd_fcode_next_sibling.
append l_wa_rm_list to l_rm_list.
call function 'DP_CONTROL_ASSIGN_TABLE'
exporting
h_cntl = l_handle
tabname = 'RSSCM' "#EC NOTEXT
medium = 'object' "#EC NOTEXT
propertyname = 'MenuItems' "#EC NOTEXT
tables
data = l_rm_list
exceptions
others = 0.
call function 'CONTROL_CALL_METHOD'
exporting
h_control = l_handle
method = 'Display' "#EC NOTEXT
p_count = 0
no_flush = space
importing
return = l_selected_item
exceptions
others = 0.
clear p_fcode.
read table l_rm_list into l_wa_rm_list
with key pfid = l_selected_item.
if sy-subrc eq 0.
p_fcode = l_wa_rm_list-fcode.
endif.