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

delete records

Former Member
0 Likes
614

i have a report with some fields..

i want to delete the records where few fields are coming with zero values,,,

how can i remove the entire record where the field has zero values

i have a report with some fields..

i want to delete the records where few fields are coming with zero values,,,

how can i remove the entire record where the field has zero values

4 REPLIES 4
Read only

Former Member
0 Likes
592

Hello Swetha,

If the records are availble in an internal table. YOu can delete the records based upon the condition before displaying.

Do like this:


  DELETE IT_TC01 WHERE WTG001 LE 0
                   AND MEG001 LE 0.
" Here from the table IT_TC01 records will be deleted will WTG001 or MEG001 is initial.

Hope this will solve ur issue.

Cheers,

Vasanth

Read only

Former Member
0 Likes
592

Hi,

Using the statement DELETE.

DELETE itab WHERE <Logical expression>.

Rgds,

Bujji

Read only

Former Member
0 Likes
592

Hi,

Try this...

Delete itab where f1 = 0 and f2 = 0 and f3 = 0.

or..

Loop at itab into istab.

if f1 = 0 and f2 = 0 and f3 = 0.

istab-flag = 'X'.

modify itab from istab index sy-tabix transporting flag.

endif.

delete itab where flag = 'X'.

Regards....

Read only

vinod_vemuru2
Active Contributor
0 Likes
592

Hi,

Suppose ur internal table has 10 fields and u want to delete all the records for which either field1 or field2 is zero, Then do like this.

SORT itab BY field1 field2.

DELETE itab WHERE field1 EQ 0

OR field2 EQ 0.

If u want to delete only if both the fields are 0 then just give AND instead of OR.

SORT itab BY field1 field2.

DELETE itab WHERE field1 EQ 0

AND field2 EQ 0.

Thanks,

Vinod.