Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

module pool with scrolling when insert new line

Former Member
0 Likes
1,696

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,043

hi,

Refer to this program DEMO_DYNPRO_TABLE_CONTROL_1

6 REPLIES 6
Read only

Former Member
0 Likes
1,044

hi,

Refer to this program DEMO_DYNPRO_TABLE_CONTROL_1

Read only

Former Member
0 Likes
1,043

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) ......

Read only

0 Likes
1,043

i have table control without wizard

Read only

0 Likes
1,043

loop at itab.

module modify_tab

endloop

in program

module modify_tab

describe table itab lines tc-liens

if tc-current_line > tc-lines

append itab

else

modify itab index tc-current_line

endmodule

refer below link

Read only

Former Member
0 Likes
1,043

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.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,043

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