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: 

How to retrieve data from Table Control

Former Member
0 Kudos

Hi,

I am a Beginner to ABAP. I want to know how to fetch the selected rows from Screen table control.

Here is my scenario:

I am having one table control with selection field. Once i select some rows means the selected rows are going to be stored in one Internal Table.

If any body knows the thing means please reply me the logic as well as giving me some code sample.

Thankyou.

1 ACCEPTED SOLUTION

gopi_narendra
Active Contributor
0 Kudos

what u need to do in order to capture is

in SE51 under the table control properties u have a property called W/SelColumn

give in some name to it (be ROW_CHK)

and now include a field

data : chk(1) type c.

to the internal table which u r passing to the tab ctrl.

now in PAI of tab ctrl

do this way

if ROW_CHK = 'X'.

chk = 'X'.

endif.

This way u can capture the rows selected.

now if u wnt to knw the selected rows.

write as

loop at itab where chk = 'X'.

move the selected rows to a new int table........

endloop.

Regards

Gopi

2 REPLIES 2

Former Member
0 Kudos

Hi Mithun,

Try to implement this code in your requirement.

There will be some button on your screen and after selecting some or all the records from the table control you must be pressing some button for collecting the selected rows from the table control too your internal table.

Put Fcode of that button in WHEN condition in this CASE.

CONSTANTS: kc_sel_flag TYPE char01 VALUE 'X'.

CASE sy-ucomm.

WHEN kc_sel.

PERFORM f_sel_desel USING kc_sel_flag.

ENDCASE.

FORM f_sel_desel

USING p_sel_desel TYPE c.

  • Set the value

wa_cond_type-z_sel = p_sel_desel.

  • Update the Itab.

MODIFY it_cond_type

FROM wa_cond_type

TRANSPORTING z_sel

WHERE mandt EQ sy-mandt. "Where cond is only to specify all

ENDFORM. " f_sel_desel

After that all the selected records will be having 'X' in the internal table.

Regards,

Mueksh Kumar

gopi_narendra
Active Contributor
0 Kudos

what u need to do in order to capture is

in SE51 under the table control properties u have a property called W/SelColumn

give in some name to it (be ROW_CHK)

and now include a field

data : chk(1) type c.

to the internal table which u r passing to the tab ctrl.

now in PAI of tab ctrl

do this way

if ROW_CHK = 'X'.

chk = 'X'.

endif.

This way u can capture the rows selected.

now if u wnt to knw the selected rows.

write as

loop at itab where chk = 'X'.

move the selected rows to a new int table........

endloop.

Regards

Gopi