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

Conditional delete on an internal table

Former Member
0 Likes
1,097

Hi,

How to do Conditional delete on an internal table using a negative clause

Thanks,

Manjula.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
750

Hi,

Assume an internal table TAB1 with the following definition. TAB1 is built from the database table DBTAB and contains many possible values for the table column FLAG (except the initial value). The functionality covered in this example is the case where all the internal table values with the value of FLAG not equal to ‘D’ have to be deleted. The table contains 100,000 rows.

LOOP AT TAB1

IF TAB1-FLAG <> ‘D’.

TAB1-FLAG = SPACE.

MODIFY TAB1 INDEX SY-TABIX

TRANSPORTING FLAG.

ENDIF.

ENDLOOP.

DELETE TAB1 WHERE FLAG = SPACE

Reward points if found helpfull...

Cheers,

Chandra Sekhar.

4 REPLIES 4
Read only

former_member156446
Active Contributor
0 Likes
750

You wanted to delete all entires with f1 LE 7.

delete itab where itab-f1 GR 7.

reward points if helpful.

Read only

Former Member
0 Likes
750

Hi,

Use the code..

delete <itab> where <itab-fieldname> NE ''value'.

eg.

delete itab where matnr NE 10.

Read only

Former Member
0 Likes
750

Hi,

if certain action has done on the internal table then delete the record,

for example,

if it_tab-fname ne 'X'.

delete it_tab with index sy-tabix.

endif.

Plzz reward points if it helps.

Read only

Former Member
0 Likes
751

Hi,

Assume an internal table TAB1 with the following definition. TAB1 is built from the database table DBTAB and contains many possible values for the table column FLAG (except the initial value). The functionality covered in this example is the case where all the internal table values with the value of FLAG not equal to ‘D’ have to be deleted. The table contains 100,000 rows.

LOOP AT TAB1

IF TAB1-FLAG <> ‘D’.

TAB1-FLAG = SPACE.

MODIFY TAB1 INDEX SY-TABIX

TRANSPORTING FLAG.

ENDIF.

ENDLOOP.

DELETE TAB1 WHERE FLAG = SPACE

Reward points if found helpfull...

Cheers,

Chandra Sekhar.