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

reg deleting entries from internal table

Hi experts,

I have two internal tables , ITAB1 and ITAB2 (same structure), i like to delete the records from ITAB1 which are in ITAB2 without looping .How it can be done?

regards,

Kannan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Sep 20, 2007 at 09:48 AM

    It relies on the size of your itabs. I will assume you want not to loop the first one (because is the biggest).

    LOOP AT itab2 INTO wa.
      DELETE TABLE itab1 FROM wa.
    ENDLOOP.

    If your itab2 doesn't contain zillion rows, it will be fast enough to not be painful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 20, 2007 at 09:45 AM

    Kannan,

    As both the tables are having the same strcuture take one more internal table itab3 and move the data in itab1 and itab2 to itab3.

    Now itab3 will have the data from both the itab1 and itab2.

    Now delete the adjacent duplicates from itab3.

    K.Kiran.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 20, 2007 at 09:46 AM

    hi Kannan,

    why without LOOPing? I guess you have to LOOP at least on one of the internal tables.

    ec

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 20, 2007 at 09:52 AM

    Hi,

    U have to go for loop..some cases we can't avoid it..so loop at least one table..

    Regards,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 10:06 AM

    Well if ur ready to loop on one table then i give u method as

    loop at itab1 .

    read table itab2 with key matnr = itab1-matnr .

    if sy-subrc eq 0 .

    delete itab1 .

    endif .

    endloop.

    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.