‎2009 Feb 23 10:24 PM
Hello,
how can I delete selected or marked lines in a table control.
Suppose the user selects some lines and on button kilck these lines
must be deleted.
Reagrds
sas
‎2009 Feb 24 7:13 AM
I am very sorry when the user selects the row the mentioned field
(char field) doesnt get filled.
Under the properties of the table control, I have activated the check box w/SelColumn .
In the debugger I can see it. It is empty. It is declared as shown below.
CONTROLS: tc_itab TYPE TABLEVIEW USING SCREEN 0400.
DATA:
ok_code TYPE sy-ucomm,
zeile(6) TYPE n,
zeile_tc(6) TYPE n,
cols TYPE cxtab_column,
scr LIKE screen,
BEGIN OF itab OCCURS 0,
mark,
feld1(10),
feld2(4),
feld3(5),
END OF itab.*
‎2009 Feb 23 10:42 PM
you should have a1 char field called SEL that's filled with an 'X' when the user selects the row.
simply loop through your control to find them.
‎2009 Feb 23 11:00 PM
Include a single char field in your internal tab, say pick,
PROCESS AFTER INPUT.
MODULE user_command_0200.
MODULE user_command_0200 INPUT.
CASE ok200.
WHEN 'DELETE'.
DELETE gt_itab WHERE pick = 'X'
ENDCASE.
CLEAR ok200.
ENDMODULE.
Under the properties of the table control, you should tick the check box w/SelColumn and give as gt_itab-pick.
‎2009 Feb 24 7:13 AM
I am very sorry when the user selects the row the mentioned field
(char field) doesnt get filled.
Under the properties of the table control, I have activated the check box w/SelColumn .
In the debugger I can see it. It is empty. It is declared as shown below.
CONTROLS: tc_itab TYPE TABLEVIEW USING SCREEN 0400.
DATA:
ok_code TYPE sy-ucomm,
zeile(6) TYPE n,
zeile_tc(6) TYPE n,
cols TYPE cxtab_column,
scr LIKE screen,
BEGIN OF itab OCCURS 0,
mark,
feld1(10),
feld2(4),
feld3(5),
END OF itab.*
‎2009 Feb 24 7:19 AM
Hi.
Under the properties of the table control, I have activated the check box w/SelColumn .
u will have to give field name as itab-mark , not only mark under this field.
‎2009 Feb 24 7:29 AM
In attributes of Table Control give w/selcolumn name as ITAB-MARK.
Now, in PAI you can write.
DELETE ITAB WHERE MARK = 'X'.
Regards
Sathar
‎2009 Feb 24 9:37 AM
hi,
the current problem is the output in the table control is not being updated after I have deleted the line ?
What can cause that ?
Reagards
sas
‎2009 Feb 24 10:00 AM
Hello,
if you use an alv for displaying the table you sould use REFRESH_TABLE_DISPLAY.
Regards,
Alexandra
‎2009 Feb 24 7:16 AM
Hi Erdem,
After selecting lines, if user click on delete button, you just need to delete those lines from internal table.
take marked column as 'SEL' and also set that in the table control properties also. Let me know if you want further explanations.
Regards,
Anil
Edited by: Anil Salekar on Feb 24, 2009 8:17 AM
‎2009 Feb 24 7:28 AM
Hi...
After adding the one char field in your table control, you need to modify the internal table display data in your table control in PAI.
Here is an e.g.
PROCESS AFTER INPUT.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC_QNR'
LOOP AT g_t_tc.
CHAIN.
FIELD g_wa_tc-mandt.
FIELD g_wa_tc-srno.
MODULE tc_qnr_modify ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.The module tc_qnr_modify is used to modify the value of the "Selection" field.
*&SPWIZARD: INPUT MODULE FOR TC 'TC_QNR'. DO NOT CHANGE THIS LINE!
*&SPWIZARD: MODIFY TABLE
MODULE tc_qnr_modify INPUT.
MODIFY g_t_tc
FROM g_wa_tc
INDEX tc_qnr-current_line.
ENDMODULE. "QUEST_TC_MODIFY INPUTThe Selection field of your internal table would be marked 'X' for all the selected rows.
You can delete them from the internal table using DELETE statement.
Hope this was helpful.
Regards,
Himanshu