Application Development and Automation 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: 
Read only

delete record

Former Member
0 Likes
602

i have created a table control and i want to delete rows from the database tables if the check box is checked.

5 REPLIES 5
Read only

Former Member
0 Likes
580

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.

Read only

Former Member
0 Likes
580

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

Read only

Former Member
0 Likes
580

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

Read only

0 Likes
580

ya the check box is a selection column

Read only

Former Member
0 Likes
580

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