Skip to Content
author's profile photo Former Member
Former Member

deletion in table control

Hi all,

I have to delete a item details from a table control.

tell how should I do it.

urgent.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 12:50 PM

    Hi,

    delete it from the internal table which u r passing to the table control.

    Cheers,

    Will.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 12:54 PM

    Delete it from the itab from which you have populated the table.

    like:

    delete itab from index1 to index2.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 12:55 PM

    Hi Vivek,

    Check it.

    MODULE user_command_0100 INPUT.

    CASE sy-ucomm.

    WHEN 'DEL'.

    • remove marked lines

    LOOP AT it_tabctrl

    INTO wa_tabctrl

    WHERE marked EQ kc_sel.

    IF sy-subrc EQ 0.

    DELETE it_tabctrl INDEX sy-tabix.

    ENDIF.

    ENDLOOP.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0100 INPUT

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 12:58 PM

    HI,

    I am assuming you have defined mark on the screen for each and every table line. After that just loop at the table control and check for the value of mark.

    When the value will be 'X' perform any operation on that line(in your case it is delete).

    Regs,

    Saurabh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 01:41 PM

    loop at itab.

    if mark = 'X'.

    delete itab from index sy-tabix.

    modify itab.

    endif.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 08:24 AM

    I had a similar requirement in my project.

    You will have to use two internal tables in order to delete the entries from the standard Z tables.

    Here, tb_line is the name of internal table used for the table control.

    tb_line_del is the internal table used to store the deleted entries from the table control.

    The code when clicking on DELETE button is :

    case sy-ucomm.

    when 'DELETE'.

    ***To delete the selected line from table control****

    loop at tb_line.

    if tb_line-mark = 'X'.

    move-corresponding tb_line to tb_line_del.

    append tb_line_del.

    delete tb_line.

    endif.

    endloop.

    Once the entries are there in the tb_line_del internal table,now the following code has to be written to delete the entries from the Z table corresponding to the values in the tb_line_del internal table.

    Here,TCL_ITEMS is the name of the table control.First you need to check if there are any entries in the table control.Then you can go ahead withe the deletion of rows from the Z table.

    I have written this code in a form by name 'SAVE' .In the PAI module of the screen when clicking on the save button you should use the following code.

    CASE sy-ucomm.

    WHEN 'SAVE'.

    ****perform Save subroutine to perform save operation******

    PERFORM save.

    The code for form 'SAVE' would be :

    IF TCL_ITEM-LINES NE 0 .

    ****Update the entries into header table****

    MODIFY ztm09_ekko. *ztm09_ekko,ztm09_ekpo are the z tables used*

    LOOP AT tb_line.

    ztm09_ekpo-ebeln = ztm09_ekko-ebeln.

    ztm09_ekpo-ebelp = tb_line-ebelp.

    ztm09_ekpo-matnr = tb_line-matnr.

    ztm09_ekpo-menge = tb_line-menge.

    ztm09_ekpo-meins = tb_line-meins.

    ztm09_ekpo-netpr = tb_line-netpr.

    ztm09_ekpo-waers = tb_line-waers.

    *****Update the entries into item table*****

    MODIFY ztm09_ekpo.

    ENDLOOP.

    LOOP AT tb_line_del.

    ztm09_ekpo-ebeln = ztm09_ekko-ebeln.

    ztm09_ekpo-ebelp = tb_line_del-ebelp.

    ztm09_ekpo-matnr = tb_line_del-matnr.

    ztm09_ekpo-menge = tb_line_del-menge.

    ztm09_ekpo-meins = tb_line_del-meins.

    ztm09_ekpo-netpr = tb_line_del-netpr.

    ztm09_ekpo-waers = tb_line_del-waers.

    ****Delete the entries from ztm09_ekpo****

    DELETE ztm09_ekpo.

    ENDLOOP.

    ***Displaying the corresponding messages****

    MESSAGE 'SAVED SUCCESSFULLY' TYPE 'I'.

    CLEAR ztm09_ekko.

    CLEAR tb_line. REFRESH tb_line.

    LEAVE TO SCREEN 100.

    ENDIF.

    Reward if helpull

    Thanks,

    kushagra

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.