Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete from table type.

Former Member
0 Kudos

Hello,

I have a need to delete some entries from a table type where ID = some string.

Is it possible to do it in code without loops?

Can you plese provide correct syntax?

Thank you.

Georgy

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I assume that you have an internal table describe by a table type. You can use the syntax below.

delete itab where ID = <some_value>.

Regards,

Rich Heilman

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I assume that you have an internal table describe by a table type. You can use the syntax below.

delete itab where ID = <some_value>.

Regards,

Rich Heilman

0 Kudos

Hello Rich,

Thanks for the answer.

I was doing

delete from itab where ...

This is why it was not working.

10 points to you since you are the first one to reply.

Thank you.

Gerogy

0 Kudos

the DELETE FROM... syntax is when working with a database table.

Regards,

Rich Heilman

0 Kudos

That is correct.

Thanks.

Former Member
0 Kudos

Hi,

Use the where condition in the delete statement..

DELETE ITAB WHERE FIELDNAME = 'SOME STRING'..

Thanks,

Naren

Former Member
0 Kudos

Hi Georgy

It must be an internal table which might have been defined from table type.

Yes you can delete records from internal table. Here are few statements and use whichever suits your requirement.

- DELETE itab INDEX idx.

- DELETE itab FROM idx1 TO idx2.

- DELETE itab WHERE Field = Value.

- DELETE ADJACENT DUPLICATES FROM itab Comparing Field1 Field2 .... (Sort the table by Field1 Field2 .. before deleting duplicate entries)