2008 Sep 09 11:13 AM
Hi .
I did not get Vertical Scrool bar in Table control. I want insert 20 records into the data base table but in my table control i have only 3 rows. I did not get more than 3 rows even i am selecting Vertical in Resizing of Table Control properties. Plz explain it with sample code if possible.
Thank you.
Regards.
Krishna.
Hi .
I did not get Vertical Scrool bar in Table control. I want insert 20 records into the data base table but in my table control i have only 3 rows. I did not get more than 3 rows even i am selecting Vertical in Resizing of Table Control properties. Plz explain it with sample code if possible.
Thank you.
Regards.
Krishna.
2008 Sep 09 11:29 AM
Hi,
write
Describe table itab lines table_control-lines.in user command module, then it works.
Regards,
Sathish Reddy.
2008 Sep 09 8:20 PM
Hi krishna,
Use the DESCRIBE command u will get the number of records so that it will scroll vertical accordingly the number of record available.
2008 Sep 10 7:37 AM
Hi,
see the following code for scrolling.
FORM compute_scrolling_in_tc USING p_tc_name
p_ok.
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA l_tc_new_top_line TYPE i.
DATA l_tc_name LIKE feld-name.
DATA l_tc_lines_name LIKE feld-name.
DATA l_tc_field_name LIKE feld-name.
FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <lines> TYPE i.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_tc_lines_name.
ASSIGN (l_tc_lines_name) TO <lines>.
*&SPWIZARD: is no line filled? *
IF <tc>-lines = 0.
*&SPWIZARD: yes, ... *
l_tc_new_top_line = 1.
ELSE.
*&SPWIZARD: no, ... *
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
entry_act = <tc>-top_line
entry_from = 1
entry_to = <tc>-lines
last_page_full = c_x
loops = <lines>
ok_code = p_ok
overlapping = c_x
IMPORTING
entry_new = l_tc_new_top_line
EXCEPTIONS
NO_ENTRY_OR_PAGE_ACT = 01
NO_ENTRY_TO = 02
NO_OK_CODE_OR_PAGE_GO = 03
OTHERS = 0.
ENDIF.
*&SPWIZARD: get actual tc and column *
GET CURSOR FIELD l_tc_field_name
AREA l_tc_name.
IF syst-subrc = 0.
IF l_tc_name = p_tc_name.
*&SPWIZARD: et actual column *
SET CURSOR FIELD l_tc_field_name LINE 1.
ENDIF.
ENDIF.
*&SPWIZARD: set the new top line *
<tc>-top_line = l_tc_new_top_line.
ENDFORM. " COMPUTE_SCROLLING_IN_TC
Regards,
Raju.
2008 Sep 10 8:21 AM
hi,
try this logic...
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.
*----
This 'MODULE lines' is a PBO module in which u can assign step_lines = sy-loopc.
regards
padma
2008 Oct 18 1:30 PM
2008 Oct 18 8:57 PM
Hi,
You can also use INSERT Button of the Table Control standard Toolbar....