Skip to Content

How to get cursor in input field?

Hi experts,

I have an input field, this is the only input field on my view ( a popup). How can I place the cursor in this input field so that the user can just start entering values? Otherwise the user has to first click on the field to make it active. The InputField UI element has no attribute relating to cursor, so is there some different way??

Thanks and regards,


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 12, 2010 at 10:04 AM

    Hi ,

    Try to use REQUEST_FOCUS() method of IF_WD_VIEW_CONTROLLER .

    Pass the input field reference to the method.



    Add a comment
    10|10000 characters needed characters exceeded

    • Aditya Karanth is right.

      using the following example coding:

           lo_Node      type ref to If_Wd_Context_Node,
           lo_Elem      type ref to If_Wd_Context_Element,
           lo_ctrl    TYPE REF TO IF_WD_VIEW_CONTROLLER .
        lo_ctrl = wd_this->wd_get_api( ).
        lo_Node = wd_Context->get_Child_Node( Name = 'NODE' ).
        lo_Elem = lo_Node->get_element( ).
      * set cursor
            CONTEXT_ELEMENT = lo_Elem
            ATTRIBUTE       = 'I_MATNR'
      "here, I_MATNR is my  context attribute bound to input field named "Material Number"

      However, this method needs your context node's cardinality as '1..1'. In fact, your input attributes are jsut '1..1'..

  • Posted on Oct 12, 2010 at 12:40 PM

    Thank you for your hints. I am now able to place the cursor in my input field. Especially once I realized I need to use a context node instead of just a context attribute 😊

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.