Sunteți pe pagina 1din 48

Use of Select Options and Search Help in Webdynpro Applications

OVS Search Help use in Select Options

Debesh

Use of Select Options and Search Help in Webdynpro Applications

Create a test Application

Give a View name and a Window name

By Debesh

Page 2

Use of Select Options and Search Help in Webdynpro Applications

For using select options we use a webdynpro component called WDR_SELECT_OPTIONS which has all the select options properties predefined inside it.

In the View create a View Conatiner UI element to hold the select options component.

By Debesh

Page 3

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 4

Use of Select Options and Search Help in Webdynpro Applications

Add a button a trigger a action

By Debesh

Page 5

Use of Select Options and Search Help in Webdynpro Applications

Get the controller of the select options in the view

In side window embedded the Select Options inside the view container

By Debesh

Page 6

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 7

Use of Select Options and Search Help in Webdynpro Applications

Inside DOINIT of view instantiate the interface controller of the Select options to get its control

By Debesh

Page 8

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 9

Use of Select Options and Search Help in Webdynpro Applications

Then initialize the select options by calling appropriate method

By Debesh

Page 10

Use of Select Options and Search Help in Webdynpro Applications

Now create a range table for the select options By Debesh Page 11

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 12

Use of Select Options and Search Help in Webdynpro Applications

Now with the standard Select Options add the Field for which select options is needed

By Debesh

Page 13

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 14

Use of Select Options and Search Help in Webdynpro Applications

Now the select option for the field is ready. To test the same create an application and test it.

By Debesh

Page 15

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 16

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 17

Use of Select Options and Search Help in Webdynpro Applications

Now for search help change the code for I_VALUE_HELP_TYPE ,CO_PREFIX_NONE to CO_PREFIX_OVS. Normally when we create node attribute we can provide search help in the properties. But for Select options we dont have any predefined node so we can use OVS help here. Now create a handler attribute for Select options and also create a handler method for the OVS

By Debesh

Page 18

Use of Select Options and Search Help in Webdynpro Applications

Now to transfer select options value from one view to other, create a view attribute which refer to IF_WD_SELECT_OPTIONS. This variable will hold the select options value .We are going to export this in our outbound plug and use it in the next view to read the select option.

Here LV_VAR is a second variable for a field which we will create in the view later for a field VBTYP. By Debesh Page 19

Use of Select Options and Search Help in Webdynpro Applications

Now create a outbound plug and and export the two variable which we are going to use in next view.

Now assign the helper reference to the handler variable.

By Debesh

Page 20

Use of Select Options and Search Help in Webdynpro Applications

Fire the plug now.

By Debesh

Page 21

Use of Select Options and Search Help in Webdynpro Applications

Now if you have remember we have added an variable VBTYP for that , we will create the field now in side view context By Debesh Page 22

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 23

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 24

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 25

Use of Select Options and Search Help in Webdynpro Applications

Now create the UI element

By Debesh

Page 26

Use of Select Options and Search Help in Webdynpro Applications

The following logic is for dropdown values

By Debesh

Page 27

Use of Select Options and Search Help in Webdynpro Applications

Code :
method WDDOINIT . data lo_cmp_usage type ref to if_wd_component_usage. lo_cmp_usage = wd_this->wd_cpuse_sel_op( ). if lo_cmp_usage->has_active_component( ) is initial. lo_cmp_usage->create_component( ). endif. DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_WDR_SELECT_OPTIONS . lo_INTERFACECONTROLLER = wd_this->wd_cpifc_sel_op( ). DATA lo_r_helper_class TYPE ref to if_wd_select_options. lo_r_helper_class = lo_interfacecontroller->init_selection_screen( )."wd_this->SEL_HANDLER data : lr_range TYPE REF TO data.

By Debesh

Page 28

Use of Select Options and Search Help in Webdynpro Applications

CALL METHOD lo_r_helper_class->CREATE_RANGE_TABLE EXPORTING I_TYPENAME = 'VBELN' * I_LENGTH = * I_DECIMALS = RECEIVING RT_RANGE_TABLE = lr_range . CALL METHOD lo_r_helper_class->ADD_SELECTION_FIELD EXPORTING I_ID = 'VBELN' IT_RESULT = lr_range I_READ_ONLY = ABAP_FALSE I_VALUE_HELP_TYPE = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_OVS . " Assign the handler reference to the declared attribute wd_this->SEL_HANDLER = lo_r_helper_class. DATA lo_nd_dcat TYPE REF TO if_wd_context_node. DATA lo_nd_dcat_temp TYPE REF TO if_wd_context_node_info. DATA lo_el_dcat TYPE REF TO if_wd_context_element. DATA ls_dcat TYPE wd_this->element_dcat. * navigate from <CONTEXT> to <DCAT> via lead selection lo_nd_dcat = wd_context->get_child_node( name = wd_this->wdctx_dcat ). data : lt_dom TYPE STANDARD TABLE OF DD07V, ls_dom like LINE OF lt_dom. CALL FUNCTION 'DDUT_DOMVALUES_GET' EXPORTING NAME = 'VBTYP' LANGU = SY-LANGU TABLES DD07V_TAB = lt_dom EXCEPTIONS ILLEGAL_INPUT = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. else. data tab type wd_this->elements_dcat. data entry like line of tab. LOOP AT lt_dom INTO ls_dom. entry-vbtyp = ls_dom-ddtext. APPEND entry to tab. ENDLOOP.

By Debesh

Page 29

Use of Select Options and Search Help in Webdynpro Applications

lo_nd_dcat->bind_table( new_items = tab ). endif. endmethod.

method YHANDLE . TYPES:BEGIN OF ty_help, vbeln TYPE vbap-vbeln, END OF ty_help. DATA: ls_help TYPE ty_help, lt_help TYPE STANDARD TABLE OF ty_help. FIELD-SYMBOLS: <lt_ovs_result> LIKE lt_help, <lhelp> LIKE LINE OF <lt_ovs_result>, <lt_sel_opt_result> TYPE STANDARD TABLE. CASE i_ovs_data-m_ovs_callback_object->phase_indicator. WHEN if_wd_ovs=>co_phase_0. "Set Configuration WHEN if_wd_ovs=>co_phase_1. "Preassign Entry Values WHEN if_wd_ovs=>co_phase_2. "Fill Value List SELECT vbeln FROM vbap INTO CORRESPONDING FIELDS OF TABLE lt_help UP TO 200 ROWS. i_ovs_data-m_ovs_callback_object->set_output_table( output = lt_help ). "Value Return WHEN if_wd_ovs=>co_phase_3. ASSIGN i_ovs_data-m_ovs_callback_object->selection->* TO <lhelp>. ASSIGN i_ovs_data-mt_selected_values->* TO <lt_sel_opt_result>. INSERT <lhelp>-vbeln INTO TABLE <lt_sel_opt_result>. WHEN OTHERS. ENDCASE. endmethod.

method ONACTIONGET_DET . data : lv_type(60) TYPE c. DATA lo_nd_dcat TYPE REF TO if_wd_context_node. DATA lo_nd_dcat_temp TYPE REF TO if_wd_context_node_info. DATA lo_el_dcat TYPE REF TO if_wd_context_element. DATA ls_dcat TYPE wd_this->element_dcat. * navigate from <CONTEXT> to <DCAT> via lead selection lo_nd_dcat = wd_context->get_child_node( name = wd_this->wdctx_dcat ). data : lt_dom TYPE STANDARD TABLE OF DD07V, ls_dom like LINE OF lt_dom. CALL FUNCTION 'DDUT_DOMVALUES_GET' EXPORTING NAME = 'VBTYP' LANGU = SY-LANGU TABLES

By Debesh

Page 30

Use of Select Options and Search Help in Webdynpro Applications

DD07V_TAB = lt_dom EXCEPTIONS ILLEGAL_INPUT = 1 OTHERS = 2. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. else. CALL METHOD LO_ND_DCAT->GET_ATTRIBUTE EXPORTING NAME = 'VBTYP' IMPORTING VALUE = lv_type . READ TABLE lt_dom INTO ls_dom with key ddtext = lv_type. IF sy-subrc IS INITIAL. wd_this->lv_var = ls_dom-DOMVALUE_L. ENDIF. endif. wd_this->fire_to_sales_plg( sel_handler = wd_this->sel_handler " ref to if_wd_select_options lv_var = wd_this->lv_var " vbtyp ). endmethod.

Now create the next view

By Debesh

Page 31

Use of Select Options and Search Help in Webdynpro Applications

We handle the export parameters of the plug in the handler method of the called view

By Debesh

Page 32

Use of Select Options and Search Help in Webdynpro Applications

Following is the procedure for ALV table display in webdynpro application

By Debesh

Page 33

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 34

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 35

Use of Select Options and Search Help in Webdynpro Applications

Add another context.

By Debesh

Page 36

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 37

Use of Select Options and Search Help in Webdynpro Applications

Design the view

By Debesh

Page 38

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 39

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 40

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 41

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 42

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 43

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 44

Use of Select Options and Search Help in Webdynpro Applications

method HANDLEFROM_SELECTION . wd_this->get_var = sel_handler. DATA: RT_DATA TYPE REF TO DATA. FIELD-SYMBOLS: <FS_DATA> TYPE TABLE. data : lt_range TYPE RANGE OF vbeln, ls_range LIKE LINE OF lt_range. RT_DATA = WD_THIS->get_var->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'VBELN' ). * Assign it to a field symbol ASSIGN RT_DATA->* TO <FS_DATA>. lt_range = <fs_data>. READ TABLE lt_range INTO ls_range INDEX 1. wd_this->vbeln_low = ls_range-low. wd_this->vbtype = lv_var. TYPES : BEGIN OF ty_vbap,

By Debesh

Page 45

Use of Select Options and Search Help in Webdynpro Applications

type VBELN_VA , type POSNR_VA , type MATNR , type MATWA , type NETWR_AP , type WAERK , type WERKS_EXT , type LGORT_D , type NETPR , END OF ty_vbap. DATA : lv_vbeln TYPE vbeln. DATA : lt_vbap TYPE TABLE OF ty_vbap. SELECT * INto CORRESPONDING FIELDS OF TABLE lt_vbap from vbak as a INNER JOIN vbap as b on a~vbeln = b~vbeln WHERE a~vbeln in lt_range and vbtyp = wd_this->VBTYPE. IF sy-subrc IS INITIAL. DATA lo_nd_sales TYPE REF TO if_wd_context_node. DATA lo_el_sales TYPE REF TO if_wd_context_element. * navigate from <CONTEXT> to <SALES> via lead selection lo_nd_sales = wd_context->get_child_node( name = wd_this->wdctx_sales ). * @TODO handle not set lead selection IF lo_nd_sales IS INITIAL. ENDIF. * get element via lead selection lo_el_sales = lo_nd_sales->get_element( ). * @TODO handle not set lead selection IF lo_el_sales IS INITIAL. ENDIF. lo_nd_sales->bind_table( lt_vbap ). ENDIF. endmethod.

VBELN POSNR MATNR matkl netwr waerk werks lgort netpr

By Debesh

Page 46

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 47

Use of Select Options and Search Help in Webdynpro Applications

By Debesh

Page 48

S-ar putea să vă placă și