2010 Feb 16 8:18 AM
Hi,
Scenario:
This thread is linked to the post:
The scenario is that I have an ALV grid on which I have added a button to perform the 'Refresh' operation. On pressing this button, the data is retrieved from the database and displayed back.
Issue:
The problem is that when I sort any field (by using the generic ALV sorting functionality) in ascending order and then press the "Refresh' button, the sort order is lost which I would like to avoid as this will be frustrating for the user to sort the result set after pressing the 'Refresh' button.
To give a clear picture of the issue, if you try to execute the SAP delivered program: SALV_DEMO_TABLE_REFRESH, i found that the behavior is the same.
Inputs:
As my scenario was similar to this I selected the option 'Output as Grid' on the selection screen and the number of records as 5. On the result screen, I select the field 'Occupied' and sort this in Ascending order. Now I press the button 'Double Data Records and Select Rows'. (This will refresh the grid).
Now when you get the result back, the sort order is lost and the data is displayed as it was retrieved from the database table. It does not maintain the sort order.
Kindly suggest. I fighting this issue for a long time..:(
Regards
s@k
2010 Feb 16 9:40 PM
If you have not reviewed this excellent set of articles on NetWeaver SALV, read Mr. Heilman on the subject. The article referenced below includes get_sort, set_sort methods...
I trust this will be helpful, at least, to your problem....
Regards,
Dave
If you have not reviewed this excellent set of articles on NetWeaver SALV, read Mr. Heilman on the subject. The article referenced below includes get_sort, set_sort methods...
I trust this will be helpful, at least, to your problem....
Regards,
Dave
2010 Feb 16 9:40 PM
If you have not reviewed this excellent set of articles on NetWeaver SALV, read Mr. Heilman on the subject. The article referenced below includes get_sort, set_sort methods...
I trust this will be helpful, at least, to your problem....
Regards,
Dave
2010 Feb 17 7:35 AM
Dear Dave,
Thanks for your response...:)
The approach I followed is:
Before executing the 'user command' method, i have set the 'Sort' criteria using the: get_lvc_sort and set_lvc_sort methods of the class cl_salv_controller_metadata.
The sort order is retained after the Refresh button is pressed...
Regards
s@k
2010 Feb 18 8:23 PM
you have to clear the sort order and then refresh.
lr_sorts = gr_alv->get_sorts( ).
lr_sorts->clear( ).
gr_alv->refresh( ).
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |