‎2009 Jan 01 9:05 AM
pbo
LOOP WITH CONTROL zsd_tab.
MODULE display.
ENDLOOP.
pai
LOOP WITH CONTROL zsd_tab.
MODULE save_table_control.
ENDLOOP.
****insert line
FORM fcode_insert_row USING p_tc_name
p_table_name.
IF wa_bapisdstat-dlv_stat_h <> 'C' .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA l_lines_name LIKE feld-name.
DATA l_selline LIKE sy-stepl.
DATA l_lastline TYPE i.
DATA l_line TYPE i.
DATA l_table_name LIKE feld-name.
FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <lines> TYPE i.
&SPWIZARD: END OF LOCAL DATA----
*BREAK DEVELOPER.
ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
ASSIGN (l_lines_name) TO <lines>.
**KRUPA
*&SPWIZARD: get current line *
GET CURSOR LINE l_selline.
IF sy-subrc <> 0. " append line to table
l_selline = <tc>-lines + 1.
*l_selline = <tc>-lines + 2.
*&SPWIZARD: set top line *
IF l_selline > <lines>.
<tc>-top_line = l_selline - <lines> + 1 .
ELSE.
<tc>-top_line = 1.
ENDIF.
ELSE. " insert line into table
**IF INSERT 1 LINE UP THEN -1 OTHERWISE.
l_selline = <tc>-top_line + l_selline - 1.
*l_selline = <tc>-top_line + l_selline .
l_lastline = <tc>-top_line + <lines> - 1.
ENDIF.
*&SPWIZARD: set new cursor line *
l_line = l_selline - <tc>-top_line + 1.
*&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO <table> INDEX l_selline.
<tc>-lines = <tc>-lines + 1.
*&SPWIZARD: set cursor *
SET CURSOR LINE l_line.
ENDFORM. " FCODE_INSERT_ROW
i use above code fro insert new line but vertical scroll is not working
‎2009 Jan 01 9:16 AM
‎2009 Jan 01 9:16 AM
‎2009 Jan 01 9:19 AM
u have did table control with wizard only ...
then there itself u will have option scroll (while creating t.control with wizard)
i dont know u have checked that option while creating r not so try to recreate at that time u will see that option try to check that checkbox(scroll) ......
‎2009 Jan 01 9:20 AM
‎2009 Jan 01 9:32 AM
‎2009 Jan 01 9:31 AM
Hello,
For getting vertical scroll to work you must meet the below two requirements.
1) you should enable vertical scroll in table control attributes.
2) you should assign the "no of records" in your internal table to the the table control attribute "Lines"
You have incremented the attribute "lines" of table control, but even then your code is not working properly. You can try the code as shown below,
eg:
describe table <tablename> lines <variable>.
<tablecontrol>-lines = <variable>.
Hope this helps you.
‎2009 Jan 01 9:36 AM
Hi Krupa,
You must be displaying data from an internal table into the table control.
To make the table control vertical scrollable, use code in PBO of screen:-
DESCRIBE TABLE itab "itab is internal table with number of records
LINES line_count. "variable storing lines count
tab_ctrl-lines = line_count + 10. "tab_ctrl is the table control
"dynamically adjust the number of lines for table control
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir