on 05-01-2013 7:47 AM
Hi @all,i am ettting the error in two statements upon compiling the following code
Formal parameter "INPUT_PROMPT" does not exist. . |
&
image_source = '~Icon/Search'
these two lines,the whole code is written as below
what i am doing exactly here is trying to create UI Elements Dynamically
and instead trying to change their properties using wizard i m applying thru code
motive is to embed
an input field in the tray with label attached to that input field and a button at bottom
METHOD wddomodifyview .
DATA : lr_tray TYPE REF TO cl_wd_tray.
DATA : lr_caption TYPE REF TO cl_wd_caption.
DATA : lr_container TYPE REF TO cl_wd_uielement_container.
DATA : lr_flow TYPE REF TO cl_wd_flow_data.
DATA : lr_matrix_layout TYPE REF TO cl_wd_matrix_layout.
lr_container ?= view->get_element( 'TC_MAIN' ).
CALL METHOD cl_wd_tray=>new_tray
EXPORTING
id = 'TR_TRAY'
width = '100%'
RECEIVING
control = lr_tray.
lr_flow = cl_wd_flow_data=>new_flow_data( lr_tray ).
lr_tray->set_layout_data( lr_flow ).
CALL METHOD lr_container->add_child
EXPORTING
the_child = lr_tray.
CALL METHOD cl_wd_matrix_layout=>new_matrix_layout
EXPORTING
container = lr_tray
RECEIVING
control = lr_matrix_layout.
CALL METHOD cl_wd_caption=>new_caption
EXPORTING
id = 'CA_TRAY'
text = 'Yahoo… Here is my Tray (*_*)'
RECEIVING
control = lr_caption.
CALL METHOD lr_tray->set_header
EXPORTING
the_header = lr_caption.
TYPE-POOLS: abap.
DATA :
lt_components TYPE abap_component_tab,
lw_component TYPE LINE OF abap_component_tab,
lr_structdescr TYPE REF TO cl_abap_structdescr,
lt_attribs TYPE wdr_context_attr_info_map,
ls_attribs LIKE LINE OF lt_attribs.
lw_component-name = 'NAME'.
TRY.
lw_component-type = cl_abap_elemdescr=>get_c( p_length = 20 ).
CATCH cx_sy_move_cast_error .
ENDTRY.
APPEND lw_component TO lt_components.
lr_structdescr = cl_abap_structdescr=>create( lt_components ).
DATA:
lo_parent_node_info TYPE REF TO if_wd_context_node_info,
lo_child_node_info TYPE REF TO if_wd_context_node_info,
lt_child_node_map TYPE wdr_context_child_info_map,
comp_context TYPE REF TO if_wd_context_node.
FIELD-SYMBOLS : <fs_stru> TYPE ANY .
wd_comp_controller->ret_cc_context(
IMPORTING
er_context = comp_context ).
lo_parent_node_info = comp_context->get_node_info( ).
lt_child_node_map = lo_parent_node_info->get_child_nodes( ).
READ TABLE lt_child_node_map TRANSPORTING NO FIELDS WITH TABLE KEY
name = 'ND_DETAIL'.
IF sy-subrc = 0.
lo_parent_node_info->remove_child_node( 'ND_DETAIL' ).
ENDIF.
ls_attribs-name = 'NAME'.
INSERT ls_attribs INTO TABLE lt_attribs.
CALL METHOD lo_parent_node_info->add_new_child_node
EXPORTING
name = 'ND_DETAIL'
is_singleton = abap_true
static_element_rtti = lr_structdescr
is_static = abap_true
attributes = lt_attribs
RECEIVING
child_node_info = lo_child_node_info.
DATA lr_wa TYPE REF TO data.
DATA lo_child_node_detail TYPE REF TO if_wd_context_node.
FIELD-SYMBOLS <lfs_dyn> TYPE ANY.
CREATE DATA lr_wa TYPE HANDLE lr_structdescr.
ASSIGN lr_wa->* TO <lfs_dyn>.
lo_child_node_detail = comp_context->get_child_node( name = 'ND_DETAIL' ).
lo_child_node_detail->bind_structure( EXPORTING new_item = <lfs_dyn> ).
DATA: lo_node_info TYPE REF TO if_wd_context_node_info,
lo_node TYPE REF TO if_wd_context_node,
mapping_info TYPE wdr_context_mapping_info,
lv_name TYPE string,
lt_path TYPE wdr_ctx_element_path_segments.
DATA map_path TYPE string.
CLEAR lt_path.
DATA:
lr_child_node_info_view TYPE REF TO if_wd_context_node_info,
lt_child_node_map_view TYPE wdr_context_child_info_map.
lo_node_info = wd_context->get_node_info( ).
lv_name = 'ND_DETAIL'.
lt_child_node_map_view = lo_node_info->get_child_nodes( ).
READ TABLE lt_child_node_map
TRANSPORTING NO FIELDS WITH TABLE KEY
name = 'ND_DETAIL'.
IF sy-subrc = 0.
lo_node = wd_context->get_child_node( name = 'ND_DETAIL' ).
lr_child_node_info_view = lo_node->get_node_info( ).
RETURN.
ELSE.
ENDIF.
CONCATENATE 'COMPONENTCONTROLLER.' lv_name INTO map_path.
APPEND map_path TO lt_path.
mapping_info-controller = 'COMPONENTCONTROLLER'.
mapping_info-path = lt_path.
CALL METHOD lo_node_info->add_new_mapped_child_node
EXPORTING
child_name = lv_name
mapping_info = mapping_info
is_static = abap_true
RECEIVING
child_node_info = lr_child_node_info_view.
DATA lr_input TYPE REF TO cl_wd_input_field.
DATA lr_matrix_data TYPE REF TO cl_wd_matrix_data.
DATA lr_matrix TYPE REF TO cl_wd_matrix_head_data.
DATA lv_lbl_id TYPE string.
DATA lv_lbl_txt TYPE string.
DATA lv_lbl_for TYPE string.
DATA lr_label TYPE REF TO cl_wd_label.
DATA inp_id TYPE string.
DATA lv_width TYPE string.
CLEAR : inp_id , lv_width.
CALL METHOD cl_wd_input_field=>new_input_field
EXPORTING
bind_value = 'ND_DETAIL.ND_DETAIL.NAME'
id = 'IF_NAME'
input_prompt = 'Enter Name'
RECEIVING
control = lr_input.
CALL METHOD cl_wd_label=>new_label
EXPORTING
id = 'LBL_NAME'
label_for = 'IF_NAME'
text = 'Name'
RECEIVING
control = lr_label.
lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_label ).
lr_label->set_layout_data( lr_matrix ).
lr_matrix_data = cl_wd_matrix_data=>new_matrix_data( lr_input ).
lr_input->set_layout_data( lr_matrix_data ).
lr_container ?= view->get_element( 'TR_TRAY' ).
CALL METHOD lr_container->add_child
EXPORTING
the_child = lr_label.
CALL METHOD lr_container->add_child
EXPORTING
the_child = lr_input.
DATA : lr_button TYPE REF TO cl_wd_button.
CALL METHOD cl_wd_button=>new_button
EXPORTING
image_source = '~Icon/Search'
on_action = 'PROCESS_EVENT'
id = 'BTN_SEARCH'
text = 'Sumit'
RECEIVING
control = lr_button.
lr_matrix = cl_wd_matrix_head_data=>new_matrix_head_data( lr_button ).
lr_button->set_layout_data( lr_matrix ).
CALL METHOD lr_container->add_child
EXPORTING
the_child = lr_button.
ENDMETHOD.
pls. help in this regard,
Thanks in advance
Manu
check for alternative parameter for input promt like BOUND_INPUT_PROMPT in the class cl_wd_input_field=>new_input_field and similarly for image source in the class cl_wd_button=>new_button ..... this should resolve your issue............even if you take this parameter out it can work.
check the following link for buttons
http://saptechnical.com/Tutorials/WebDynproABAP/UIHierarchy/dynamic.htm and
the following link for input fields........
http://webdynproabap.wordpress.com/2012/10/04/dynamic_uielemen/....
Hope this helps...................
regards,
narayan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manu,
if you open the class cl_wd_button=>new_button and cl_wd_input_field=>new_input_field and check the parameter list for both the class method you will not find the input_prompt and image_source parameter. Thats the reason its throwing the error.
regards,
narayan
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.