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

Delete internal table - Urgent

Hi

I have 2 int tables called it_final and it_z1log1.

I want to delete the records from it_final using it_z1log1.

following statement is going to dump. Both table has same structure

if it_z1log1[] is not initial.
delete it_final from it_z1log1.
endif.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

10 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:41 AM

    Hi,

    Try like this...

    Loop at it_final .
    read table it_z1log1 with key xyz = it_final-xyz.
    if sy-subrc = 0.
    delete it_final.
    continue.
    endif.
    Endloop.

    Regards,

    Vrithika

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:39 AM

    hi,

    Use like this.

    loop at itab1 into wa.

    delete itab2 from wa.

    endloop.

    Regards,

    Subramanian

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:40 AM

    hi.....

    is there any field mismatch.....just check.....whats the dump which you are getting.

    check the character lenth of variables in oth the structures.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 19, 2008 at 04:41 AM

    Hi,

    How you want to delete ?

    is that using the whole record

    do following way

    loop at itab1 into wa.

    delete table itab2 from wa.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:42 AM
    loop at it_final into wa_final.
    v_tabix = sy-tabix.
    read table it_zlog1 into wa_zlog1 with key field1 = wa_final-field1.
    if sy-subrc eq 0.
    delete it_final index v_tabix.
    endif.
    endloop.

    Regards

    Kannaiah

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 19, 2008 at 04:43 AM

    Hi Kumar,

    Your question is quite incomplete.. What I have understood is that you want to delete the table IT_FINAL based on the table it_z1log1.

    What you have to do is

    data: tabix type sy-tabix.
    Loop at it_final.
    tabix = sy-tabix.
    Read table it_z1log1 with key = <key val>.
    if sy-subrc = 0.
       delete it_final index tabix.
    endif.
    Endloop.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:44 AM

    Hi,

    Does your internal tables have work area. If yes then it will delete only the entry present in the work area. Else write :

    delete it_final[] from it_z1log1[].

    This should work, Give it a try.

    Regards,

    Lalit Kabra

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:46 AM

    use

    loop at itab1 where itab1-value eq ' '.

    loop at itab2.

    delete itab2

    ..........

    .............

    nested loops

    with where conditions

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 19, 2008 at 04:53 AM

    hi,

    see below example

    DATA : it_kna1 TYPE TABLE OF kna1 WITH HEADER LINE,

    it_kna2 TYPE TABLE OF kna1 WITH HEADER LINE.

    SELECT * FROM kna1 INTO TABLE it_kna1 UP TO 10 ROWS.

    SELECT * FROM kna1 INTO TABLE it_kna2 UP TO 30 ROWS.

    LOOP AT it_kna1 . " you can use where condition also with the loop

    DELETE TABLE it_kna2 FROM it_kna1.

    ENDLOOP.

    LOOP AT it_kna1.

    WRITE : / it_kna1-kunnr.

    ENDLOOP.

    SKIP.

    write : 'SECOND TABLE'.

    LOOP AT it_kna2.

    WRITE :/ it_kna2-kunnr.

    ENDLOOP.

    regards

    prasanth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 19, 2008 at 04:56 AM

    Hi,

    We cannot delete internal table form other internal table , we can delete the contents on internal table from workarea.

    Create a workarea for it_z1log1, example wa_it_z1log1.

    Loop at it_final.
    Read table it_z1log1 into wa_it_z1log1 with key abc = it_final-abc.
    If sy-subrc eq 0.
    Delete it_final from wa_it_z1log1.
    Endif.
    Endloop.

    This will surely work.

    Plz rewardi if useful.

    Thanks,

    Dhanashri.

    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.