on 05-25-2007 6:34 AM
Hi All
I have tried to develop a method where I can create a tray dynamically. I have embedded this code in the method WDDOINIT of my View called 'MAIN_VIEW'. My longer term plan is to create x number of trays where x is dictated by the number of entires in an Internal Table.
The code I have written compiles, but nothing appears where I thought it would. Can anyone spot what I have so fundementally missed?
Assistance is sincerely appreciated.
Regards
Tony
create object wd_this->all_in_one_util.
data: node_input type REF TO if_wd_context_node,
elem_input TYPE REF TO if_wd_context_element,
stru_input type if_main_view=>element_input.
data: lr_view type ref to cl_wdr_view,
lr_tray type REF TO CL_WD_TRAY,
tray_id type string,
lr_caption type ref to cl_wd_caption,
caption_id type string,
lr_grid_data type ref to cl_wd_grid_data,
lr_grid_layout type ref to cl_wd_grid_layout.
*Navigate from <CONTEXT> to <INPUT> via lead selection
node_input = wd_context->get_child_node( name = if_main_view=>wdctx_input ).
lr_tray = cl_wd_tray=>new_tray(
EXPANDED = ABAP_TRUE
ID = tray_id
VIEW = lr_view "'MAIN_VIEW'
WIDTH = '100%'
).
set the caption of the tray
concatenate lr_tray->id '_HEADER' into caption_id.
lr_caption = cl_wd_caption=>new_caption(
id = caption_id
text = 'text goes here'
view = lr_view ).
lr_tray->set_header( lr_caption ).
create the grid layout data for tray
lr_grid_data = cl_wd_grid_data=>new_grid_data( lr_tray ).
assign the layout data to the tray
lr_tray->set_layout_data( lr_grid_data ).
create a new grid layout for the content of the tray
lr_grid_layout = cl_wd_grid_layout=>new_grid_layout( lr_tray ).
assign the grid layout to the tray
lr_tray->set_layout( lr_grid_layout ).
Hi Tony,
If we have to do any dynamic programming in webdynpro( creating UIelements dynamically ), WDDOMODIFYVIEW is the method where we need to code the logic for creating the tray.
But you have done the coding of creating tray in WDDOINIT thats why it is not working fine. Just the have the same code in WDDODMODIFYVIEW and you need to have below code to add this tray to view's ROOTUICONTAINER.
data: lr_container TYPE REF TO cl_wd_uielement_container.
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
" View is import parameter of wddomodifyview method.
lr_container->add_child( '' pass the tray that is created ' ).
This is the way to create dynamic UIelements in webdynpro using wddodmodifyview
For more information on dynamic programming have at following information
<a href="http://help.sap.com/saphelp_crm50/helpdata/en/44/2d9a41ed79a009e10000000a155106/frameset.htm">http://help.sap.com/saphelp_crm50/helpdata/en/44/2d9a41ed79a009e10000000a155106/frameset.htm</a>
Thanks,
Prashanth Kumar B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you to both of you for your quick replies - sincerely appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tony.
You have to add the tray to the view:
LR_CONTAINER type ref to CL_WD_UIELEMENT_CONTAINER.
LR_CONTAINER ?= view->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER' ).
LR_CONTAINER->ADD_CHILD( LR_tray ).
Cheers,
Sascha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.