Now let's look at scrolling.
(assume that the name of your table control is T1)
In the screen logic you will have:
Loop with control T1.
.
.
module get_Looplines.
Endloop.
Module get_looplines.
Looplines = sy-loopc.
Endmodule.
In the PBO of the screen you will have a module that loads
the itab and determines the total number of lines read.
Module load_itab.
.
. (select database table and
append to itab)
.
describe table itab lines linecount.
Endmodule.
We now have all the values necessary to construct a scroll
module.
MODULE SCROLL INPUT.
CASE SAVE_OK_CODE.
WHEN 'P--'.
T1-TOP_LINE = 1.
WHEN 'P-'.
T1-TOP_LINE = T1-TOP_LINE - LOOPLINES.
IF T1-TOP_LINE
T1-TOP_LINE = 1.
ENDIF.
WHEN 'P+'.
T1-TOP_LINE = T1-TOP_LINE + LOOPLINES.
IF T1-TOP_LINE > LINECOUNT.
T1-TOP_LINE = LINECOUNT - LOOPLINES + 1.
ENDIF.
WHEN 'P++'.
T1-TOP_LINE = LINECOUNT - LOOPLINES + 1.
ENDCASE.
ENDMODULE. " SCROLL INPUT
Tom Quinn
ESRI, Redlands, CA.
OR
WHEN 'P--'.
CLEAR SY-UCOMM.
CTR1-TOP_LINE = 1.
WHEN 'P-'.
CLEAR SY-UCOMM.
CTR1-TOP_LINE = CTR1-TOP_LINE - LINECOUNT1.
IF CTR1-TOP_LINE
CTR1-TOP_LINE = 1.
ENDIF.
WHEN 'P+'.
DESCRIBE TABLE ITAB1 LINES N1.
CTR1-TOP_LINE = CTR1-TOP_LINE + LINECOUNT1.
IF CTR1-TOP_LINE > N1.
CTR1-TOP_LINE = N1.
ENDIF.
CLEAR SY-UCOMM.
WHEN 'P++'.
DESCRIBE TABLE ITAB1 LINES N1.
CLEAR SY-UCOMM.
CTR1-TOP_LINE = N1.
..