2006 Aug 24 3:33 PM
hi all,
Can any tell tell me how to delete multiple records in table control of a screen
i have checked the multiple rows in table control attributed and assigned a name.I needhelp in writing code.
Thanks
hi all,
Can any tell tell me how to delete multiple records in table control of a screen
i have checked the multiple rows in table control attributed and assigned a name.I needhelp in writing code.
Thanks
2006 Aug 24 3:37 PM
You will need to trigger the delete with some button after user has selected the records. There should be a "MARK" field in your internal table for the table control which is set when the user selecteds the row. Then all you need to do is loop this internal table and check the flag.
Loop at itab where mark = 'X'.
delete itab.
endloop.
refresh control 'ITABCON' from screen 100.Regards,
Rich Heilman
2006 Aug 24 3:46 PM
Hi Deepthi,
Please check SAP demo program <b>demo_dynpro_tabcont_loop_at</b>.
Hope this will help.
Regards,
Ferry Lianto
2006 Aug 24 3:47 PM
HI,
For your Intrnal table, put a extra field as startign field, that should be a checkbox, so in the output of table control, for every row you will get a checkbox, so check the checkbox which you want to delete, and press the delete button over there, in the code write as
loop at ITAB.
delete itab where CHECK_BOX = 'X'.
endloop.
if you do not want to display the duplicated records in the first time, then you need to delete the records before showing the output, so in this case, use DELETE ADJACENT DUPLICATES.....
Regards
Sudheer
2006 Aug 24 4:32 PM
hi,
As you have marked multiple fields in the table control your table control is mulple selection enabled.
<b>PROCESS AFTER INPUT.</b>
loop at IT_CONF.
field X_CONF-CHECK
module TC_CONF_mark on request.
endloop.
module TC_CONF_user_command.
MODULE USER_COMMAND_0102.*************************************************
*this modifies the internal table with check field as X
module tc_conf_mark input.
data: g_tc_conf_wa2 like line of it_conf.
if tc_conf-line_sel_mode = 1.
clear g_tc_conf_wa2.
loop at it_conf into g_tc_conf_wa2
where check = 'X'.
g_tc_conf_wa2-check = ''.
modify it_conf
from g_tc_conf_wa2
transporting check.
endloop.
endif.
modify it_conf
from x_conf
index tc_conf-current_line
transporting check.
endmodule.module tc_conf_user_command input.
* write code to handle table control scrolling /pageup/pagedown
endmodule*Check the ok_code
module user_command_0102 input.
case ok_code.
when 'DEL'.
* Delete from internal table where check = X
endcase.
endmodule. *************************************************
<b>PROCESS BEFORE OUTPUT.</b>
module TC_CONF_change_tc_attr.
loop at IT_CONF
into X_CONF
with control TC_CONF
cursor TC_CONF-current_line.
module TC_CONF_get_lines.
endloop.module tc_conf_change_tc_attr output.
describe table it_conf lines tc_conf-lines.
endmodule.
module tc_conf_get_lines output.
g_tc_conf_lines = sy-loopc.
endmodule.Thus you will delete the marked lines from the internal table in PAI and in PBO you can read the refreshed internal table without the table entries that are marked as deleted in the table control and display the same in the table control. This is another way.
Regards,
Richa