cancel
Showing results for 
Search instead for 
Did you mean: 

Query regarding focusing the input field.

Former Member
0 Kudos

Hi all,

I have a query regarding the input field.

I have a view from which i am calling other view.There are two input fields on the second popup.

I want that when the second popup opens, then the curser postion should be the first input field.

Rightnow for inputing the value I have to click on the input field and then enter the value.

I want the by defauld the curser should blink on the first input field.

How can I achieve this .Is ther is any property of input field or way to do this.

Thanks and regards.

Vaibhav

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Vaibhav,

There are two ways to set the focus:

Using an UI element (which can be called only from WDDOMODIFYVIEWVIEW

Within the WDDOMODIFYVIEW you can pass on the ID of the inputfield that you want to focus & then specifically set the focus on it using the below coding:

data: lr_element type ref to if_wd_view_element.
    
    CALL METHOD VIEW->GET_ELEMENT
      EXPORTING
        ID      = 'INPUT2'      * id of the element in layout
      RECEIVING
        ELEMENT = lr_element
        .
    
    CALL METHOD VIEW->REQUEST_FOCUS_ON_VIEW_ELEM
      EXPORTING
        VIEW_ELEMENT    = lr_element.

You can also do it in this way as the last resort. Use the function FOCUS_BY_CONTEXT_ELEMENT of class CL_WD_INPUT_FIELD to set the focus on input field using the context attribute.

Regards,

Uday

former_member205842
Participant
0 Kudos

Hi,

    what  'INPUT2' i have to pass am not getting cursor position on input field.

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Here "INPUT2" is the name of your input field in the view layout.

Alternative solution:

you can also use WD_THIS->SET_FOCUS( exporting id_name = 'INPUT2' ) in WDDOMODIFYVIEW method.

For your reference:

Hope this helps you.

Regards,

Rama

former_member205842
Participant
0 Kudos

Thankq Ram its very help ful for me....

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello ,

In wddomodifyview method you have an importing parameter VIEW of type IF_WD_VIEW .

you can use the method IF_WD_VIEW->IF_WD_VIEW_CONTROLLER~REQUEST_FOCUS to set the

focus on the ui element by providing the required parameter.

Regards

Vivek

PS: PLease provide the points if answer is helpful .