cancel
Showing results for 
Search instead for 
Did you mean: 

ALV grid on the view keeping stale data

Former Member
0 Kudos

Hi All,

I am creating an application in WDA in which we had decided to simply use tablui component. But later due to the nature of the requirements I decided to switch from that to ALV grid ( mainly for sorting and exporting to excel functionality advantages).

There is a button which when clicked populates the data in the alv grid. ( there is a RFC which exports an internal table with data ) and i use the bind_table method to fill the ALV context node with the data. The Node has been mapped properly from component controller to the interface controller. And the code for populating the grid is written in the Action of the button.

But my problem is after first population of the data in the alv( which works perfectly alright), if i chnage the selection criteria and again click the button my internal table (which is passed in the bind_table method) is getting loaded with new set of data( i know that since i saw the internal table contents by debugging) but the alv grid on the screen is not refelecting the same.

Ive tried using lo_nd_ctx_vn_alv->invalidate( ). here n there but doesnt work at all. In fact if invalidate is used then the ALV grid doesnt populate even once.

The code is as follows :

the node name is ctx_vn_alv.

the data comes from rfc and is recieved in it_alv .


    data lo_nd_ctx_vn_alv type ref to if_wd_context_node.
    data lo_el_ctx_vn_alv type ref to if_wd_context_element.
    data ls_ctx_vn_alv type wd_this->element_ctx_vn_alv.

*   navigate from <CONTEXT> to <CTX_VN_ALV> via lead selection
 lo_nd_ctx_vn_alv = wd_context->get_child_node( name = wd_this->wdctx_ctx_vn_alv ).
    lo_el_ctx_vn_alv = lo_nd_ctx_vn_alv->get_element(  ).
   

    lo_nd_ctx_vn_alv->bind_table( it_alv ).

Edited by: bhaumik1987 on Mar 21, 2011 1:02 AM

Edited by: bhaumik1987 on Mar 21, 2011 1:13 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Bhaumik,

I think no need to write this code to get data using service call..

Just call Execute method in component controller from your view controller.

For example you have a button GETDATA, in on action of this button just call method. (use code wizard ) or

DATA lo_COMPONENTCONTROLLER TYPE REF TO IG_COMPONENTCONTROLLER .

lo_COMPONENTCONTROLLER = wd_this->get_componentcontroller_ctr( ).

lo_componentcontroller->execute_<YOUR EXECUTE METHOD NAME>.

Check this example for more details..

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9cb5d345-0801-0010-6a8e-fc57c23fd...

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a189b0ee583b8be10000000a421937/frameset.htm

Cheers,

Kris.

Edited by: kissnas on Mar 21, 2011 7:12 AM

Former Member
0 Kudos

No the RFC is needed because the Data is on another system than webdynpro. But I mainly need to know that if I am simply populating the ALV from the internal table contents using the bind_table method then why doesnt that work.

I read on certain posts in this forum that there is some bug in the ALV component of WDA. I just want to know if that is certain.

Thanks.

Former Member
0 Kudos

Hi,

If you use service call.. it will create a context in component controller i mean your RFC or BAPI will create as a node in component controller and one execute method in component contrtoller.

from view you need to call that method to execute.

if you want to populate data in alv as normal, no need to create service call.. or if you want to populate data through service call

follow as above.

Example also there check that once..

Cheers,

Kris.

Edited by: kissnas on Mar 21, 2011 2:01 PM

Former Member
0 Kudos

Ok appreciate you help a lot. But there are other elements on the UI (drop down ) which are also being populated by RFC perfectly okay( FM which has been written somewhere else than the webdynpro system). There is no problem with the RFC.

The problem is specifically with the ALV component in WDA. Please suggest something which can flush the old data out of the ALV and when i click on the button again it populates the ALV with new data.

Former Member
0 Kudos

Hi,

you might try to do the

IF_SALV_WD_TABLE_SETTINGS method SET_REFRESH_ON_DATA_CHANGE and

salv_wd_table method refresh after you refresh the internal table.

0 Kudos

Hi,

I just discovered this thread after quite sometime of googling.

My issue was that the ALV sorting was not applied after new data was assigned to the context node (using BIND_TABLE), the sorting icon in the column head stayed there nonetheless. Other ALVs in the same application re-applied the sorting, when their data was refreshed in the same way.

Baskarans remark about the REFRESH_ON_DATA_CHANGE behaviour finally led me to the solution: In my case thr ALV was configured to REFRESH_DATA_ONLY by coding I was not aware of.

The default value is REFRESH_AND_APPLY_SERVICES, which does the sorting again after new data was received.

...for all future google-searchers.

[Now to the next issue of setting the lead selection again after re-sorting.]

Regards

Robert