Application Development 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: 

Add Line in Table control

Former Member
0 Kudos
130

Hi,

I have a proble in table control where my table control have 3 lines and when i enter three records i can see the records in table control scrren and when i want to add a 4 th line i need to press a BUTTON.when i press the button a new line inserted but i need to scroll to see the fourth record,but my req ments is to see the 4th record in the 3 rd line of the table control and 3 rd will be seen in the 2 nd line of the table control. Is there any good soultions to achieve this.

Thanks,

Deesanth

1 ACCEPTED SOLUTION

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
96

Hi Deesanth,

In the PBO of the screen just add code:-


tab_ctrl-lines = tab_ctrl-lines + 10. "tab_ctrl is name of table control

This will insert 10 extra line in the table control.

You can see these empty line when you scroll the vertical scroll bar of the table control.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

6 REPLIES 6

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
97

Hi Deesanth,

In the PBO of the screen just add code:-


tab_ctrl-lines = tab_ctrl-lines + 10. "tab_ctrl is name of table control

This will insert 10 extra line in the table control.

You can see these empty line when you scroll the vertical scroll bar of the table control.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Former Member
0 Kudos
96

Hi Gambir,

This not my my req ment,when i pree the ADD button i can able to insert a line which i can edit values,but to see the new added line i need to scrroll,but i dont want to scroll instead the new added line shoub be displayed in the last line of the table control screen.

Deesanth

I355602
Product and Topic Expert
Product and Topic Expert
0 Kudos
96

Hi Deesanth,

If you want that the last line of the table control should always be empty and can be seen by the user all the time, then thats not possible.

You need to scroll down the table control to view the other line in it.

Thanks & Regards,

Tarun Gambhir

Former Member
0 Kudos
96

Hi,

try like this...

data : v_index type sy-tabix.
when 'ADD'.
describe table itab lines v_index.
v_index = v_index + 1.
insert initial line into itab index v_index.

Former Member
0 Kudos
96

Hi Deesanth,

Try the piece of code in the mentioned thread for your reference.

Revert back for further queries.

Regards,

Sravanthi.

Former Member
0 Kudos
96

after you add a line, in the PBO- put this code:

describe table lt_disp lines lv_lines.

table_control-lines = lv_lines.

if lv_lines GT 3.

table_control-top_line = lv_lines-3.

endif.

In this case, the last record would always be the third record in the Table cntrol.

Nikhil