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: 

changing negative amounts to positive in an internal table

Former Member
0 Kudos

Hi,

I have few currency fields in my internal table of which few are nagative. if they are negative i need to make them positive. is there any way to avoid loop and checking each and every entry.

your help would be appreciated.

Thanks,

Kranthi.

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Hi Kranthi,

Use loop at where cuur le 0.

endloop.

if you want to avoid full table loop.

vijay

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

No, you will need to loop at the interal table, check to see if it is less than 0, if it is, multiply by -1, and modify the record..

loop at itab.

if itab-field1 < 0.
itab-field1 = itab-field1 * -1.
modify itab.
endif.

Endloop.

Please mark you post as answered when answered completly. Thanks.

Regards,

Rich Heilman

former_member188685
Active Contributor
0 Kudos

Hi Kranthi,

Use loop at where cuur le 0.

endloop.

if you want to avoid full table loop.

vijay