09-18-2008 12:38 PM
Hello ABAP gurus,
Could you please tell me a method, how ABAP can set the focus back to an input field field after the user double clicked something inside a control?
I want to loose the focus from a Tree Control and set the focus somewhere else to the let the user scan values in a standard GUI input / output field again.
This doesn't work:
CLASS lcl_event_handler IMPLEMENTATION.
...
METHOD on_item_double_click.
...
SET CURSOR FIELD gs_gui_field-matnr.
Thanks alot in advance,
Benjamin
09-18-2008 4:39 PM
@Naimesh Patel: This works! I didn't think that registered events do use PBO. One minor issue: the clicked point in the tree is still highlighted. Could I remove every selection in the tree control?
Thanks & regards,
Benjamin
Edited by: Ben Horn on Sep 18, 2008 5:40 PM
09-18-2008 3:29 PM
I think this was a wrong answer. So i deleted the answer. The response next to this one i think it could help you.
bye,
Andrew83.
Edited by: Andrew83 on Sep 18, 2008 4:52 PM
09-18-2008 3:43 PM
Watch if this help you.
First create a Table like this for the dynpro fields.
data:
BEGIN OF type_dynpro_tab,
field LIKE help_info-dynprofld, "current field(get cursor field)
END OF type_dynpro_tab.
Then field the table at the begining.
t_dynpro_tab-field = 'FIELD1'. APPEND t_dynpro_tab.
t_dynpro_tab-field = 'FIELD2'. APPEND t_dynpro_tab.
t_dynpro_tab-field = 'FIELD3'. APPEND t_dynpro_tab.
t_dynpro_tab-field = 'FIELD4'. APPEND t_dynpro_tab.
Then in PAI do the :
GET CURSOR FIELD field_aux.
Then in USER_COMMAND define a
when 'DOUBLE_CLICK". "Or the OKCODE you has asigned
for case sy-ucomm. Here you will have the current field "field_aux". So now you have to:
READ table t_dynpro_tab with key field = field_aux.
aux_index = sy-tabix + 1.
read table t_dynpro_tab index aux_index.
next_field = t_dynpro_tab-field.
So now you will have as you define the next field you want to make the TAB.
Next in PBO Proccess just do:
SET CURSOR FIELD next_field.
Bye,
Andrew83.
Rewards is this is a helpfull answer. Thanks!
Edited by: Andrew83 on Sep 18, 2008 4:45 PM
09-18-2008 3:50 PM
YOu can set the focus on the ALV using the method SET_CURRENT_CELL_VIA_ID of the class cl_gui_alv_grid.
Check out this blog: It shows, how to use this method.
http://help-abap.blogspot.com/2008/09/move-cursor-to-next-row-by-pressing.html
Regards,
Naimesh Patel
09-18-2008 4:08 PM
Thank you both for your quick replies. Well maybe I didn't make myself clear:
--> My focus is already in the Grid/Tree Control.
--> I'd like to set the focus on the standard GUI field (no control, just normal PBO/PAI controlled screen field).
Let's have a look at this SAP example: SAPSIMPLE_TREE_CONTROL_DEMO
Imagine when you would click on "Child1" on the left the cursor would move to field NODE_DOUBLE_CLICK on the right side of the screen.
This is exactly what I'm trying to do...
Is it possible?
Edited by: Ben Horn on Sep 18, 2008 5:09 PM
09-18-2008 4:16 PM
Yes it is possible, if you double click on your node.
I copied the program SAPSIMPLE_TREE_CONTROL_DEMO to Z with includes and screen.
I put the statement in PBO like:
set cursor field 'G_EVENT'.
So, after double clicking on the left tree.. on any node.. It moves the cursor to field event on the right side.
Regards,
Naimesh Patel
09-18-2008 4:39 PM
@Naimesh Patel: This works! I didn't think that registered events do use PBO. One minor issue: the clicked point in the tree is still highlighted. Could I remove every selection in the tree control?
Thanks & regards,
Benjamin
Edited by: Ben Horn on Sep 18, 2008 5:40 PM
09-18-2008 4:44 PM
Yes that can be achieved too. Use the methoc UNSELECT_ALL of the TREE.
Like:
call method g_tree->UNSELECT_ALL.
Regards,
Naimesh Patel
09-18-2008 4:53 PM
yes,
call method dw_tree->unselect_all.
for example wiill work fine.
Bye,
Andrew83.