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

Dynamic rows in table control

Former Member
0 Likes
2,119

Hi Folks,

Need some help !

I have created a table control and its working fine, but now what I want is the number of rows of the table should vary dynamically. Meaning, now if the table is displayed it shows large number of rows even if they are not filled. For example, if the table contains 3 records still it shows remaining empty rows (around 20-25) alongwith these 3 records.

I want is, if I have 3 records in the output internal table then the table control should display only 3 rows, if it contains 5 records then the table control should display only 5 rows. No blank rows should be displayed.

Is there any way to acheive this?

Please help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,320

Thanks Nitwick and Anil,

I have tried option that you suggested, but still its showing 3 data records (filled rows) followed by number of blank rows.

Does this thing has anything to do with the size of the table control?

6 REPLIES 6
Read only

Former Member
0 Likes
1,320

Hi,

If you are only displaying contents on the table control, then you could probably set the tablecontrol-lines to the number of records in the table control in the PBO.


describe table it_tab lines lv_lines.
tablecontrol-lines = lv_lines.

Read only

Former Member
0 Likes
1,320

Hi,

Use the variable

table_ctrl-LINES = No of lines of your table.

Try this in PAI or PBO

Read only

Former Member
0 Likes
1,321

Thanks Nitwick and Anil,

I have tried option that you suggested, but still its showing 3 data records (filled rows) followed by number of blank rows.

Does this thing has anything to do with the size of the table control?

Read only

0 Likes
1,320

Hi Sudarshan,

In PBO
" This should always be implemented in PBO only
Module status_100. " Implement this in the program as shown below.
loop at itab with control tc.

endloop.

in Program.
module status_100.
* SET PF-STATUS 'XXX'.
* SET TITLE 'XXX'.

describe table itab lines tc-lines. " this makes sure only filled row displayed and others grayed out.
Now if you want to enable one more line for the user to enter follow this.

if tc-lines <> 0.
tc-lines = tc-lines + 1. " One Extra line is enabled every time so that use can enter otherwise omit this
endif.
endmodule.

Cheerz

Ram

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,320

Thre is prpperty called lines for the table control, you must set it.

describe table itab lines lv_lines.

tb_ctrl-lines = lv_lines.

Read only

0 Likes
1,320

PBO.

Module fill_lines.

LOOP WITH CONTROL tb_ctrl.

MODULE fill_tb_ctrl.

ENDLOOP.

Module fill_lines.

describe table int_table lines lv_lines.

tb_ctrl-lines = lv_lines.

endmodule.

module fill_tb_ctrl.

READ TABLE int_table into wa INDEX tb_ctrl-CURRENT_LINE.

endmodule.