Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

WebDynpro ALV refresh

mh97
Contributor
0 Likes
2,618

Hi all,

Can anyone help with a method I can call from within my view methods, to reset the ALV to its initial state, with no selection indicated?

Problem details:

We are on NW 7.0 EhP1. Have an ALV component in a webdynpro. We have an action link to refresh the data in the list. However on refresh whatever record that was selected previously (i.e. highlighted by orange bar) remains highlighted. Even if we set lead selection to 1, the display still shows the old record selected. Now if the user chooses an action for the selected record, they get a different record than what appears to be selected!

What we REALLY want is to COMPLETELY refresh the table, having it look like when the user first accesses the view - no record appears to be selected (no orange bar at all). ( the lead selection is actually at 1 and they will get that record if they choose 'edit selected' and that's ok.)

We have tried many things including calling the view's 'setup_ALV' method again, invalidating node before getting the data again, changing the lead selection index to 1.

Any other ideas? Has anyone else seen this problem?

Thanks,

Margaret

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,527

Hi,

Why don't you try binding an empty table to the context node which is mapped to the data node of ALV.

Thanks,

Abhishek

5 REPLIES 5
Read only

Former Member
0 Likes
1,528

Hi,

Why don't you try binding an empty table to the context node which is mapped to the data node of ALV.

Thanks,

Abhishek

Read only

Former Member
0 Likes
1,527

Hi Margaret,

This is how i refreshed my table, I declared an attribute in the attribute tab of view i have displayed the table,

and the attribute is of type dictionary tabletype then i have moved all the data that i initially selected

using the select query to this attribute say lt_sflight1.

now here i have data on another internal table say lt_sflight1.

after you have performed the related operations on table

get data back from lt_sflight1 as it contains the original data and bind them to the ALV table.

if you are hadling with two view say MAIN and DISPLAY, after you select some fields in ALV

table on MAIN view for any operation and navigate to DISPLAY then when you go back

from DISPLAY to MAIN may be using BACK button then on MAIN view open event of inbound plug

then write logic to get data from lt_sflight1 to ALV table.

sample code for that

DATA lo_nd_sflight TYPE REF TO if_wd_context_node.

DATA lo_el_sflight TYPE REF TO if_wd_context_element.

DATA: ls_sflight TYPE wd_this->element_sflight,

lt_sflight type table of wd_this->element_sflight,

lt_temp TYPE wdr_context_element_set,

wa_temp TYPE REF TO if_wd_context_element.

  • navigate from <CONTEXT> to <SFLIGHT> via lead selection

lo_nd_sflight = wd_context->get_child_node( name = wd_this->wdctx_sflight ).

lo_nd_sflight->bind_table( wd_this->lt_sflight1 ).

here lt_sflight1 containes the original data.

I hope it helped.

Regards and Best wishes.

Read only

mh97
Contributor
0 Likes
1,527

Sorry for letting this dangle for so long. I ended up submitting an OSS message because the expected solutions, such as offered above, did not work.

The answer from SAP was first that we should upgrade to at least SP5. Since we were unable to do that, on request SAP did offer a workaround, and it satisfied our requirement. Code such as the following needs to be added to each individual ALV application (lo_nd_overview is the context node for the ALV table):

*---
* get lead selection index
data:
l_index type i.

l_index = lo_nd_overview->get_lead_selection_index( ).

*---
* call refresh method of ALV

lo_nd_overview = wd_context->get_child_node(
name = wd_this->wdctx_overview ).

data:
lo_interfacecontroller TYPE REF TO iwci_salv_wd_table,
lv_refresh_in TYPE if_salv_wd_table=>s_type_param_refresh_in.

lo_interfacecontroller = wd_this->wd_cpifc_overview_alv( ).
lo_interfacecontroller->refresh( in = lv_refresh_in ).

*---
* set lead selection index
if l_index gt 0.
lo_nd_overview->set_lead_selection_index( -2 ).
lo_nd_overview->set_lead_selection_index( l_index ).
endif.

With SP5 or above, this is NOT needed - SP5 corrects the issue globally.

Thanks to each of you for your suggestions!

Read only

Former Member
0 Likes
1,527

Hi,

I know its answered thread but i found a simple solution.

I got the same issue to deselect all the records in the wedynpro ALV table.

Here is the simple solution--use in any event of webdynpro View where you want to refresh the table :

Node which is bound to ALV.

DATA lo_nd_employee TYPE REF TO if_wd_context_node.

Get the childnode

lo_nd_employee = wd_context->get_child_node( name = wd_this->wdctx_employee ).

To deselect or refresh the table without losing the records

lo_nd_employee->clear_selection( ).

Simple the table will be refreshed wihtout removing the records unllike INVALIDATE() method.

Hope this is helpfull.

Thanks.

Read only

adalid
Participant
0 Likes
1,527

With the Web Dynpro Code Wizard:

*=>Set - As Table Operation

*=>Select the node of the alv

   DATA: lo_nd_alv_node TYPE REF TO if_wd_context_node,

             lt_alv_node       TYPE wd_this->elements_nd_reporte.

    lo_nd_alv_node = wd_context->get_child_node( name = wd_this->wdctx_nd_reporte ).

*=> Add this line before to set

    FREE lt_alv_node.

    lo_nd_alv_node->bind_table( new_items = lt_alv_node set_initial_elements = abap_true ).

Regards, saludos !!