cancel
Showing results for 
Search instead for 
Did you mean: 

Placing the cursor in a Web Dynpro view

Former Member
0 Kudos

Hi,

I have a Web Dynpro view with several input fields.

I would like to be able to define wich input field the cursor is placed in by default and after a user action.

I have looked around and found requestFocus and Set Cursor. requestFocus does not seem to make the input field ready for input and Set Cursor does not seem to work in a Web Dynpro view.

Any suggestions? Is it possible to include javascript in a Web Dynpro view?

I've thought about placing a containing HTML page around the Web Dynpro view and implement the javascript there, but it's not preferable...

Br

Robin

Accepted Solutions (1)

Accepted Solutions (1)

arjun_thakur
Active Contributor
0 Kudos

Hi,

We normally use REQUEST_FOCUS_ON_VIEW_ELEM method to set the focus.

Refer Uday's reply in this thread:

I hope it helps.

Regards

Arjun

Answers (3)

Answers (3)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>I've thought about placing a containing HTML page around the Web Dynpro view and implement the javascript there, but it's not preferable...

You defintely don't want to do that. SAP changes the internal rendering of the HTML code over time and would certainly break such logic eventually. Also the way the delta rendering works in Web Dynpro would make such external javascript access even more complex.

Former Member
0 Kudos

Hi,

go thru this link it will help you a lot

thnks

Former Member
0 Kudos

Use the follwing code,

data: lo_element type ref to if_wd_view_element.
    
    CALL METHOD VIEW->GET_ELEMENT
      exporting
        id      = 'ID'      " id of your uielement in the view's layout
      receiving
        element = lo_element .
    
    CALL METHOD VIEW->REQUEST_FOCUS_ON_VIEW_ELEM
      EXPORTING VIEW_ELEMENT    = lo_element.

Regards,

Radhika.