on 02-08-2011 6:57 AM
Hi,
I have a table(not alv) with single editable cell as fifth cell. Now users want focus to be on that field when table opens and move to next editable cell once enter is pressed. How do I achieve this?
Regards
Pekka
hi pekka
Create an attribute of type ref to IF_WD_VIEW in tehe context. under the main context node itself. give its name as view.
write some code in the wddomodify.
like as shown below.
if first_time eq abap_true.
data node type ref to if_wd_context_node.
data ele type ref to if_wd_context_eleMENT.
node = wd_context->get_child_node( '<node name>' ). "write your node name here which is used as data source for table
ele = node->get_element( 1 ).
DATA VEL TYPE REF TO IF_WD_VIEW_ELEMENT.
VEL ?= lv_view->GET_ELEMENT( '<view ele id>' ). "write the view element id of the fifth cell 's cell editor's id
lv_view->REQUEST_FOCUS_ON_VIEW_ELEM(
view_element = VEL
CONTEXT_ELEMENT = ELE
).
wd_context->set_attribute(
name = 'VIEW'
VALUE = VIEW
).
endif.
and write the following code in the onenter eventhandler.
DATA lv_view TYPE REF TO IF_WD_VIEW.
WD_CONTEXT->get_attribute(
EXPORTING
name = `VIEW`
IMPORTING
value = lv_view ).
DATA INDX TYPE I.
DATA EL TYPE REF TO IF_wD_CONTEXT_ELEMENT.
EL = WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ).
INDX = EL->GET_INDEX( ).
INDX = INDX + 1.
data node type ref to if_wd_context_node.
data ele type ref to if_wd_context_eleMENT.
node = wd_context->get_child_node( '<node name>' ). "write your node name here which is used as data source for table
ele = node->get_element( INDX ).
DATA VEL TYPE REF TO IF_WD_VIEW_ELEMENT.
VEL ?= lv_view->GET_ELEMENT( '<view ele id>' ). "write the view element id of the fifth cell 's cell editor's id
lv_view->REQUEST_FOCUS_ON_VIEW_ELEM(
view_element = VEL
CONTEXT_ELEMENT = ELE
).
thansk
sarbjeet singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sarbjeet
Just wanted to say this was very helpful solution. I had the same challenge as Pekka and this worked perfectly.
(In wddomodify I had to change it slightly to make it work;
From:
VEL ?= lv_view->GET_ELEMENT( '<view ele id>' ).
lv_view->REQUEST_FOCUS_ON_VIEW_ELEM(...
to:
VEL ?= view->GET_ELEMENT( '<view ele id>' ).
view->REQUEST_FOCUS_ON_VIEW_ELEM(...
Best regards,
Gunnar
Hi Pekka,
Try using this method,
REQUEST_FOCUS or IF_WD_VIEW_CONTROLLER of IF_WD_VIEW_CONTROLLER or
REQUEST_FOCUS_ON_VIEW_ELEM of if_wd_view. It may helps you.
Thanks,
Kris.
Edited by: kissnas on Feb 8, 2011 8:11 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
23 | |
11 | |
9 | |
9 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.