Application Development and Automation 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: 
Read only

Dynamically deleting rows from an internal table

Former Member
0 Likes
501

Hi Experts,

Why is the following statement not supported in abap ? is there any workaround for ?

Delete <table> where (lv_property_name) not in lt_select_options.

I know it is possible to write :

delete table <tbl> with table key (lc_fieldname) =  lv_property_value.--> But this is not what i m looking for.

I have the work arround :

loop at <table> assigning <fs_table>.

       ASSIGN  component lf_property OF STRUCTURE <fs_table> TO <field>.

       if <field> not in lt_sel_options.

         delete <table> index sy-tabix.

         unassign <field>.

       endif.

endloop.

.

is there any better solution , so wthout looping the table ???

Thanks

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
461

Delete <table> where (lv_condition_syntax)

is possible, if that's of any help. See ABAP documentation for DELETE statement for all details.



Thomas

2 REPLIES 2
Read only

ThomasZloch
Active Contributor
0 Likes
462

Delete <table> where (lv_condition_syntax)

is possible, if that's of any help. See ABAP documentation for DELETE statement for all details.



Thomas

Read only

Former Member
0 Likes
461

Hi,

Your solution is good enough. It is easy to read and it does its thing efficiently.

Personally I wouldn't wast too much time on internal table operations, nowadays these operations are executed extremely fast, the only thing that I would worry about is, is this understandable for someone else.

Kind regards, Rob Dielemans