cancel
Showing results for 
Search instead for 
Did you mean: 

Setting UI element focussed on view intialisation

selvakumar_mohan
Active Participant
0 Kudos

Hi All,

how to set the UI element focussed when an view is intialised. i came across the method REQUEST_FOCUS_ON_VIEW_ELEM. in this method what is the value to be given in VIEW_ELEMENT parameter.

Thanks,

Selvakumar M.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It expects an object reference to the UI element that you want to set focus on. I_CARRID is the ID that I named the UI element that I want to set the focus on.

method WDDOMODIFYVIEW .
  data element type ref to if_wd_view_element.
  element ?= view->get_element( 'I_CARRID' ).
  if element is not INITIAL.
    view->request_focus_on_view_elem( element ).
  endif.
endmethod.

Answers (2)

Answers (2)

Former Member
0 Kudos

write foolowing code in wddomodify().

DATA:

lo_node TYPE REF TO if_wd_context_node,

lo_element TYPE REF TO if_wd_context_element,

lo_view_contr TYPE REF TO if_wd_view_controller.

BREAK-POINT ID /plmu/ugrp_ui.

lo_node = wd_context->get_child_node( name = wd_this->wdctx_initial_screen ).

lo_element = lo_node->get_element( ).

  • Set Focus on Field 'User Group'

IF first_time = abap_true.

lo_view_contr = wd_this->wd_get_api( ).

lo_view_contr->request_focus(

EXPORTING context_element = lo_element

attribute = 'USER_GROUP_NAME' ).

ENDIF.

baskaran00
Active Participant
0 Kudos

Hi selvakumar,

U can try the below code:

u have to give the context element instance and the attribute name for which u need the focus.

DATA lo_api TYPE REF TO if_wd_view_controller.

lo_api = wd_this->wd_get_api( ).

lo_api->request_focus(

context_element = <<lo_el_...>>

attribute = <<'ATTRIBUTENAME'>> ).

Thanks,

Router