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 -ve value records

Former Member
0 Kudos

Hello All,

I am trying to delete the records if the value is less than zero.

IF it_tab-rhrs < 0 .

DELETE it_tab INDEX p_tabix.

ENDIF.

but its not deleting those records, still its displaying -ve values.

Points are rewarded.

thx.

~R

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Are you in a loop? What is the type of the field "rhrs"? It should be number type.

You can simply use the following syntax.

DELETE it_tab WHERE rhrs < 0.

4 REPLIES 4

Former Member
0 Kudos

Are you in a loop? What is the type of the field "rhrs"? It should be number type.

You can simply use the following syntax.

DELETE it_tab WHERE rhrs < 0.

0 Kudos

Im in loop and i took rhrs as CHAR type.

Basically im doing plant maintenance and trying to calculate Remaning works hours based on planned hours and actual hours.

it_tab-rhrs = it_tab-arbei - it_tab-ismnw.

if it_tab < 0.

i want to delete whole record.

thx.

~R

0 Kudos

Hi Raghu,

What is data type it_tav-rhrs ?

IF it_tab-rhrs < 0 .

delete table it_tab iNDEX p_tabix.-> use like this

ENDIF.

Thanks

seshu

0 Kudos

Hi,

I hope following code will solve your problem.

If you are not in a LOOP, then as Srinivas has said


DELETE it_tab WHERE rhrs < 0.

But, if you are in a LOOP, then


IF it_tab-rhrs < 0.
  DELETE it_tab INDEX sy-tabix.
ENDIF.

<b>OR</b>


IF it_tab-rhrs CS '-'.
  DELETE it_tab INDEX sy-tabix.
ENDIF.

Reward points if the answer is helpful.

Regards,

Mukul