on 07-31-2009 12:00 PM
Hi All ,
I am generating a dynamic drop down by index .I want to set the lead selection of the dropdown by index , based on some
value matching from the data base table . I am using
set_lead_selection_index for the same like this :
DATA : lv_index type i .
dyn_node->set_lead_selection_index( lv_index ).
I am not able to select the index properly for my dynamic node . Can any one help me out where , I am missing , I am using the following code :
lr_container ?= wd_this->mr_view->get_element('TC_SYSTEM' ).
DATA : lv_node type string value 'SYS',
lv_sap type string .
*internal table declaration
DATA : itab_sys TYPE STANDARD TABLE OF z2ts_systems .
work area declaration
DATA : wa_sys TYPE z2ts_systems .
CONCATENATE lv_node wd_this->count_sys INTO lv_node.
wd_this->count_sys = wd_this->count_sys + 1.
lr_node_info = wd_context->get_node_info( ).
CALL METHOD lr_node_info->add_new_child_node
EXPORTING
name = lv_node
is_mandatory = abap_false
is_multiple = abap_true
is_multiple_selection = abap_true
is_singleton = abap_false
is_initialize_lead_selection = abap_true
is_static = abap_false
RECEIVING
child_node_info = lr_node_info.
Get instance of new node
DATA: dyn_node TYPE REF TO if_wd_context_node.
dyn_node = wd_context->get_child_node( name = lv_node ).
Dynamic transparent container and text edit
DATA: lo_container TYPE REF TO cl_wd_uielement_container,
lo_dropdown TYPE REF TO cl_wd_dropdown_by_idx .
lr_attribute_info TYPE wdr_context_attribute_info,
lr_element TYPE REF TO if_wd_context_element.
lo_container ?= wd_this->mr_view->get_element( 'TC_SYSTEM' ).
Prepare properties of attribute & add to context node CHILD
lr_attribute_info-name = 'SYS_ID'.
lr_attribute_info-type_name = 'STRING'.
lr_attribute_info-value_help_mode = '0'.
lr_node_info->add_attribute(
EXPORTING attribute_info = lr_attribute_info ).
lr_element = dyn_node->create_element( ).
dyn_node->bind_element( new_item = lr_element
set_initial_elements = abap_false ).
wd_this->count = wd_this->count + 1.
dd_indx_id = 'DD_1'.
CONCATENATE dd_indx_id wd_this->count INTO dd_indx_id.
CONCATENATE lv_node '.SYS_ID' INTO LV_SAP.
lo_dropdown = cl_wd_dropdown_by_idx=>new_dropdown_by_idx(
bind_texts = LV_SAP
id = dd_indx_id view = wd_this->mr_view ).
append initial line to internal table
APPEND INITIAL LINE TO itab_sys .
populating internal table
SELECT *
FROM z2ts_systems
APPENDING TABLE itab_sys.
bind internal table with dynamic node
dyn_node->bind_table( itab_sys ) .
DATA lv_sysid TYPE Z2TS_SYSID1.
*
select single SYS_ID from z2ts_usersys into
lv_sysid where userid EQ WD_COMP_CONTROLLER->G_EDIT_USERID
AND
role_id EQ wd_comp_controller->G_EDIT_ROLEID
AND site_id EQ wd_comp_controller->G_EDIT_SITEID and
count1 EQ wd_this->count1 .
DATA : lv_index type i .
clear wa_sys.
LOOP AT itab_sys INTO wa_sys.
IF wa_sys-SYS_ID = lv_sysid.
lv_index = sy-tabix.
ENDIF.
clear wa_sys.
ENDLOOP.
dyn_node->set_lead_selection_index( lv_index ).
cl_wd_matrix_head_data=>new_matrix_head_data( element = lo_dropdown ).
lo_container->add_child( lo_dropdown ).
Thanks in advance
regards,
amit
I solved it by myself
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
any pointers regarding this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.