Skip to Content
Author's profile photo Ramakrishnappa Gangappa

OVS F4 help in Standard application in Webdynpro ABAP

Purpose:

Demonstrate the scenario of providing custom search help for the fields in standard webdynpro application.

Scenario:

Here I consider the scenario to attach OVS search help for an attribute FIRSTNAME in context node PERSONALDATA of component HRRCF_C_PERSONL_DATA_UI

Pre-requisite:

Basic knowledge of Webdynpro ABAP & OVS search help

The existing output screen of standard application

Before_ovs_help.PNG

Step1:

Open the standard application HRRCF_C_PERSONL_DATA_UI in t-code SE80 and click on Enhance ( Ctrl + f4 ) button to creation enhancement implementation as below

Step1.png

Step2:

A dialog box appears for creating enhancement implementation and provide the name and description as below

step2.PNG

Step 3:

Create the component usage OVS_HELP by using standard ovs component WDR_OVS as shown below

step4.PNG

Step 4:

Open view VW_PERSONALDATA and click on enhance ( ctrl + f4 ) button as show below

/wp-content/uploads/2013/12/step5_339803.png

Step 5:

Chose the enhancement implementation YDEMO_OVS_HELP as shown below

/wp-content/uploads/2013/12/step6_339804.png

Step 6:

Click on the Create component usage button to create component usage OVS_HELP in view as shown below

/wp-content/uploads/2013/12/step7_339805.png

Step 7:

Choose the OVS_HELP component from the list as below

/wp-content/uploads/2013/12/step7_1_339806.png

/wp-content/uploads/2013/12/step7_2_339807.png

Step 8:

We are going to consider the attribute FIRSTNAME of context node PERSONALDATA for attaching  OVS value help as shown below

/wp-content/uploads/2013/12/step8_339808.png

Step 9:

Go to methods tab of view and create event handler by using OVS_HELP as show below

/wp-content/uploads/2013/12/step8_1_339809.png

Step 10:

Use F4 key to open list of components available as below

/wp-content/uploads/2013/12/step8_2_339810.png

Step 11:

Select the OVS_HELP and event OVS and the event handler is successfully registerd for an event OVS as below

/wp-content/uploads/2013/12/step8_3_339811.png

Please refer the below  sample code to populate the value list

ovs_firstname

METHOD ovs_firstname .
* declare data structures for the fields to be displayed and
* for the table columns of the selection list, if necessary
  TYPES:
    BEGIN OF lty_stru_input,
*   add fields for the display of your search input here
      firstname TYPE bu_namep_f,
      secondname TYPE bu_namep_l,
    END OF lty_stru_input.
  TYPES:
    BEGIN OF lty_stru_list,
*   add fields for the selection list here
      firstname TYPE bu_namep_f,
      secondname TYPE bu_namep_l,
    END OF lty_stru_list.

  DATA: ls_search_input  TYPE lty_stru_input,
        lt_select_list   TYPE STANDARD TABLE OF lty_stru_list,
        ls_select_list   LIKE LINE OF lt_select_list,
        ls_text          TYPE wdr_name_value,
        lt_label_texts   TYPE wdr_name_value_list,
        lt_column_texts  TYPE wdr_name_value_list,
        lv_window_title  TYPE string,
        lv_table_header  TYPE string.

  FIELD-SYMBOLS: <ls_query_params> TYPE lty_stru_input,
                 <ls_selection>    TYPE lty_stru_list.

  CASE ovs_callback_object->phase_indicator.

    WHEN if_wd_ovs=>co_phase_0.  “configuration phase, may be omitted
*   in this phase you have the possibility to define the texts,
*   if you do not want to use the defaults (DDIC-texts)

      ls_text-name = `FIRSTNAME`. “must match a field in list structure
      ls_text-value = `First Name`.
      INSERT ls_text INTO TABLE lt_column_texts.

      ls_text-name = `SECONDNAME`.
      ls_text-value = `Second Name`.
      INSERT ls_text INTO TABLE lt_column_texts.

      APPEND LINES OF lt_column_texts TO lt_label_texts.

      ovs_callback_object->set_configuration(
                label_texts  = lt_label_texts
                column_texts = lt_column_texts
                window_title = lv_window_title
                table_header = lv_table_header ).

    WHEN if_wd_ovs=>co_phase_1.  “set search structure and defaults
*   In this phase you can set the structure and default values
*   of the search structure. If this phase is omitted, the search
*   fields will not be displayed, but the selection table is
*   displayed directly.
*   Read values of the original context (not necessary, but you
*   may set these as the defaults). A reference to the context
*   element is available in the callback object.

      ovs_callback_object->context_element->get_static_attributes(
          IMPORTING static_attributes = ls_search_input ).
*     pass the values to the OVS component
      ovs_callback_object->set_input_structure(
          input = ls_search_input ).

    WHEN if_wd_ovs=>co_phase_2.
*   If phase 1 is implemented, use the field input for the
*   selection of the table.
*   If phase 1 is omitted, use values from your own context.

      IF ovs_callback_object->query_parameters IS NOT BOUND.
******** TODO exception handling
      ENDIF.
      ASSIGN ovs_callback_object->query_parameters->*
                              TO <ls_query_params>.
      IF NOT <ls_query_params> IS ASSIGNED.
******** TODO exception handling
      ENDIF.

*     call business logic for a table of possible values
*     lt_select_list = ???

      “=============================================
      “Prepare sample list for value list
      “=============================================
      CLEAR lt_select_list.

      CLEAR ls_select_list.
      ls_select_list-firstname = ‘Ramakrishnappa’.
      ls_select_list-secondname = ‘Gangappa’.

      APPEND ls_select_list TO lt_select_list.

      CLEAR ls_select_list.
      ls_select_list-firstname = ‘Abc_First’.
      ls_select_list-secondname = ‘Abc_Second’.

      APPEND ls_select_list TO lt_select_list.
      “=============================================
      ovs_callback_object->set_output_table( output = lt_select_list ).

    WHEN if_wd_ovs=>co_phase_3.
*   apply result

      IF ovs_callback_object->selection IS NOT BOUND.
******** TODO exception handling
      ENDIF.

      ASSIGN ovs_callback_object->selection->* TO <ls_selection>.
      IF <ls_selection> IS ASSIGNED.

        ovs_callback_object->context_element->set_static_attributes(
                               static_attributes = <ls_selection> ).

      ENDIF.
  ENDCASE.

ENDMETHOD.

Step 12:

Now we need to create POST EXIT for method WDDOMODIFYVEW as shown below

/wp-content/uploads/2013/12/step9_339812.png

Step 13:

Write the code in post exit of method WDDOMODIFYVIEW as shown below

step9_1.PNG

Please refer the below sample code

POST_EXIT

METHOD _pst_dqxnmttuzezeszudlnztqzh4u .
  “Exit of WDDOMODIFYVIEW (in YDEMO_OVS_HELP )
  DATA lo_node TYPE REF TO if_wd_context_node.

  DATA lo_node_info  TYPE REF TO if_wd_context_node_info.

  CHECK first_time EQ abap_true.

  ” Get node ref
  “==========================
  lo_node = wd_context->get_child_node( name =
wd_this->wdctx_personaldata ).

  ” get node info reference
  “=============================
  IF lo_node IS BOUND.
    lo_node_info = lo_node->get_node_info( ).
  ENDIF.
  ” Rerurn the control if lo_nod_info is not bound
  “==========================
  IF lo_node_info IS NOT BOUND.
    RETURN.
  ENDIF.
  ” set the value help for attribute: firstname
  “==========================
  lo_node_info->set_attribute_value_help(
    EXPORTING
      name            = ‘FIRSTNAME’
   value_help_mode = if_wd_context_node_info=>c_value_help_mode-ovs
      value_help      = ‘OVS_HELP’
  ).
ENDMETHOD.

Output:

Use F4 key to get the value help for field FIRST NAME as below

/wp-content/uploads/2013/12/after_ovs_help_1_339820.png

Chose the record from value list and value of field FIRSTNAME is getting filled as below

/wp-content/uploads/2013/12/after_ovs_help_2_339822.png

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hello Ram,

      Thanks for sharing this step by step document.. Steps are clearly explained.. Thanks once again..

      Author's profile photo Ramakrishnappa Gangappa
      Ramakrishnappa Gangappa
      Blog Post Author

      Thanks Arun 🙂

      Author's profile photo Narasimha Rao
      Narasimha Rao

      Nice Document...Thank you for sharing 🙂

      Author's profile photo Ramakrishnappa Gangappa
      Ramakrishnappa Gangappa
      Blog Post Author

      Thank you 🙂

      Author's profile photo Venu P
      Venu P

      Nice Document Rama, Thank you..

      Author's profile photo Ramakrishnappa Gangappa
      Ramakrishnappa Gangappa
      Blog Post Author

      Thank you Venu 🙂