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

restricting rows in table control.

Former Member
0 Likes
1,306

I only want 4 rows in my table control but it is coming as a number of rows...I want to restrict row in my table control,Please tell me how do that?

5 REPLIES 5
Read only

Former Member
0 Likes
839

HI,

Try the following

Say the tablecontrol has the name tabctrl in your program, set the property lines of the table control as 4.

tabctrl-lines = 4. in the PBO

hope this helps.

Regards,

Sachin

Read only

sravya_ch
Participant
0 Likes
839

Hi priya

I am sending the code which i used in my screen see weather it will suite you.if any doubts let me know as well this is for 10 lines

MODULE COUNT_UPDATE INPUT.

data cnt(10).

DESCRIBE TABLE itab1 lines cnt.

append itab1 TO ITAB2.

LOOP AT itab2.

IF itab2-srno is INITIAL.

cnt = cnt + 1.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = cnt

IMPORTING

OUTPUT = itab2-srno

.

  • itab2-srno = cnt.

ENDIF.

READ TABLE itab1 WITH TABLE KEY srno = itab2-srno aufnr = itab2-aufnr." vbeln = itab2-vbeln.

IF sy-subrc eq 0.

MOVE-CORRESPONDING itab2 to itab1.

MODIFY itab2.

MOVE itab2[] to itab1[].

else.

MOVE-CORRESPONDING itab2 to itab1.

append itab1.

ENDIF.

ENDLOOP.

PERFORM operations.

REFRESH CONTROL 'TCL' FROM SCREEN '1000'.*

tcl-lines = 10. " for 10 lines

clear itab2.

CLEAR itab2[].

ENDLOOP.

ENDMODULE.

Read only

Former Member
0 Likes
839

Just Select 4 rows only into the internal table.

Select * from mara into itab up to 4 rows.

Read only

Former Member
0 Likes
839

Hi,

Try this,

In the layout, resize the table control's height so that it shows only 4 rows.

If you want only 4 rows to be editable on display, then use the following in the PBO


  LOOP AT gt_itab1 WITH CONTROL tabcontrol.
    MODULE check_control.
  ENDLOOP.


MODULE check_control.
if gt_itab1[] is INITIAL.
  TABCONTROL-lines = 4.
endif.
ENDMODULE.

Read only

Former Member
0 Likes
839