2024 Jan 09 10:51 AM
Hello,
I have an ALV OO with a custom button to copy lines (and add some modifications in the copied lines)
Each copied line is inserted below its origin line.
Its working file always but when the ALV has some filters applied.
If I apply a filter and then use the copy button not all the copied lines appears in the alv, and some of the hidden lines that dont match with the filter criteria are displayed...
If I go to the columen with the filter and apply again the filter all is displayed ok.
I think is something related with the index of the lines are been displayed with the filters...
Do you know how can I solve this issue?
I've tried using methods GET and SET FILTER CRITERIA after and before the refresh_display, but are not working.
Regards
2024 Jan 10 9:22 PM
I could reproduce easily, thanks to your good example.
In your case, the solution is to use a refresh without stable.
go_alv->refresh_table_display(
EXCEPTIONS
finished = 1
OTHERS = 2 ).
Unfortunately, if you update the internal table and refresh with stable, the ALV grid assumes that you didn't change the lines and the filter gets wrong because you changed the lines.
2024 Jan 09 11:14 AM
2024 Jan 09 11:29 AM
2024 Jan 09 12:26 PM
What value did you pass in I_SOFT_REFRESH of REFRESH_TABLE_DISPLAY ?
2024 Jan 09 2:51 PM
2024 Jan 09 3:29 PM
Did you check the questions/answers about LVC_FILTER_APPLY?
2024 Jan 10 9:01 AM
I was trying to use the FM LVC_FILTER_APPLY, but is not working yet.
I have been looking for information about this FM but is not clear to me how to use it in my scenario.
What I did is create a handler for event AFTER_USER_COMMAND and then use there the FM, like in program BCALV_TEST_GRID_EVENTS.
But is not working, the displayed data is not correct. If I use the standard Filter funtionality afterwards is showing the correct lines in the ALV.
Any clue ?
Thanks in advance.
2024 Jan 10 3:25 PM
I guess LVC_FILTER_APPLY is useful only to work on filtered lines in your own program, not to filter the lines on the screen.
Maybe the right way is to use GET_FILTER_CRITERIA and SET_FILTER_CRITERIA to reapply the filter, plus maybe a REFRESH_TABLE_DISPLAY or CL_GUI_CFW=>UPDATE_VIEW.
I don't know why it doesn't work, but if you can post a minimal reproducible program, that would help to check it for you.
2024 Jan 10 4:36 PM
Here you have, a quick alv with the same problem.
Try the following:
Execute the report and select the lines in 1.
Use the Copy button, you can see in 2 is working fine.
Exit the report and execute again, add a filter in field Purch.Org (3) with the value E001 (4).
Then select the last two lines of the ALV (5)
And use the button Copy, you can see the result is not correct (6). Its even displaying lines with a different EKORG.
If you put the filter again in the same column, then you can see the correct data (7).
If you remove all filters you can see all the lines ok.
Thanks in advance for any clue.
Regards.
PS: My real program has totally different fields, from other tables. This is only a small test report. But the problem is the same.
PS2: I'm in an old SAP versión: SAP ECC 6.0, SAP_ABA 701
2024 Jan 10 5:03 PM
2024 Jan 10 9:22 PM
I could reproduce easily, thanks to your good example.
In your case, the solution is to use a refresh without stable.
go_alv->refresh_table_display(
EXCEPTIONS
finished = 1
OTHERS = 2 ).
Unfortunately, if you update the internal table and refresh with stable, the ALV grid assumes that you didn't change the lines and the filter gets wrong because you changed the lines.
2024 Jan 11 8:37 AM
Oooook, thanks for the answer...
If they use filters only a few lines will be displayed in the ALV (I guess) so I suppose its ok.
2024 Jan 11 7:29 AM