I have an SAP classical output report that can have a variable number of pages and each page can have variable number of lines. I want to be able to scroll up or down a page at a time. The standard toolbar provides a button for this but this doesn't work as I'm not specifying how many lines to a page - it just scrolls down a few lines instead. Using
SCROLL LIST FORWARD 1 PAGES INDEX 0.
Achieves the required effect though. Is there any way to reassign the button on the standard toolbar to have it trigger an event that runs that code? Or something that achieves similar?
I was thinking I could do something like
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'pgdn'.
SCROLL LIST FORWARD 1 PAGES INDEX 0.
ENDCASE.
But I haven't been able to get it to work yet.
I think you have to create a GUI status. Like this:
Then you set the GUI Status and program the commands:
report zscroll.
data lines type i.
start-of-selection.
set pf-status 'ZSCROLL_GUI'. " Set GUI status
while lines <= 100. " Print sample data
write / lines.
add 1 to lines.
endwhile.
at user-command. " Your code here
case sy-ucomm.
when 'EXIT'.
leave screen.
when 'PGDN'.
"Your code
when 'PGUP'.
"Your code
endcase.
And the result is this:
Finally you click a button from menu or tool bar and you will see the event 'AT USER-COMMAND' working:
Hope it helps