Skip to Content

Overview

I have seen this question raised a couple of times in the Web Dynpro ABAP community,

How can a developer prevent the user from manually typing a value into an InputField, and instead force the user to use the field’s search help to enter a value?

It is possible to achieve this scenario with a little slight-of-hand on the view.

Procedure

1.0 Create Context Node FLIGHT

In the component controller, create a 1..1 context node named FLIGHT with a single attribute CARRID of type SFLIGHT-CARRID, then map context node FLIGHT to the view’s context.

2.0 Create the View

Here comes the slight-of-hand. Instead of using one InputFIeld, we use two, one which is read-only and echoes the user’s search help selection and another which is invisible to the user but contributes its search help functionality to the view.

  • Create InputField READ_ONLY_FIELD. Set its readOnly property to true, and bind its value property to context attribute FLIGHT-CARRID.
  • Create InputField INPUT_FIELD. Set its width property to 0px, and bind its value property to context attribute FLIGHT-CARRID.

Because we have given INPUT_FIELD a width of zero pixels, the field itself is invisible to the user, and the user is prevented from manually typing a value into the field. However, INPUT_FIELD’s search help is still visible to the user, and the user may use the search help to select a value. Because READ_ONLY_FIELD is bound to the same context attribute as INPUT_FIELD, it will display the value selected from the search help.

Result

It will appear to the user that there is only a single field on the view. Because that field is read-only, the user is forced to use the search help to enter a value into the field.

airline_1.JPG

airline_2.JPG

airline_3.JPG

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Former Member

    Unfortunately it’s still possible to navigate to this 0px-field with tab-key and enter any value.

    But nevertheless nice-looking solution to keep in mind. Thanks!

    (0) 

Leave a Reply