WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (2022)

Before I start with example I should mention that you can find SAP standard demo in your SAP system DEMO_VALUE_HELP and WDR_TEST_OVS.

If standard search help does not fulfil your business requirement in web dynpro then you can implement OVS value help. OVS linked value help puts you in control of selection fields that search help will display, selection logic, and columns displayed in result and how to use value returned by user selection.

OVS value help is implemented using component WDR_OVS. The OVS value help is linked to the context attribute. Therefore, the value help is automatically available for each input field that is bound to this context attribute. WDR_OVS raises event OVS, this is where you will need to put all your coding. This event is triggered at four different times also known as phase, essentially when component expects data from used component or when selected data is available to consume. Instance attribute OVS_CALLBACK_OBJECT->PHASE_INDICATOR contains value for phase.

I will very briefly explain about what code should be included in each phase, more details about each phase is explained at link OVS Value Help .

IF_WD_OVS=>CO_PHASE_0

Here you set configuration. Window title, Group header, table header, labels if they are different from data element labels.

IF_WD_OVS=>CO_PHASE_1

Here you can specify any selection screen you want to issue before you display any result. Make sense if your result set is large as this will help user to narrow down selection. This is however optional, if you ignore this phase, PHASE_3 will be invoked. From user point of view they will get list when they take value help.

IF_WD_OVS=>CO_PHASE_2

In this phase we write logic to create list. This can be a complex logic to a normal select. In case you have implemented phase 1 you will also get selection values entered by user which you can include in you logic.

IF_WD_OVS=>CO_PHASE_3

This triggers when user has made selection from list. Typically used to fill returned value in input where user took value help.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (1)

I am going to create a simple Web Dynpro with input based on field SCARR-CARRID. Automatic search help on this field is based on search help S_CARRIER_ID

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (2)

Using WDR_OVS component I will implement search to display values based on plane type. I will do this in steps to explain one thing at a time

Let gets started.

Create Web Dynpro ZPW_OVSDEMO1 with Window ZPW_DEMOOVS1 and view MAIN.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (3)

Now go to view context and create Node based on dictionary structure SCARR and ‘Add Attribute from Structure’ CARRID to screen.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (4)

We have context attribute, let add this to screen as input. Go to layout tab and right click on ROOTUIELEMENTCONTAINER and choose ‘Create Container Form’ option. On next screen press ‘Context’ button and choose node FLIGHT and press OK.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (5)

You should now have Airline input on screen. At this point create web dynro application and activate all objects. If you test web Dynpro and take value help on input Airline you will get SAP standard value help based on search help S_CARRIER_ID .

To implement OVS search help first step is to add component WDR_OVS to web Dynpro.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (6)

Navigate to view MAIN and define component usage for WDR_OVS using new button.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (7)

Next go to context of view and navigate to attribute CARRID. In property tab change ‘Input Help Mode’ to ‘Object Value Selector’ and in input ‘OVS Component Usage’ enter name of WDR_OVS component which is OVS in this case.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (8)

Finally go to methods tab and defined event handler method for event OVS of component used.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (9)

If you double click on method ON_OVS to open it code you will see system automatically put most of the code there including a CASE statement on OVS_CALLBACK_OBJECT->PHASE_INDICATOR. We just need to put code under right WHEN block. However I am going to delete this code and put just what I need to implement a simple value help without any selection screen. Little steps at a time.

In this simplest example I have defined structure lty_stru_list which is like report structure. An internal table lt_select_list of line type lty_stru_list will hold data that will be displayed to user. In phase 2 we have code which selects data from table sflight. Note that I have defined range type for planetype which I am using in select statement. In this case it blank but in coming example I will create selection screen and fill this range with what user has entered. In phase 3 based we assigned selected CARRID value to context element.

METHOD on_ovs . TYPES: BEGIN OF lty_stru_list, carrid TYPE sflight-carrid , planetype TYPE sflight-planetype , END OF lty_stru_list. DATA: lt_select_list TYPE STANDARD TABLE OF lty_stru_list. FIELD-SYMBOLS: <ls_selection> TYPE lty_stru_list . CASE ovs_callback_object->phase_indicator. WHEN if_wd_ovs=>co_phase_0. "configuration phase, may be omitted WHEN if_wd_ovs=>co_phase_1. "set search structure and defaults WHEN if_wd_ovs=>co_phase_2. TYPES : tr_planetype TYPE RANGE OF sflight-planetype . DATA : lt_planetype TYPE tr_planetype . SELECT carrid planetype INTO TABLE lt_select_list FROM sflight WHERE planetype IN lt_planetype . 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_attribute( name = 'CARRID' value = <ls_selection>-carrid ). ENDIF. ENDCASE.ENDMETHOD.

Hope this piece of code is clear to you. At this point you can activate the web dynpro and test it. What we demonstrated here is you have total control over column and rows.

Lets build on this and introduce selection screen to before displaying values. To display select screen first thing we need is a structure definition for fields being displayed as part of selection screen. We have defined type lty_stru_input and structure ls_search_input of this type. In plase 1 we will pass ls_search_input to ovs which will automatically build selection screen. In phase 2 we will extract value entered by user in selection screen and fill that in range. With these extra logic code look like this.

METHOD on_ovs . TYPES: BEGIN OF lty_stru_list, carrid TYPE sflight-carrid , planetype TYPE sflight-planetype , END OF lty_stru_list. TYPES: BEGIN OF lty_stru_input, planetype TYPE sflight-planetype , END OF lty_stru_input. DATA: lt_select_list TYPE STANDARD TABLE OF lty_stru_list, ls_search_input TYPE lty_stru_input . FIELD-SYMBOLS: <ls_selection> TYPE lty_stru_list , <ls_query_params> TYPE lty_stru_input. CASE ovs_callback_object->phase_indicator. WHEN if_wd_ovs=>co_phase_0. "configuration phase, may be omitted WHEN if_wd_ovs=>co_phase_1. "set search structure and defaults ovs_callback_object->set_input_structure( input = ls_search_input ). WHEN if_wd_ovs=>co_phase_2. 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 ELSE. TYPES : tr_planetype TYPE RANGE OF sflight-planetype , ty_planetype TYPE LINE OF tr_planetype . DATA : lt_planetype TYPE tr_planetype , ls_planetype TYPE ty_planetype . IF <ls_query_params>-planetype IS NOT INITIAL . ls_planetype-sign = 'I' . ls_planetype-option = 'EQ' . ls_planetype-low = <ls_query_params>-planetype . APPEND ls_planetype TO lt_planetype . ENDIF. ENDIF. SELECT carrid planetype INTO TABLE lt_select_list FROM sflight WHERE planetype IN lt_planetype . 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_attribute( name = 'CARRID' value = <ls_selection>-carrid ). ENDIF. ENDCASE.ENDMETHOD.

This is screen shot of value help with selection screen.

WebDynpro - OVS Value help using WDR_OVS - My Experiments with ABAP (10)

Finally, I am going to add code under phase 0 to set various text.

 WHEN if_wd_ovs=>co_phase_0. "configuration phase, may be omitted DATA : 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_group_header TYPE string, lv_table_header TYPE string. ls_text-name = 'PLANETYPE'. ls_text-value = 'Enter plane type'. INSERT ls_text INTO TABLE lt_label_texts. ls_text-name = `CARRID`. "must match a field in list structure ls_text-value = 'Airline ID'. "wd_assist->get_text( `002` ). INSERT ls_text INTO TABLE lt_column_texts. lv_window_title = 'Window title' . lv_group_header = 'Group Header' . lv_table_header = 'Table Header' . ovs_callback_object->set_configuration( label_texts = lt_label_texts column_texts = lt_column_texts group_header = lv_group_header window_title = lv_window_title table_header = lv_table_header ).

FAQs

What is OVS in Web Dynpro ABAP? ›

OVS linked value help puts you in control of selection fields that search help will display, selection logic, and columns displayed in result and how to use value returned by user selection. OVS value help is implemented using component WDR_OVS. The OVS value help is linked to the context attribute.

How do I create a search help in Web Dynpro ABAP? ›

OVS F4 help in Standard application in Webdynpro ABAP
  1. Step1: ...
  2. Step2: ...
  3. Create the component usage OVS_HELP by using standard ovs component WDR_OVS as shown below.
  4. Open view VW_PERSONALDATA and click on enhance ( ctrl + f4 ) button as show below.
  5. Chose the enhancement implementation YDEMO_OVS_HELP as shown below.
Dec 10, 2013

How do I add assistance to Web Dynpro? ›

Go to the web dynpro component. We can provide the assistance class here. Maintain the class name here which is now treated as Assistance class. In the component controller, attribute tab we find an object WD_ASSIST is created which points to the assistance class.

How do you test Web Dynpro? ›

To check fully qualified domain name, go to Web Dynpro explorer in the ABAP development environment use T-code − SE80 and select the Web Dynpro application from the navigation tree for your Web Dynpro component/interface and check the URL in the administration data.

How do you validate input fields in Webdynpro ABAP? ›

How to validate the fields on OVS window – Webdynpro ABAP
  1. DATA lo_ovs TYPE REF TO iwci_wdr_ovs.
  2. DATA lo_context TYPE REF TO if_wd_context.
  3. DATA lo_context_node TYPE REF TO if_wd_context_node.
  4. DATA lo_el TYPE REF TO if_wd_context_element.
  5. ” get reference of ovs component usage.
  6. lo_ovs = wd_this->wd_cpifc_test_ovs( ).
Dec 30, 2013

How many phases are there in OVS? ›

There are 4 phases for an OVS ( 0, 1, 2, 3, 4 ). All the 4 phases will be called one after the other.

How do I add a search help to selection screen field in SAP ABAP? ›

Attach Search Help to Selection Screen Field
  1. Enter the transaction code as SE11 in the command field.
  2. Select the radio button for Search help and enter a name for the custom Search help. ...
  3. On the next screen select the option 'Elementary search help'.
  4. Give some description for the search help.

How do you make an F4 help for a parameter in ABAP? ›

To display F4 help values in popup window, we use function module:
  1. F4IF_FIELD_VALUE_REQUEST if suitable SEARCHHELP already exists in system (SE11>Search help) ...
  2. F4IF_INT_TABLE_VALUE_REQUEST if select options can be provided in an itab table.
Mar 2, 2020

How do I assign a search help in SAP ABAP? ›

SAP ABAP - Search Help
  1. Step 1 − Go to transaction SE11. ...
  2. Step 2 − The system will prompt for the search help type to be created. ...
  3. Step 3 − In the selection method, we need to indicate whether our source of data is a table or a view. ...
  4. Step 4 − After the selection method is entered, the next field is the Dialog type.

How many assistance classes does Webdynpro ABAP have? ›

A web dynpro component will have only one assistance class and it is defined at the component level as per the screenshot below. The assistance class is automatically instantiated when a component is called.

Which component type is used for displaying data in ALV? ›

SAP List Viewer is used to add an ALV component and provides a flexible environment to display lists and tabular structure. A standard output consists of header, toolbar, and an output table.

Which method do you use to read the contents of a attribute attached to the context node? ›

GET_ATTRIBUTE method of interface IF_WD_CONTEXT_NODE to retrieve value of context element. The GET_ATTRIBUTE method retrieves the value of an individual field/attribute of of context element. This is the simplest form of attribute to set as you can reference it directly using the WD_CONTEXT attribute.

Can we create Tcode for Web Dynpro? ›

Go to the Transaction Code SE93 and give the name of the transaction code that needs to be created and press the Create button. Give the Transaction WDYID and select the initial Skip Screen Button.

How do I run a Web Dynpro application in SAP? ›

A Web Dynpro application for this simple Web Dynpro component, which can be run in the browser will be created. Step 1 − Go to T-Code − SE80 and select Web Dynpro component/intf from the list. Step 2 − Create a new component as the following. Step 3 − Enter the name of the new component and click on display.

How do I open Web Dynpro in SAP? ›

Navigate in transaction SE80 to the required Web Dynpro application and open it. The application is started with URL parameter sap-config-mode=X. To start a Web Dynpro application in customizing mode on the SAP NetWeaver Portal, it is sufficient to start the application in preview mode.

Which of the following are the input help mode in Web Dynpro? ›

Search help mechanism in Web Dynpro is tightly linked to ABAP dictionary. As long as you bind Input field to context which is defined with reference to dictionary, system will provide you standard search help, including values from check table, values table or domain fixed values.

How do I add custom fields in standard Web Dynpro? ›

WebDynpro context for creation of screen field including standard search help
  1. Step 1 - First create a basic web dynpro application. ...
  2. Step 2 - Create context node globally within component controller. ...
  3. Step 3 - Context node details. ...
  4. Step 4 - Choose node attributes. ...
  5. Step 5 - Assign COMPONENTCONTROLLER context to VIEW context.

You might also like

Latest Posts

Article information

Author: Msgr. Refugio Daniel

Last Updated: 10/07/2022

Views: 5493

Rating: 4.3 / 5 (54 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.