Skip to Content

Automatically Trigger onEnter event after selecting value from the Value Help(F4 Help)


This document helps how to call onEnter action handler of Input filed after selecting value in the Value Help without pressing Enter Key. In the earlier versions of Netweaver ( before Netweaver 7.4 ) you have to manually press Enter key in the Input field after selecting value from the F4 help.


SAP NetWeaver 7.4

Step by Step Process

Step 1: Create a Web Dynpro Component.

Go to the SE80 transaction and create a Web Dynpro Component.


Enter Description and click on OK.


Save and Activate the Component.

Step 2: Data Binding

Go to the Context tab of Main View and create an attribute CARRID of type S_CARRID_ID( which has dictionary search help).



Step 3: Layout Design.

   Now Go to Layout tab,

   Create label UI with text ‘Airline’ and input field. Bind the Value of Input filed to the context attribute CARRID.


Create an Action for onEnter of Input field.


Now go to Methods tab of MAIN view and write the below code ONACTIONGET_FLIGHTDATA method.


**  Get the Airline and update the dependent input fields/ view fields
**  or Get the Flight Data

*  For Demo purpose I am just displaying a success message

*  Report success message
   wd_this->wd_get_api( )->get_message_manager( )->report_success( ‘On Enter Event Triggered’ ).


Step 4: Create Application.

Save and Activate the Web Dynpro Component.  Create the Web Dynpro Application and Save it.


Enter description and save it.


Test Application

Now Right click on Web Dynpro Application and click on Test.


Now Select the F4 help in the input field.


Select the Value in the Value Help and click on OK.


After selecting the value we have to press Enter to trigger onEnter event.


Now we can see onEnter event was triggered after pressing Enter manually  in the Input Field.


It is preferable that the onEnter action handler of an Input Fields is executed directly after a value has been selected from the value help.

To Trigger the onEnter event of Input fields automatically after selecting the value from the value help, we have to call the method register_on_enter_for_f4() of interface IF_WD_VIEW_CONTROLLER.

We have to write the below code in WDDOINIT method.

  DATA lr_view_controller TYPE REF TO cl_wdr_view.

   lr_view_controller ?= wd_this->wd_get_api( ).

   lr_view_controller->if_wd_view_controller~register_on_enter_for_f4( register_on_enter = abap_true ).

Write the below code in WDDOINIT method.


method WDDOINIT .

*  Register onEnter for Value Help

  wd_this->wd_get_api( )->register_on_enter_for_f4( register_on_enter = abap_true ).


Note: This setting can be made for all value helps for each view separately by calling method register_on_enter_for_f4() in the WDDOINIT method of each view.

Save and Activate the Component.


Now Test the Web Dynpro Application.

Select the F4 help in the input field.


Select the Value in the Value Help and click on OK.


After selecting the value we can see the onEnter action handler is called automatically.



Using this feature we can make onEnter action handler to call automatically immediately after selecting the value from the Value Help. This feature is useful to update the other View Fields that are dependent on the input field by calling onEnter action handler of the input fields automatically after selecting the value from the Value Help.  Here I demonstrated a simple Web Dynpro Application. You can use this according to your requirements.

Follow me on Google+

You must be Logged on to comment or reply to a post.
      • Hi, am afraid I'm not sure. I always followed the pattern of using date navigator if I needed an immediate event on date selection. Although it is likely that by slightly changing the code I mention in my blog that you would be able to get the date to event. However, using the date navigator would be a much simpler option.

        • But can we asssign Date Navigator to Search Help of Input field.

          As of now i am using SYDATUM as field type for Input field so its populating calendar in the searh help.

          Date Navigator functionality works in the similar way

    • Hi Bhanu,

      What do you mean by custom search helps? Did you mean DDIC Z search helps! If so, the answer is yes. For all DDIC search helps this will work.

      For OVS search help, this won't trigger automatically. For OVS in the even handler of OVS you can call the method explictly.



  • Hello Kiran Kumar Valluru,

    I followed you document to register an event on I/P field.Below is the code i written in my WDDOINIT( ) of my View controller which is having one I/P field.

      DATA lr_view_controller TYPE REF TO cl_wdr_view.
      lr_view_controller ?= wd_this->wd_get_api( ).

      lr_view_controller->if_wd_view_controller~register_on_enter_for_f4( register_on_enter = abap_true ).

    But i'm getting error "IF_WD_VIEW_CONTROLLER~REGISTER_ON_EVENT_FOR_F4 is not declared or inherited in class "CL_WDR_VIEW" .Pls guide me.



    • Hi,

      Please see the prerequisite. You should be on Netweaver 7.4 to use the mentioned method. If you are on lower Netweaver version you can follow the blog which Chis Paine has mentioned above in the comments.



      • Hi Kiran,

        Will it work for the Standard Date input field?

        I have an On_Enter method for the Date input field. Will the same method will trigger the method while selecting teh date from the calendar.

        I tried but it didnt got triggered. Please give your suggestion.


        Nalla B.

        • Hi,

          No, The onEnter event will not be called automatically for date fields as there is no screen render when you select the date from date value help.



          • Thanks kiran.

            But I have a dropdown value which has to be loaded based on the dates in the input field?

            What is the possibility other than On_Enter or going for a custom button to load the values?

            Kindly give some suggestions.


            Nalla B.

          • Hi,

            As mentioned earlier, you cannot trigger Enter event automatically for date fields. You need to press Enter(or some action) after entering dates. Or, remove the date field and create a DateNavigator with events associated with it. Or creating a Freely programmed value help for calendar help which is tricky.



  • Hi Kiran,

    It is very useful.I tired it on input fields and it worked. But how to trigger the same in ALV table having input fields?.

    Because, i have To-Date field in my ALV table, if we select todate as past date and on press on enter only, It is triggering the event. I want to achieve the same as per your document.



  • Hi Kiran,

    Thanks for the blog.

    I am facing one issue with it. The action is triggering twice in my case. I am selecting the value from F4 help and its calling the same action twice.

    I am showing in one popup in this action and its coming twice.

    Is there any way to stop this?

    Thanks in Advance.



  • I have a question.Suppose i have a table with an add button on it's toolbar and an input field having F4 help.Now the user can click on add many times creating multiple blank rows.Now he/she presses on the F4 help of say xth row and selects a value.How will i get the index of the selected value?