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: 

Internal table delete

Former Member
0 Kudos

Hi,

What would be the best way to delete the records from an internal table. I am not using the primary key here.

I need to delete the records from the internal table which does not match the input parameter given.

For example:

I have some records in an internal table. I need to delete the records whcih does not match the condition.

I have around 85000 records in my internal table I_iflot. The primary key here is TPLNR in IFLOT table. But I am deleting the records based on some other field which is the input parameter OBJNR. Pls see below statement and let me know how exactly we can do this. As i am doing the deletion other than the primary key its taking hell lot time to excute the single statement.

SORT i_iflot BY tplnr.

Delete i_iflot where objnr not in r_objnr.

This statement is taking much time as this is not the primary key. But i need t delete with this cndition nly.

Any solution for this...

Regards,

Ram

4 REPLIES 4

Former Member
0 Kudos

Hi

You can modify your stmnt to the below.

Loop at i_iflot.

if i_iflot-objnr not in r_objnr.

delete i_iflot index sy-tabix.

endif.

endloop.

Regards,

Raj

Former Member
0 Kudos

I don't think we have too many options here.

What you are doing should be OK.

regards,

Ravi

Former Member
0 Kudos

Hi Ram,

What are you trying to delete -

a)Device Location

b) Connection Object. Refer the possible values

for FLTYP.

You can add FLTYP (Functional location category) in the where condition and delete from IFLOT.

You can also select TPLNR based on OBJNR entered in the parameter before deletion statement.

Hope this helps.

Manish

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

If possible,you can restrict the internal table by selecting only the records satisfying the parameter given.

select * from db into table i_iflot where objnr in r_objnr.