‎2008 Feb 12 9:43 AM
i have created a table control and i want to delete rows from the database tables if the check box is checked.
‎2008 Feb 12 9:49 AM
Hi,
put a button delete in the screen if user selected the record and pressed delete then the record will deleted.
if sy-ucomm eq 'delete'.
loop at it_table_control into fs_table_control.
if sel_field eq 'X'.
delete ztable from fs_table_control.
if sy-subrc eq 0.
message s000.
endif.
endif.
endloop.
endif.
Plzz reward points if it helps.
‎2008 Feb 12 9:49 AM
Hello,
write a module in the PAI
write form delete_sel_row in that module.
FORM delete_sel_row TABLES lt_table TYPE STANDARD TABLE.
FIELD-SYMBOLS: <l_fs_selrow> TYPE ANY.
FIELD-SYMBOLS: <l_wa_table> TYPE ANY.
CLEAR gv_ok_code.
LOOP AT lt_table ASSIGNING <l_wa_table>.
ASSIGN COMPONENT 'SEL' OF STRUCTURE <l_wa_table> TO <l_fs_selrow>.
IF sy-subrc EQ 0.
IF <l_fs_selrow> EQ c_true.
DELETE lt_table.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM.
Reward points if helpful.
Tyanks,
Gunjan
‎2008 Feb 12 10:02 AM
Hi Santhosh,
whether the check box u meant here is the selection column?
If the check box is a selection column,please tell me whether you will be clicking any button after you click the check box?
Thanks,
Karthik
‎2008 Feb 12 10:07 AM
‎2008 Feb 12 11:06 AM
Hi Santhosh,
Here are the assumptions which i have made:
Screen Number - 100
Internal Table - it_demo
Delete(PF-Status) - DEL
My Suggestion is (Given Step by Step):
1) In the PAI Module, in the User_command_100 Module
check for the pf-status as DEL.
2) If its DEL then all the records from the Ztable where selcol = 'X' in the itab it_demo.
3) Then delete the records from the itab it_demo where selcol = 'X'. This deletion is done to make the updation in the table control with the new records.
I hope this answers your question. Please get back to me if it doesnt answers.
Thanks,
Santhosh