‎2007 Sep 20 8:57 AM
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.
‎2007 Sep 20 9:15 AM
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
‎2007 Sep 20 9:10 AM
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
‎2007 Sep 20 9:15 AM
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