10-01-2010 8:07 AM
Hi
Disined table control. Horizontal scroll bar working but vertical scroll is not working. I have selected all properties in screen painter like Resizing, Separator, line sel, colum sel ...etc. Can anyone advice on this.
Regrds
Raj
10-01-2010 8:25 AM
Hi,
To activate your vertical scrolling what you need to do fill the table control
lines with the number of records of your internal table
You have to write belo code in PBO module of your screen
DATA lv_LINES TYPE I.
DESCRIBE TABLE Itab(Internal table assigned to table cotrol) LINES lv_LINES.
(Table control name) TABCNTRL-LINES = VLINES + 1.
TABCNTRL-v_scroll = 'X'
Thanks,
Pawan
10-01-2010 9:30 AM
HI
Thanks for your information. Now in Verticular bar, down arrow is working but up arrow is not working . Please suggest.
Regards
Raj
10-01-2010 10:23 AM
Hi Rajitha,
The problem may be with the OKCODE have you cleard the OKCODE of your screen in PAI. When you click the scroll bar, the ok code of any previous action will be stored. So clear the okcode .
for ex:
in your module user command,
data save_ok type sy-ucomm.
MODULE user_command INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'BUTTON1'.
...
ENDCASE.
ENDMODULE.
Also for alternate option for scrolling you can explore the FM SCROLLING_IN_TABLE.
Regards,
Pawan
Edited by: PawanG on Oct 1, 2010 2:56 PM
10-01-2010 8:37 AM
Hi,
Use this code
You have to write a PAI module and a PF status which has 4 function codes for example ..'PGDO', 'PGUP', 'PGLA', 'PGFI' ...
*----
MODULE scroll INPUT.
XCODE = OK_CODE.
CASE xcode.
WHEN 'PGDO'. "one page down
offset = tabcontrl-lines - step_lines.
IF tabcontrl-top_line LT offset.
tabcontrl-top_line = tabcontrl-top_line + step_lines.
ENDIF.
WHEN 'PGUP'. "one page up
offset = step_lines.
IF tabcontrl-top_line GT offset.
tabcontrl-top_line = tabcontrl-top_line - step_lines.
ELSE.
tabcontrl-top_line = 1.
ENDIF.
WHEN 'PGLA'. " last page
tabcontrl-top_line = tabcontrl-lines - step_lines + 1.
WHEN 'PGFI'. " first page
tabcontrl-top_line = 1.
ENDCASE.
ENDMODULE. " SCROLL INPUT
*--
CONTROLS: tabcontrl TYPE TABLEVIEW
USING SCREEN '9000'.
*----
where step_lines is
step_lines = sy-loopc. " lines visible in the table
You have to write MODULE SCROLL in PAI anywhere. It should be a PAI module that's all. For assigning sy-loopc to step_lines ( an integer type), you write it in PBO module that too:
*----
LOOP AT itab1 WITH CONTROL tabcontrl CURSOR TABCONTRL-CURRENT_LINE.
MODULE ITAB_TO_SCREEN.
MODULE lines .
ENDLOOP.
*----
Hope it helps,
Regards,
Benu
10-01-2010 10:10 AM
Hi Ranjitha
Try following code
In flow logic of the screen:
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
LOOP AT ITAB INTO WA_ITAB WITH CONTROL TAB_CNTRL.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9000.
LOOP AT ITAB .
ENDLOOP.
In Program:
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS SPACE.
SET TITLEBAR 'xxx'.
SELECT MATNR ERSDA ERNAM MTART MBRSH MATKL FROM MARA INTO TABLE ITAB .
DESCRIBE TABLE ITAB LINES LINE_NO.
TAB_CNTRL-LINES = LINE_NO.
ENDMODULE.
where itab and wa_itab are the internal table and the work area and tab_cntrl is the name of the table control.
in this code you are counting the lines of the records in the internal table in variable line_no.
then passing this number to the table control.
It will set the table control for the number of lines seleted.
then applyin the loop with the table control.
I hope this will work for you.
Thanks
Lalit Gupta
07-13-2014 11:03 AM
Dear raj Madhika,
You have to write below code in PBO module of your screen
Said is correct morning i had a same issue solved from his suggestion
Thanks