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

Deletion from internal table

Hi,

My requirement is that I have to delete the duplicate values before doing any manupilation of data.. so for this I have written the code...

*Deleting all the duplicate entries comparing group code, GL *& GL Suffix

IT_INPUT_TEMP[] = IT_INPUT[].

SORT IT_INPUT_TEMP BY GRCODE GL GLSUF.

DELETE ADJACENT DUPLICATES

FROM IT_INPUT_TEMP COMPARING GRCODE GL GLSUF.

Now with the remaining values in the internal table I have to check the 3rd field i.e. GLSUF & if it = '00000' (5 zeros)... i have to delete those entries...

For this I have written...

  • Deleting enteries where the GL Suffix is zero.

IF IT_INPUT_TEMP-GLSUF = 00000.

DELETE IT_INPUT_TEMP.

ENDIF.

It gives me a dump saying "Invalid_Table_Index"...

Prior to this I have also checked up by using Index function.

  • Deleting enteries where the GL Suffix is zero.

IF IT_INPUT_TEMP-GLSUF = 00000.

DELETE IT_INPUT_TEMP index l_tabix.

ENDIF.

Can anyone tell me where I am wrong??..

Thank You & Regards,

-S.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Feb 25, 2005 at 07:24 PM

    Hi S,

    Your code extract

    * Deleting enteries where the GL Suffix is zero.
    IF IT_INPUT_TEMP-GLSUF = 00000. 
      DELETE IT_INPUT_TEMP. 
    ENDIF.

    Either this should be in a loop(which is unnecessary if all you are trying to achieve is deleting records), or you can try the option with 'WHERE' clause as mentioned in the above post.

    DELETE FROM IT_INPUT_TEMP WHERE GLSUF = '00000'.

    Regards,

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2005 at 07:03 PM

    Hello SAP,

    you have two possibilities here. Either you use a delete command from all the entries that meet the criteria (e.g. Delete from itab where field = 00000) or you have to make sure your index field has a value (it might be initial)

    Please let me know if this helps you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2005 at 07:26 PM

    Hi,

    The deletion is happeninn correctly now... I deleted the previous code & wrote..

    DELETE IT_INPUT_TEMP WHERE GLSUF = 00000.

    It's working fine now ... I hope it works the same way in production server...

    Thank You,

    -S.

    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.