04-03-2006 10:02 AM
Hi,
I have 6 checkboxes in a screen. I am getting data from an internal table and displaying it in a screen in a loop. But the check box is not in the loop. If there are only 3 rows in the internal table then only 3 checkboxes should be displayed. How is it possible?
Pls help.
Aarthi.M
04-03-2006 10:05 AM
data : v_lines type i,
v_chk(1).
describe table itab lines v_lines.
do v_lines times.
write : v_chk as checkbox
enddo.
or u can put v_chk in ur internal table and u can write the checkbox while looping at internal table
data:begin of itab occurs 0,
chk(1),
field1 like...
......
end of itab.
loop at itab.
write : itab-chk as checkbox.
*display other fields here
endloop.
Message was edited by: Sekhar
04-03-2006 10:12 AM
Hi Sekar,
This would work only for displaying check boxes in a loop.
04-03-2006 10:16 AM
If you are working with screens,
then in the PBO section,
describe table itab lines v_lines.
v_no_disp_lines = 6 - v_lines.
loop at screen.
if screen-group1 = <your group name for the check boxes>.
do v_no_disp_lines times.
screen-INVISIBLE = 1.
modify screen.
clear screen.
enddo.
endif.
endloop.
REgards,
ravi
04-03-2006 10:19 AM
Hi Ravi,
I dont want the check boxes to be displayed in a loop.. I have 6 separate check boxes in the screen.. Only the datas from the table are in a loop. Is that possible?
04-03-2006 10:25 AM
give the name of ur checkboxes as chk1 , chk2 ... chk3
describe table itab lines v_lines.
v_lines = 6 - v_lines.
do v_lines times.
<b> concatenate chk sy-index into name1.</b>
loop at screen.
if screen-name = name1.
screen-invisible = 1.
modify screen.
endif.
endloop.
enddo.
04-03-2006 10:42 AM
Small correction to Sekhar's code,
<b>Data: v_index(1) type n.</b>
describe table itab lines v_lines.
v_lines = 6 - v_lines.
do v_lines times.
<b> v_index = sy-index.</b>
<b> concatenate <i>'chk'</i> v_index into name1.</b>
loop at screen.
if screen-name = name1.
screen-invisible = 1.
modify screen.
endif.
endloop.
enddo.
Regards,
ravi
04-03-2006 10:23 AM
Hello Aarthi,
As I understand, U have 6 checkbox and an screen area where u display lines from the internal table. U can code in PBO for controlling the output.
Use DESCRIBE command to check the number of lines and based on that u can use
LOOP at SCREEN.
check for the checkbox name and set the screen attributes accordingly.
endloop.