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

Check box in Table Control

Former Member
0 Likes
3,926

Hi All,

Please tell me how to put the check boxes in the table control.

My requirement is to get the entries from a Z table having a check box infront of every line. Later when user ticks any check box or selects multiple check boxes should be saved after PRESSING the save button.

Please help ASAP.

Regards,

Maddu.

Hi All,

Please tell me how to put the check boxes in the table control.

My requirement is to get the entries from a Z table having a check box infront of every line. Later when user ticks any check box or selects multiple check boxes should be saved after PRESSING the save button.

Please help ASAP.

Regards,

Maddu.

8 REPLIES 8
Read only

Former Member
0 Likes
2,405

Hi,

What you can do is, declare your internal table that you will be using for your table control, with the first field as :

Begin of itab,

chk_bx type C,

..

...

..

end of itab.

Then after you create the table control using the wizard, go to the screen layout, right click on the first column (which would be 1 char field) and select Convert -> Checkbox.

If this option is not available, you can drag the checkbox element from the toolbar of the screen painter and drop it at the first position of the table control. Then rename it as,

itab-chk_bx.

Do let me know if this helped.

Thanks,

Pranjal.

Read only

anub
Participant
0 Likes
2,405

Hi,

You need to first declare the check box variable in your internal table of length 1 char like

data : begin of it1 occurs 0 ,

chk(1) type c,

field1.........

field2.........

.................

end of it1.

Go to the screen layout create a table control using wizard selecting all the fields you want in the table. then you can click on the coloumn for check box and right click. There u will find the option to convert the field to checkbox.

Hope this helps.

Reward if useful.

Regards,

Anu.

Read only

Former Member
0 Likes
2,405

Thanks Pranjal and Anu.

I have followed the process which you people told me.

Now the check box is appearing in the table control.

I have given name CHECK in my internal table and same name I have mentioned in my TABLE CONTROL layout.

But since a long am fighing with one issue is, when I select

any check box, line related to that should be stored with CHECK value 'X' somewhere. And when I deselect the same

it should be stored with CHECK's value ''.

At the end when user presses the MODIFY button which I have on my screen the value with the 'X' should be stored in my Z table.

Please suggest if anyone knows.

Read only

Former Member
0 Likes
2,405

For this,

Check the code taht was craeted when u inserted table control on the screen.

In PBO , there should be the foll loop stmnt created :

loop at itab ...WITH CURSOR ...

Endloop.

In PAI, there would be the code:

loop at itab.

endloop.

What you need to do is, in the PAI, between the loop-endloop, modify the internal table itab from the headerline.For that create a module modify bet the loop-endloop.

But the value X or space will only be captured if in PBO, the 'with cursor' addition was tehre, if not, add manually.

let me know if this helped and reward accordingly.

Pranjal.

Read only

Former Member
0 Likes
2,405

This loop is given in the PBO.

LOOP AT g_tbc_itab

INTO g_tbc_wa

WITH CONTROL tbc

CURSOR tbc-current_line .

MODULE tbc_move.

MODULE tbc_get_lines.

Does the CURSOR statement is witten correct here ?

When I tick any record appearing in that table control.

TICK is not showing there, its disappering right on the time.

Please tell excatly what should I to make it appear.

Read only

Former Member
0 Likes
2,405

Hi,

The code in PBO is correct.

ALso, unless u do not code for modifyin the table row in PAI, your tick mark will go.

Do the foll :

In PAI, between the statements

LOOP AT g_tbc_itab

INTO g_tbc_wa

WITH CONTROL tbc.

ENDLOOP.

Add the line :

Module modif_tab.

The code in the newly crated module wil b

modify g_tbc_itab from g_tbc_wa index sy-index transporting CHECK.

This will update the internal tabel n u wil b able to c the cheked box.

Reward if helpful.

PRanjal.

Read only

Former Member
0 Likes
2,405

Pranjal a strange errror has started coming.

When I put this code in PAI event:

loop at g_tbc_itab.

modify-itab.

endif.

Its giving the error as "LOOP" CAN NOT BE ASSIGNED TO ANY FIELD.

I am even not getting the hang of it what it want to communicate.

Help please.

Read only

Former Member
0 Likes
2,405

You had to use the foll code:

LOOP AT g_tbc_itab

INTO g_tbc_wa

WITH CONTROL tbc.

module modif_tab]

endloop.

Edited by: Pranjal Gadkari on May 9, 2008 2:24 PM