Skip to Content

delete entries from internal table.

i have 2 internal tables ITAB1 and ITAB2 with different entries.

data: ITAB2 type table of TAB2.

TAB2 is standard database table.

i have to delete entries from ITAB1 where TAB2-FIELD is not blank.

Please suggest the code.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2010 at 05:30 AM

    Press F1 on Delete syntax

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 29, 2010 at 05:32 AM

    i have 2 internal tables ITAB1 and ITAB2 with different entries.

    data: ITAB2 type table of TAB2.

    TAB2 is standard database table.

    i have to delete entries from ITAB1 where TAB2-FIELD is not blank.

    TAB2-FIELD is not present in TAB1.

    Please suggest the code.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      You will need common fields in table itab1 and itab2. As per my understanding, table itab2 is having structure of standard tble tab2. And internal table itab1 is of some different structure.

      So, in order to delete entries from itab1 based on itab2-field i.e. tab2-field, you need releation between two tables. There must be some common fields in itab1 and itab2. You will have to loop at table itab2 and read table itab1 with the key fields and then use

      if itab2-field is blank.

      delete itab1 index sy-tabix.

      endif.

      Thanks,

      Archana

  • Posted on Jan 29, 2010 at 06:03 AM

    Hi,

    There must be some link between the two tables..

    If primary key of table TAB2 is present in TAB1

    Then you can go ahead like this:

    SELECT common_field<preferably primary key> INTO

    table itab3 FROM TAB2

    WHERE TAB2-FIELD NE space.

    LOOP AT ITAB3 into wa_itab3.

    DELETE ITAB1 WHERE common_field EQ wa_itab1-common_field.

    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.