Application Development 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: 

Problems with refreshing ALV-Grid (OO)

Former Member
0 Kudos

Hello everybody,

I'm working with some editable ALV Grid (object oriented with method set_table_for_first_display) at the moment.

Therefor I got the following problem: I want to refresh the list after some user has entered / changed any value. This is for sure no problem while working with method refresh_table_display in event data_changed_finished. The refresh works fine so after any input the list gets updated as I want to. But my problem is that the list is getting refreshed to slow.

E.g. I got an ALV grid with 10 entries. In every row I have the column 'area'. I want to type in the same value 'N001' in every 'area' field. So I only work with the keyboard by using the arrow keys to get from cell to cell. So I'm working like this: first typing in 'N' in cell1 then go to next cell by using arrow down then typing in N again and so on. And it looks like that this method is too fast for the ALV grid refresh because often my typed in value will get lost because of the refresh of the list in the same moment.

So is there any way to get this better or do I have to live with the 'slow' refresh?

Kind Regards

Michael Boguth

9 REPLIES 9

Former Member
0 Kudos

Anyway I found out that it is connected to event mc_evt_modified. Only when using this event, I just got the problem. But without that event I do not get the problem, but the refresh only works with clicking enter of course.

0 Kudos

Do you have any button which is used after the data has been updated? Say, 'SAVE DATA'.

In that case, why dont you check whether the SY-UCOMM is equal to 'SAVE DATA' to make sure the data is updated in the Output table when the button is pressed and not for any other sy-ucomm.

IF sy-ucomm is eq 'SAVEDATA' then call CHECK_CHANGED_DATA.

In that case, you dont have to use Enter every time when you change some data and keep on using MC_EVT_MODIFIED.

Former Member
0 Kudos

Hi Michael,

How are you triggering the DATA_CHANGED_FINISHED event? By pressing Enter?

If you are, why dont yo avoid pressing Enter, until you have all the rows updated.
Let me know if you meant some thing else.

Cheers,

Shambu

Former Member
0 Kudos

Hello Shambu,

I'm not sure if you understood me the right way. This is possible because mabye my explanation was not that good 🙂

The situation is the following: I got an editable ALV Grid with some dropdown fields and some fields where you can enter any costs. I want to get the list updated immediately after a user has entered any value, because of for example the column width optimizing.

So when a user types in e.g. a price which is longer than the actual width of the column, I want that the column width will be updated immediately after leaving the cell and without clicking enter furthermore. Therefor I use MC_EVT_MODIFIED because without it it will get updated only after clicking enter.

But the problem is that event modified looks like that it is working to slow. I can see it the best when working with the drop down fields. I click on the first drop down field and choose one of the values of the list. Then I go immediately to the next drop down field and trying to chose the next value. But before choosing this it looks like a refresh, because the system closes the list automatically and I have to click a second time on the drop down for changing it.

DATA_CHANGED_FINISHED will be triggered by MC_EVT_MODIFIED and MC_EVT_ENTER.

Regards

Michael

0 Kudos

Hi Michael,

yeah, the data_changed is processed synchronously with the user input, but the data_changed_finished is processed asynchronously, after there was some change. So you can take this as a callback-method.

I'd say, that your requirement will just no work the way you want. I for myself would also find it somewhat distracting, if the column's size would change right after my input. I would expect the ALV grid to pre-set the column width before, so that there's no back and forth.

I've also played around with these events / registrations, when I wanted to have buttons appear/dis-appear from the grid depending on the user input, right after the input was done (like you said). And the final way that I found out was exactly where you're at:

  • - Processing / new data calculation based on event data_changed
  • - Refresh the table display on the data_changed_finished event to have a correct display again

So I can't say more than, that you were already absolutely right

Take care

   Florin

0 Kudos

Hello Florin,

so which variant would you prefer? I've been testing around with some different issues the last days.

In my opinion it is the best now, to work only with event MC_EVT_ENTER and not with event MC_EVT_MODIFIED. In event data_changed I update the fields that have to be updated and in event data_changed_finished I only do the refresh.

This of course means that the user always have to click on enter after some changes. But for me it is better when clicking enter after changes than clicking everything else twice just because the refresh is at the "wrong" moment.

Any idea for improvement? 🙂

Regards

Michael

0 Kudos

Hi Michael,

yeah, I would not make any column-width changes at all with the ALV grid during runtime. If I got you right, this was the initial thought that you had, when doing so.

Mayhaps it could be a bit nicer - if you still need to make such adjustements - to offer a dedicated button "Adjust column width" for the end-user.

how about that?

   Florin

0 Kudos

Hello Florin,

Yes this is the initial thought of it. Hm yes a special button would also work, but for me it does not sound that right 🙂 A little bit to much effort for just adjusting column width. I for myself would prefer the enter variant because in SAP normally everything works with clicking enter (e.g. getting the long text of entered company code etc.) so it is common for the user that after typing enter there is some action.

Of course changing the width directly after input would sound nice, but when the system does not work like I want it, enter is a good replacement for it.

Just one question about the methods. I use the data_changed_finished for the first time, so it is the best way to do just the refresh there and everything else in the data_changed or is there another proper way for it?

Michael

0 Kudos

Hello Michael,

the refresh will not work within the data_changed(), so the only option left, *is* the data changed finished 🙂

I can't guarantee, that the grid layout with column width will also be adjusted, as sometimes not all features can be made working in all circumstances.

Florin