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 lines

Former Member
0 Likes
1,220

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,193

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.

*

9 REPLIES 9
Read only

Former Member
0 Likes
1,193

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.

Read only

0 Likes
1,193

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.

Read only

Former Member
0 Likes
1,194

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.

*

Read only

0 Likes
1,193

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.

Read only

0 Likes
1,193

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

Read only

0 Likes
1,193

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

Read only

0 Likes
1,193

Hello,

if you use an alv for displaying the table you sould use REFRESH_TABLE_DISPLAY.

Regards,

Alexandra

Read only

Former Member
0 Likes
1,193

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

Read only

Former Member
0 Likes
1,193

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 INPUT

The 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