‎2008 Aug 07 10:57 AM
hi frens
how can i add scrollbar in table control.
points will be awarded to worthy replies.
‎2008 Aug 07 11:01 AM
Hi Sapna,
If you are creating the table control by the table control wizard then while that wizard run we have a option Scroll that we need to check. This will enable the scroll bars on both sides.
Otherwise in attributes of table control we can set it.
Generally it becomes very easy when we create a table control by wizard.
Even check the below example :
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn,
fill TYPE i.
TABLES demo_conn.
DATA: lines TYPE i,
limit TYPE i.
SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES fill.
flights-lines = fill.
ENDMODULE.
MODULE fill_table_control OUTPUT.
READ TABLE itab INTO demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
lines = sy-loopc.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'NEXT_LINE'.
flights-top_line = flights-top_line + 1.
limit = fill - lines + 1.
IF flights-top_line > limit.
flights-top_line = limit.
ENDIF.
WHEN 'PREV_LINE'.
flights-top_line = flights-top_line - 1.
IF flights-top_line < 0.
flights-top_line = 0.
ENDIF.
WHEN 'NEXT_PAGE'.
flights-top_line = flights-top_line + lines.
limit = fill - lines + 1.
IF flights-top_line > limit.
flights-top_line = limit.
ENDIF.
WHEN 'PREV_PAGE'.
flights-top_line = flights-top_line - lines.
IF flights-top_line < 0.
flights-top_line = 0.
ENDIF.
WHEN 'LAST_PAGE'.
flights-top_line = fill - lines + 1.
WHEN 'FIRST_PAGE'.
flights-top_line = 0.
ENDCASE.
ENDMODULE.
hope this helps,
thanx,
dhanashri.
Edited by: Dhanashri Pawar on Aug 7, 2008 12:04 PM
Edited by: Dhanashri Pawar on Aug 7, 2008 12:08 PM
‎2008 Aug 07 11:41 AM
Hi,
You can get rid of vertical scroll bars by setting
Table control. This way the user can only see the visible lines of the Table control. As for as the Horizontal scroll bar,
just make sure that your table control doesn't contain too many fields.
Scrolling with scrollbars is automatically implemented with Table controls, and managed by the system. However the component<ctl> lines must be set to the required row number before editing the Table control.This is the case for table
controls with or without parallel loops using an internal table. The component LINES is set implicitly for table controls with
parallel loops using an internal table, although the correct value is not guaranteed (see table above). It is therefore
recommended that in both instances you set the component LINES explicitly to the number of rows in the internal table of
the ABAP program.
‎2008 Aug 07 11:05 AM
Hi,
While creating the table control by table wizard in the 4th step we can see an check box with text as scrolling
if u check then u will get scrolling automatically.
Hope it helps u.
‎2008 Aug 07 11:07 AM
HI
Go through the link given below :
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac4435c111d1829f0000e829fbfe/frameset.htm
With Regards
Nikunj Shah
‎2008 Aug 07 11:11 AM
‎2008 Aug 07 11:18 AM
Hi
If after generating a table control the scrollbar is not available, it means u need to force the value of the loaded line into table control structure:
PROCESS PBO
MODULE SET_LINES_TC.MODULE SET_LINES_TC.
DESCRIBE TABLE ITAB LINES <TABLE CONTROL>-LINES.
ENDMODULE.Max
‎2008 Aug 07 11:21 AM
Do this in PBO.
DATA: V_LINES TYPE I.
DESCRIBE TABLE IT_DATA LINES V_LINES.
"Now use the V_LINES for Table control lines.
TC-LINES = V_LINES.
TC-V_SCROLL = 'X'.
‎2008 Aug 07 11:29 AM
Hi,
Please check below code.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES fill.
flights-lines = fill.
ENDMODULE.
MODULE fill_table_control OUTPUT.
READ TABLE itab INTO demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
lines = sy-loopc.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
where
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
fill TYPE i.