Skip to Content

ALV Paging

Hello everyone.

I have a requirement to display data on ALV and user can input, update database from this ALV. The problem is if I load all data to ALV and lock the table when user edit data it could take a long time that table be locked and other program, user cant use it.

I have an ideal to show limited number of data then when user click page up/down the next data will show up (like paging) but I cant find the way to archive it. I also think about FETCH..CURSOR to show particular data each cursor on ALV too.

anyone have go through this situation please tell me how to do this.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Nov 21, 2017 at 06:49 AM

    I don't think this is a good approach. It would make for an awkward user experience if s/he can edit two pages and is blocked form the third.

    An explicit edit mode would be better, and either using a full table lock (my preference), or providing a good set of selection criteria and locking the result records.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 21, 2017 at 07:46 AM

    Are you familiar with the concept of "Optimistic locks"?

    SAP Help about Optimistic Locks

    In short, you can lock "optimistically" when reading the data, and later on, when user needs to update, you propagate this to an exclusive lock. Several optimistic locks for the same object can exist at the same time. But when an exclusive lock is made on that same object (either propagating optimistic to exclusive or a new exclusive is made) all other optimistic locks are relased (and, consequently, can not be propagated to exclusive later on).

    This need to be handled, of course, in a good way for the user. If an optimistic lock can not be propagated, that would meen that another user have changed that data, and it needs to be read again.

    Also, if you think you want to go down this path, you need to pay very close attention to the number of records that will be locked, and in how many instances. You do NOT want to fill the lock table with optimistic locks, so beware!


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jörgen Lindqvist.

      Thank you for your ideal. its good to know more about optimistic lock. I will think about it. Even though I think my user wont accept it, if 2 people can edit and optimistic lock at the same time they wont know who can or cant edit that data.

      I thought about Fetch each package of data using cursor and display in ALV but its not work since when ALV displayed it also clear my cursor. I think something like this is impossible. I run out of ideal, maybe i will set a maximum nuber of hits (like SE16N to avoid load and lock too much data at a time). thats it.

      (I dont see a button to mark your answer as helpful...)

      Thanks again.

  • Nov 20, 2017 at 11:38 AM

    Will locking the table only on user action ( eg., 'UPDATE') make it easier?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Sathya.

      at the first time i lock on action update. but my client want to lock it when display on alv or some thing like that because they concern about inconsistency data if other people edit that table while they edit on this ALV. thats why i have to change my solution but still have no luck yet.