‎2018 Mar 21 3:25 PM
Hello,
I have a table control to scan serial numbers. Once user scan a serial number, cursor automatically comes down to scan next serial number. Once a page is filled, program display next page to scan next set of serial numbers.( achieved this by setting top_line in PBO as below) .
*** Set top line
IF sy-loopc IS NOT INITIAL.
IF tc_mat_scan-lines => sy-loopc.
tc_mat_scan-top_line = ( tc_mat_scan-lines DIV sy-loopc ) * sy-loopc + 1.
ENDIF.
ENDIF.
Problem comes when user try to manually press scroll buttons to see previous entries but program shows page as per top_line calculation. so sometime even after scrolling page stays at same location and does not scroll up.
Is there any way that my logic to calculate top_line does not trigger when user manually press scroll buttons ? I tried using sy-ucom, but sy-ucomm is blank in all cases.
Or if there is any other way to achieve above ?
Thanks
‎2018 Mar 22 5:53 AM
Hi Jitendra,
whenever you do table control by using table control wizard, system will take care the table control scrolling logic.
IF you forecefully Removed/Deleted the table control wizard logic, you have do you own logic to control the scrolling part.
Even system will allow you to delete the manually created wizard code.
I did the same for may table control programs.
as follows, it may not the correct approach, but I solved by using some simple code.
=============================================================
controls: zcerti type tableview using screen 9001.
data: g_zcerti_lines type sy-loopc.
=============================================================
I called this perform in PAI of the USER_COMMAND .
If user clicked ADD button of table control..
** To create empty table control lines after scrolling the table
** when the user requested to insert NEW ENTRIES
IF zcerti-top_line > 1.
IF wf_change = abap_true.
PERFORM f_tcont_lines_certi.
ENDIF.
ENDIF.
==============================================================
FORM f_tcont_lines_certi.
DESCRIBE TABLE int_pipi_certi LINES wf_lines.
" To Append New Records To the Table
wf_lines = ( g_zcerti_lines + zcerti-top_line - 1 ) - wf_lines.
DO wf_lines TIMES.
CLEAR fs_pipi_certi.
APPEND fs_pipi_certi TO int_pipi_certi.
ENDDO.
ENDFORM. " F_TCONT_LINES_CERTI
==============================================================
Note: the code will create many lines in table control because it will be triggered multiple times, so you have to delete the internal table empty lines before appending..
Kindly reward, if useful