Select-Options in Web Dynpro Application
Select-Options in Web Dynpro Application
Select-Options in Web Dynpro Application
Click OK.
Now Create a Table called FLIGHTTABLE and the dataSource property of the Table view element is
linked to the FLIGHTS context node.
In the Properties tab of the view controller, under the Used Controllers/Components
In the view controller, we need an attribute that holds the reference to the instance of the Select Options
component. This is necessary because at runtime we access this reference to the search criteria that
have been entered in the event-handler method.
Now in the WDDOINT method of the view controller write this code.
METHOD WDDOINIT .
DATA: LT_RANGE_TABLE TYPE REF TO DATA,
RT_RANGE_TABLE TYPE REF TO DATA,
READ_ONLY TYPE ABAP_BOOL,
TYPENAME TYPE STRING.
DATA: LR_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER,
L_REF_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
* create the used component
L_REF_CMP_USAGE = WD_THIS->WD_CPUSE_SELECT_OPTIONS( ).
IF L_REF_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
L_REF_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
WD_THIS->M_WD_SELECT_OPTIONS = WD_THIS->WD_CPIFC_SELECT_OPTIONS( ).
* init the select screen
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 ).
* create a range table that consists of this new data element
LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( I_TYPENAME =
'S_CARR_ID' ).
* add a new field to the selection
WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'S_CARR_ID'
IT_RESULT = LT_RANGE_TABLE I_READ_ONLY = READ_ONLY ).
ENDMETHOD.
Now in the ONACTIONSEARCH method of the view controller write this code.
METHOD ONACTIONSEARCH .
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: <FS_CARRID> TYPE TABLE.
* Retrieve the data from the select option
Now Create a Web Dynpro Application and save and activate all.
Output: