Creating select-option functionality is bit tuff in web dynpro so this is how we create select-option in this browser based technology:
1. First create one web dynpro component say : YRG_SELECT_OPTION
2. Create one view say : main
3. In that view insert one viewcontaineruielement , insert one button and table.
In the method wddoinit of the view write the below code:
Don't forget to add in used component of the YRG_SELECT_OPTION
select_options WDR_SELECT_OPTIONS
**********************************************************
METHOD wddoinit .
DATA : lt_range_taBle TYPE REF TO data,
DATA : lt_range_taBle TYPE REF TO data,
rt_range_table TYPE REF TO data,
read_only TYPE abap_bool,
type_name TYPE string.
DATA : lr_componentcontroller TYPE REF TO ig_componentcontroller.
DATA : lr_componentcontroller TYPE REF TO ig_componentcontroller.
DATA lo_componentinterface TYPE REF TO if_wd_component_usage.
lo_componentinterface = wd_this->WD_CPUSE_SELECT_OPTIONS( ).
lo_componentinterface = wd_this->WD_CPUSE_SELECT_OPTIONS( ).
IF lo_componentinterface->has_active_component( ) IS INITIAL.
lo_componentinterface->create_component( ).
ENDIF.
wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
wD_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
wD_this->m_handler->set_global_options(
wD_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
wD_this->m_handler->set_global_options(
i_display_btn_cancel = abap_false
i_display_btn_check = abap_false
i_display_btn_reset = abap_false
i_display_btn_execute = abap_false ).
lt_range_taBle = wD_this->m_handler->CREATE_RANGE_TABLE( I_TYPENAME = 'PERSNO' ).
wd_this->m_handler->add_selection_field( i_id = 'PERSNO' it_result = lt_range_taBle i_read_only = ABAP_false ).
ENDMETHOD.
lt_range_taBle = wD_this->m_handler->CREATE_RANGE_TABLE( I_TYPENAME = 'PERSNO' ).
wd_this->m_handler->add_selection_field( i_id = 'PERSNO' it_result = lt_range_taBle i_read_only = ABAP_false ).
ENDMETHOD.
******************************************************************
Now check the code when you press button search :
****************************************************
METHOD onactionon_select .
DATA: node_flights TYPE REF TO if_wd_context_node.
DATA: node_flights TYPE REF TO if_wd_context_node.
DATA: rt_carrid TYPE REF TO data.
DATA: isflight TYPE TABLE OF sflight.
DATA: wsflight TYPE sflight.
FIELD-SYMBOLS: TYPE table.
DATA : it_pa0001 TYPE TABLE OF pa0001,
wa_pa0001 TYPE pa0001.
TYPES : BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
begda TYPE pa0001-begda,
END OF ty_pa0001.
DATA : it_final TYPE TABLE OF ty_pa0001,
DATA : it_final TYPE TABLE OF ty_pa0001,
wa_final TYPE ty_pa0001.
rt_carrid = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'PERSNO' ).
ASSIGN rt_carrid->* TO.
rt_carrid = wd_this->m_handler->get_range_table_of_sel_field( i_id = 'PERSNO' ).
ASSIGN rt_carrid->* TO
SELECT * FROM pa0001 INTO TABLE it_pa0001 WHERE pernr IN .
DATA lo_nd_node_pa0001 TYPE REF TO if_wd_context_node.
DATA lt_node_pa0001 TYPE wd_this->elements_node_pa0001.
DATA lo_nd_node_pa0001 TYPE REF TO if_wd_context_node.
DATA lt_node_pa0001 TYPE wd_this->elements_node_pa0001.
lo_nd_node_pa0001 = wd_context->get_child_node( name = wd_this->wdctx_node_pa0001 ).
lt_node_pa0001[] = it_pa0001[].
lo_nd_node_pa0001->bind_table( new_items = lt_node_pa0001 set_initial_elements = abap_true ).
ENDMETHOD.
ENDMETHOD.
***************************************************************
No comments:
Post a Comment