Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Kiran_Valluru
Active Contributor
31,001

Introduction

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.

Prerequisites

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.

ONACTIONGET_FLIGHTDATA
method ONACTIONGET_FLIGHTDATA .

**  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' ).

endmethod.

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.

WDDOINIT

method WDDOINIT .

*  Register onEnter for Value Help

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

endmethod.

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.

Result

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.

Conclusion

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+

19 Comments
Labels in this area