Application Development 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: 

Row Selection - Table Control

Former Member
0 Kudos
1,374

Hi Experts,

We all know that in order to select a row from a table control, we need to enter a name in the w/Selection

of the Table Control attributes and declare a field in the internal table of type char1.

But, in my case, I am not using any internal table with the table control.

I am just writing LOOP WITH CONTROL <TABLE CONTROL NAME> in both PBO n PAI.

I am just reading data from the Table Control and storing it in an Internal table.

Can anyone please tell me how to incorporate the Row Selection Logic ?

Based on the row selected, I need to display some info to the users.

I have already given a name to the w/selection field of the table control attributes. Now how should I

use this name in the code ?

Thanks

Chandan

1 ACCEPTED SOLUTION

Former Member
0 Kudos
179

Hello Chandan,

Inside the PAI loop just create a module.

there you check w\Selection parameter = 'X'.

if parameter = 'X'.

<move tbcl data to your internal table.>

or

<Keep a extra field in your internal table type c and mark it X in the internal table when the condition is satisfied>.

endif.

Hope this discussion was helpful.

Cheers,

Suvendu

8 REPLIES 8

Former Member
0 Kudos
179

hi

Table Control is nothing but displaying the data on a screen in a tabular form not but a table form.

then how come u r reading the data from the table control with out any internal table defined for it?

i think your requirement is only possible when u declare a internal table for table control

with w/selection field defined for row selection and then based on ur row selection

try to store the data into another internal and display that to the users,

Regards

Former Member
0 Kudos
179

Hi

Inorder to get the select buttons on the rows of the table control , for the table control attributes select the check box with sel column and give selection col.name as WF_SEL (for eg)

With in PAI....under loop on internal table which is containing data displayed in table control....

Example -

FIELD wf_sel MODULE m_delete_row.

MODULE m_delete_row INPUT.

IF wf_sel = 'X' .

CLEAR wf_delete_row.

tb_table_cont-po_cond = 'X'.

MODIFY tb_table_cont INDEX tc_fact_in-current_line

TRANSPORTING po_cond .

wf_delete_row = tc_fact_in-current_line.

ENDIF.

ENDMODULE.

Former Member
0 Kudos
179

Hi,

Try this.

If you want to get the details of the selected row in the table control, maintain an internal table which has the same data & structure of the table control in the same order. There is a system field "SY-LOOPC" which gets populated with selected row no in the table control(in the PAI event). With the help of that value, get the details from the internal table.

Hope this may be helpful.

Regards,

Sharin.

Former Member
0 Kudos
180

Hello Chandan,

Inside the PAI loop just create a module.

there you check w\Selection parameter = 'X'.

if parameter = 'X'.

<move tbcl data to your internal table.>

or

<Keep a extra field in your internal table type c and mark it X in the internal table when the condition is satisfied>.

endif.

Hope this discussion was helpful.

Cheers,

Suvendu

0 Kudos
179

Suvendu,

I have named the w/selection parameter as SEL in the table control attributes.

I am using ITAB only for pushing data from table control to ITAB and again displaying the records in the

table control entered earlier. Now I need to select this row and press one button to perform some action.

So can u please tell me whether I need to include an extra parameter of type c in this ITAB ?

Also on pressing the row selection button, will the other buttons for each row will also be selected ?

Because according to my requirement, I need to show different things at each row on press of the corresponding push buttons.

Thanks

Chandan

0 Kudos
179

Hello Chandan,

No you don't have to add a new parameter to ITAB.

under PAI -> LOOP endloop just add a module and put this code under this module

IF sel = 'X'.

move screen data to temporary internal table.

endif.

then add one more MODULE after end of the loop.

here you can play around with the data in the temporary table and then update the data back to ITAB.

Hope the discussion was helpful and you got some idea.

Cheers,

Suvendu

0 Kudos
179

Hey Suvendu,

I exactly did what u have written, but it is showing error as " Unknown data SEL, not able to recognise".

What should I do now ??

Thanks

Chandan

0 Kudos
179

Hello Chandan,

In TOP include add a variable "DATA: sel type c."

that it.

Best Regards,

Suvendu