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

Problem in Module Pool Program

Former Member
0 Likes
597

Hi All,

I need to control the number records in table control.

For example: if 20 records ..only 20records have to show.if 4 records need to show only four records.

Now its showing same number of rows irrespective of the records.i.e when i scroll down its goes on showing empty rows.

Please help on this.

Thank You,

Anu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
572

Hi Anitha,

In the PBO in one of your PBO module , you should pass the SY-DBCNT to the table control lines.

Just have a look at the below code :-

  SET PF-STATUS 'MY_MENU'.
  SET TITLEBAR 'ZMY_TITLE'.
  SELECT * FROM zreaders INTO TABLE itab.
  MOVE-CORRESPONDING itab TO zreaders.
  SORT itab BY readerid descending.
  tc-lines = sy-dbcnt 

Here TC is the table control name :

CONTROLS tc TYPE TABLEVIEW USING SCREEN 0100.

Hope this solves your query.

Regards

Abhii

3 REPLIES 3
Read only

Former Member
0 Likes
575

Hi Anitha,

In the PBO in one of your PBO module , you should pass the SY-DBCNT to the table control lines.

Just have a look at the below code :-

  SET PF-STATUS 'MY_MENU'.
  SET TITLEBAR 'ZMY_TITLE'.
  SELECT * FROM zreaders INTO TABLE itab.
  MOVE-CORRESPONDING itab TO zreaders.
  SORT itab BY readerid descending.
  tc-lines = sy-dbcnt 

Here TC is the table control name :

CONTROLS tc TYPE TABLEVIEW USING SCREEN 0100.

Hope this solves your query.

Regards

Abhii

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
572

tbctrl-lines = lines( itab ).

Set this property just after itab is populated.

Read only

Former Member
0 Likes
572

Hi

Suppose you have the data in you internal table.

write this in PBO:

describe table itab lines count.

where itab is your internal table and count is a variable of type integer.

this statement will fetch the total lines of your internal table itab in variable count.

assign this count to tc-lines as below.

tc-lines = count.

TC means table control name.

it will allocate line to your table control for total number of line in your internal table.

But your table control will have the blank lines.

condition 1:

suppose your table control's widthis for 10 lines and you have 3 records so your table control will show remaining 7 lines.

and if you have 29 records then your table control will allow you to scroll and will show 29 records and 1 blank line which will not be in editable mode.

Condition 2:

if you have created a Table control as editable then it will show you remaining line because what if user wants to put some value in the table control.

So in Any case it will show you the blank lines.

I hope this will work for you.

Thanks

Lalit