on 05-23-2012 5:17 AM
i joined as a fresher SAP ABAP WEBDYNPRO CONSULTant and working on Dynamic programming , in that i have to create UI elements dynamiclly , i have done it in two ways :
1) created dynamic table from node which i created staticlly by mehohod cl_wd_dynamic_tool=>create_table_from_node .
2)n second way i am defining the both node and view dynamiclly but i am getting dump.
this is the code i am writing in wd do init.
method WDDOINIT .
DATA: lv_root_node TYPE REF TO if_wd_context_node,
lv_root_node_info TYPE REF TO if_wd_context_node_info,
lv_node_info TYPE REF TO if_wd_context_node_info.
lv_root_node_info = wd_context->get_node_info( ).
CALL METHOD lv_root_node_info->add_new_child_node
EXPORTING
name = 'FLIGHTS'
is_mandatory = abap_false
is_mandatory_selection = abap_false
is_multiple = abap_true
is_multiple_selection = abap_true
is_initialize_lead_selection = abap_true
RECEIVING
child_node_info = lv_node_info.
here i am filling the node .....******* .
data : itab TYPE TABLE OF sflight .
select * from sflight INto TABLE itab .
lv_root_node->get_child_node( name = 'FLIGHTS').
lv_root_node->bind_table( itab ).
This is the code i write in wddomodify .
DATA :lr_ui_root TYPE REF TO if_wd_view_element,
lr_container TYPE REF TO cl_wd_uielement_container.
CHECK first_time = abap_true.
lr_ui_root = view->get_root_element( ).
lr_container ?= lr_ui_root.
cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
lr_container->set_width( value = '50%' ).
lr_container->set_height( value = '50%' ).
" Add UI elements to the container along with their layout properties
data : lr_label_carrid type ref to cl_wd_label,
lr_input_carrid type ref to cl_wd_input_field,
lr_button TYPE ref to cl_wd_button,
lr_table TYPE REF TO cl_wd_table .
lr_input_carrid = cl_wd_input_field=>new_input_field( bind_value = 'FLIGHTS.CARRID'
id = 'INPUT_FIELD_CARRID' ).
lr_label_carrid = cl_wd_label=>new_label( id = 'LABEL_CARRID'
label_for = 'INPUT_FIELD_CARRID'
text = 'Enter The carrier id' ).
call METHOD CL_WD_BUTTON=>NEW_BUTTON
exporting
* BIND_DESIGN =
* BIND_ENABLED =
* BIND_IMAGE_FIRST =
* BIND_IMAGE_SOURCE =
* BIND_TEXT =
* BIND_TEXT_DIRECTION =
* BIND_TOOLTIP =
* BIND_VISIBLE =
* BIND_WIDTH =
* DESIGN = E_DESIGN-STANDARD
ENABLED = 'X'
* EXPLANATION =
ID = 'BUTTON'
* IMAGE_FIRST = ABAP_TRUE
* IMAGE_SOURCE =
ON_ACTION = 'GET_DETAILS'
TEXT = 'GET_DATA'
* TEXT_DIRECTION = E_TEXT_DIRECTION-INHERIT
* TOOLTIP =
* VIEW =
* VISIBLE = E_VISIBLE-VISIBLE
* WIDTH =
RECEIVING
CONTROL = lr_button .
CALL METHOD CL_WD_TABLE=>NEW_TABLE
EXPORTING
* ACCESSIBILITY_DESCR =
* BIND_ACCESSIBILITY_DESCR =
BIND_DATA_SOURCE = 'MAIN_VIEW.FLIGHTS'
BIND_DESIGN = 'STANDARD'
* BIND_EMPTY_TABLE_TEXT =
BIND_ENABLED = 'X'
* BIND_FIRST_ACTUAL_ROW =
* BIND_FIRST_VISIBLE_ROW =
* BIND_FIRST_VISIBLE_SCROLL_COL =
* BIND_FIXED_TABLE_LAYOUT =
BIND_FOOTER_VISIBLE = 'X'
* BIND_GRID_MODE =
* BIND_LEGEND_ID =
* BIND_READ_ONLY =
* BIND_ROW_COUNT =
BIND_ROW_SELECTABLE = 'X'
* BIND_SCROLLABLE_COL_COUNT =
* BIND_SELECTED_POPIN =
* BIND_SELECTION_MODE =
* BIND_TOOLTIP =
* BIND_VISIBLE =
* BIND_VISIBLE_ROW_COUNT =
* BIND_WIDTH =
* DESIGN = E_DESIGN-STANDARD
* EMPTY_TABLE_TEXT =
* ENABLED = ABAP_TRUE
* FIRST_ACTUAL_ROW =
* FIRST_VISIBLE_ROW =
* FIRST_VISIBLE_SCROLL_COL =
* FIXED_TABLE_LAYOUT =
* FOOTER_VISIBLE = ABAP_TRUE
* GRID_MODE = E_GRID_MODE-BOTH
ID = 'TABLE'
* LEGEND_ID =
* ON_FILTER = 'ON_FILTER'
ON_LEAD_SELECT = 'ON_LEAD_SELECT'
* ON_SCROLL =
ON_SORT = 'ON_SORT'
* READ_ONLY =
* ROW_COUNT = -1
* ROW_SELECTABLE = ABAP_TRUE
* SCROLLABLE_COL_COUNT = -1
* SELECTED_POPIN =
* SELECTION_CHANGE_BEHAVIOUR = E_SELECTION_CHANGE_BEHAVIOUR-AUTO
* SELECTION_MODE = E_SELECTION_MODE-AUTO
* TOOLTIP =
* VIEW =
* VISIBLE = E_VISIBLE-VISIBLE
* VISIBLE_ROW_COUNT = 5
* WIDTH =
RECEIVING
CONTROL = lr_table .
LR_TABLE ?= view->get_element('TABLE').
wd_this->table_control ?= LR_table->_method_handler .
wd_this->table_control->set_key_attribute_name( 'CARRID').
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_label_carrid ).
cl_wd_matrix_data=>new_matrix_data( element = lr_input_carrid ).
cl_wd_matrix_head_data=>new_matrix_data( element = lr_button ).
cl_wd_matrix_head_data=>new_matrix_data( element = lr_table ).
lr_container->add_child( the_child = lr_label_carrid ).
lr_container->add_child( the_child = lr_input_carrid ).
lr_container->add_child( the_child = lr_button ).
lr_container->add_child( the_child = lr_table ).
endmethod.
but it is givinf dump i also implement action get_detail .
Hi ,
Fallow the below steps....
Here student node is having firstname, lastname and dateofbirth attributes.
'YSTR_PERSON' structure contains 3 fields, like firstname, lastname and dateofbirth
DATA: lr_node TYPE REF TO if_wd_context_node,
lr_node_info TYPE REF TO if_wd_context_node_info,
lr_child_node_info TYPE REF TO if_wd_context_node_info.
lr_node_info = wd_context->get_node_info( ).
lr_child_node_info = lr_node_info->add_new_child_node(
name = 'STUDENT'
is_singleton = abap_true
is_multiple = abap_false
is_mandatory = abap_true
static_element_type = 'YSTR_PERSON'
).
lr_node = wd_context->get_child_node( 'STUDENT' ).
DATA ls_data TYPE ystr_person.
ls_data-firstname = 'Antonia Maria'.
ls_data-lastname = 'Keller'.
ls_data-dateofbirth = '19800306'.
lr_node->bind_structure( EXPORTING new_item = ls_data ).
For Input field fallow below code...
DATA
lr_input_field TYPE REF TO cl_wd_input_field.
lr_input_field = cl_wd_input_field=>new_input_field(
id = ’NAME’
bind_value = lv_bind_name).
Regards,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Please follow the link
It contains the example where a context node and a table UI is created dynamically.
Hope it helps.
Regards,
Sayan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.