Skip to Content
0
Former Member
Jan 07, 2013 at 04:00 PM

WD ALV set_focus doesn't work

49 Views

Hey guys,

my task is to use set_focus to switch to a specific row and column.

I had a look at the example from SAP SALV_WD_TEST_TABLE_FOCUS. Of course this works, but when i use this statements in my ALV nothing happens.

I even built the example in my ALV so i could use the same way for jumping to a special cell.

I'm really upset, because any idea i had, didn't work.

Perhaps one of you can help me with this?

My ALV contains different columns, like PSTYP, WERKS, LGORT, MENGE, MEINS, etc.

Perhaps i have to say, that the ALV is enabled for inputs. this really works fine.

but when i now try to use the example, nothing happens, although the debugger doesn't mention any problems.

I created a button and two input fields, of course with context binding.

Here's my code:

method ONACTIONSPRINGEN .

DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

lo_cmp_usage = wd_this->wd_cpuse_cpu_alv( ).

IF lo_cmp_usage->has_active_component( ) IS INITIAL.

lo_cmp_usage->create_component( ).

ENDIF.

DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .

lo_interfacecontroller = wd_this->wd_cpifc_cpu_alv( ).

DATA lo_nd_focus TYPE REF TO if_wd_context_node.

DATA lo_el_focus TYPE REF TO if_wd_context_element.

DATA ls_focus TYPE wd_this->element_focus.

* navigate from <CONTEXT> to <FOCUS> via lead selection

lo_nd_focus = wd_context->get_child_node( name = wd_this->wdctx_focus ).

* @TODO handle non existant child

* IF lo_nd_focus IS INITIAL.

* ENDIF.

* get element via lead selection

lo_el_focus = lo_nd_focus->get_element( ).

* @TODO handle not set lead selection

IF lo_el_focus IS INITIAL.

ENDIF.

* get all declared attributes

lo_el_focus->get_static_attributes(

IMPORTING

static_attributes = ls_focus ).

lo_interfacecontroller->set_focus(

column = ls_focus-column " string

index = ls_focus-index " i

).

endmethod.

Perhaps anyone had this problem too and can help me with that?

hoping for an answer,

regards

Mathias