cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Focused UI element on the Window in 7.01

Former Member
0 Kudos

HI,

We were on 7.00 and recently upgraded to 7.01. we have a problem with the upgrade.. The window object no more holds the Focus . Here is the code ... lo_curr_window->focus is blank all the times.. This was working fine till 7.00 and now it stopped working..

data:lo_window_manager type ref to if_wd_window_manager,

lo_api_component type ref to if_wd_component.

data: lo_clnt_appl type ref to cl_wdr_client_component,"CL_WDR_CLIENT_APPLICATION,

ls_view_mgrs type wdr_viewman_line,

lo_curr_window type ref to cl_wdr_window,

ls_focus type wdr_focus,

lo_uielem type ref to cl_wd_uielement,

lv_path type string,

lo_selected_elem type ref to if_wd_context_element,

lt_strtab type table of string,

lv_colname type string,

lv_tablen type int4.

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

lo_clnt_appl ?= lo_window_manager.

read table lo_clnt_appl->view_managers_for_window

into ls_view_mgrs with key name = `ZWD_TEST`.

if sy-subrc = 0.

  • *********************************************************************

  • get the window in which this interface view is embedded

lo_curr_window = ls_view_mgrs-view_manager->get_window_recursive( ).

if lo_curr_window is initial.

lo_curr_window = wdr_task=>application->application_window->get_active_modal_window( ).

endif.

  • *********************************************************************

if lo_curr_window is not initial.

ls_focus = lo_curr_window->focus.

lo_uielem ?= ls_focus-view_element.

endif.

endif.

Thanks

Mahesh

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You seem to be utlitzing SAP internal APIs - so a change in behaviour between releases certainly seems possible. Refer to the online help to find out which APIs are safe to use:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/64/be5b4150b38147e10000000a1550b0/frameset.htm

What exactly are you trying to acomplish? From your code you seem to be trying to get the UI element that has the current focus. Is that correct? To what purpose?

Perhaps you should review the online help section on Focus Handling:

vhttp://help.sap.com/saphelp_nw70ehp1/helpdata/en/c0/800f02bb734dd9977a64a8a7e87fe3/frameset.htm

Former Member
0 Kudos

Hi Thomas,

Thanks for the reply.. I did go through these links but did not get any help.

We have time entry application.. we have long text entry for each cell of the table( each day of the week). When user want to enter text for a specific day, He need to put the cursor in that cell and click on the button whichi is in the table toolbar.. When user clicks on the button based on the focus we get the UI element and the Element Context and show the popup to enter text and save the text back to the element context once the window is closed.

Thanks

Mahesh

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Can't you just determine the selected element via leadSelection? That is generally how such processing is handled. Either that or consider putting the button within the row of the table instead of on the toolbar - then you will receive the triggering element in the event parameters.

Former Member
0 Kudos

Hi Thomas,

1) we are not selecting any row of the table... so we cannot use lead selection.

2) Even though if i put a text button in each row.. how would i know for which day in that row the user want to enter text for?. We did that what SAP does in the time entry application user can enter text just by placing the cursor on a cell and click the text button..

Thanks

Mahesh

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I've thought about this for a while and I can't think of good solution. If you were changing the data in the inputField, you could use the context change log to determine the cell - but that doesn't sound like this is the case. You can't use lead selection or any other element level event because you also have to determine the column as well, right? There is no public API that exposes the exact element with focus. In 7.02 you can have multiple cell editors, so then you could add a small button to each cell - but that won't help you until you get to the next enhancement package. Perhaps someone else will think of a solution I'm missing.

Former Member
0 Kudos

Mahesh,

How are you creating the columns - are they static or created dynamically. How many columns you are displaying for a given row.

I am presuming you are dispalying 7 columns for a week, you can add one extra column for each day of the week in the table and then you can store the relationship between first cell and it's button. This way you can derive the cell for which user wants to enter the long text on click of the button.

Edited by: Rohit Chowdhary on Jan 14, 2010 8:45 PM