cancel
Showing results for 
Search instead for 
Did you mean: 

CheckBox's in First column of a table UI element

0 Kudos

Hi,

I have a table and below the table i have a button. So now my requirement is need to have a first column of table UI element (not ALV) as checkbox's. Whenever users tick that check box the row of that table get's selected and i need to get all selected checkbox rows in the button event. How can we acheive this? Any suggestions and sample codes?

Thanks

venkat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In the node to whcih the table is bound, create an attribute CHKBOX of CHAR1 type..

Create a TABLE UI element and rightclick choose CREATEBINDING option for the TABLE in the layout,

Now, it will ask for the node, select that node ....And for the first column/attribute select the cell editor as CHECKBOX...and bind the seleceted is automatically bound to that attribute..

Now In the button handler,

After user select/checks those rows...

loop at lt_table into ls_table where ls_table-chkbox = 'X'. "Ticked/checked rows

endloop.

Check the WDR_TEST_TABLE, TABLE_CELL_EDITORS view for example...

Regards,

Lekha.

Edited by: Lekha on Dec 18, 2009 9:39 AM

0 Kudos

Lekha - I am able get the check box column in table and i can successfully check and uncheck the check boxes in table column. Now my question is whenever i select the checkbox i want that table row to be selected. How can we do this?

Thanks

Venkata

0 Kudos

Lekha - I added new attribute (CHECKB)of type BDY_BOOLEAN in the table node and binded it to the checkbox column. But when i run the application it's giving the short dump saying Could not find attribute CHECKB. Plz help on this.

Former Member
0 Kudos

Check in ST22 and paste teh errror log....

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

This is simple:

1.add an attribute of type abap_bool in the node of the table

2.on the click of the button action caal the method to modify the view in which alv will be modify as per the code below

read the context node

just set the variable as ABAP_TRUE to dispaly of the checkbox with the chcked box or false with the empty chekbox

3. to read the checked lines..simple on the click of the button write the code that actually read the node with the abap-bool type variable as 'X', read all the lines ina internal table , and finally bind that table to the ndoe.

* read the itab where check box is checked
loop at itab into wa where readonly = 'X'.
**  read table ls_alv with key readonly = 'abap_true'.
  move:
  wa-ebeln to wa1-ebeln,
  wa-matnr to wa1-matnr,
  wa-bukrs to wa1-bukrs,
  wa-matkl to wa1-matkl,
  wa-menge to wa1-menge,
  wa-meins to wa1-meins,
  wa-netpr to wa1-netpr.
  append wa1 to itab1.
  clear wa1.
endloop.

Hope this might solve your problem

Pooja