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: 

How to pick the lower value among the Four amount fields

naveen_inuganti2
Active Contributor
0 Kudos

Hi Experts,

I have four amount fields like following:

Amt1

Amt2

Amt3

Amt4

Now I have show the output with lower value among the aboe four.

i.e. Mininmum of Amt1 Amt2 Amt3 Amt4.

Ex: If,

Amt1 = 22.00

Amt2 = 451.00

Amt3 = 11.00

Amt4 = 126.00

The output should be Amt3 i.e 11.00.

I don't want to use LE, LT..kind of operaters.

Please let me know if there is any keyt word or short method for this.

Thanks

Naveen Inuganti

3 REPLIES 3

Former Member
0 Kudos

>

> I don't want to use LE, LT..kind of operaters.

Could you explain why? This is what LT is there for.

Rob

0 Kudos

Hi Rob,

Just to avoid the answers with that solution.

Yes we can use it. It could be something like following.

If Amt1 lt Amt2.
 If Amt1 lt Amt3.
  If Amt1 lt Amt4.
   Result = Amt1.
  else.
   Result = Amt4.
  endif.
else.
   If Amt3 lt Amt4.
   Result = Amt3.
  else.
   Result = Amt4.
  endif.
endif.
else.
If Amt2 lt Amt3.
  If Amt2 lt Amt4.
   Result = Amt2.
  else.
   Result = Amt4.
  endif.
else.
   If Amt3 lt Amt4.
   Result = Amt3.
  else.
   Result = Amt4.
  endif.
endif.
endif.

Its good if there is some thing like.. Lower of ( Amt1, Amt2, Amt3, Amt4 ) and I heared that this can be possible in other languages.

But not sure about this keyword in ABAP.

Thanks,

Naveen Inuganti

Former Member
0 Kudos

I suppose you can use something like fm ISP_MINIMUM_CALC but that just hides what is going on.

Alternatively, there is an obsolete keyword MINIMUM that you can check using F1.

Or put all the values into an internal table, sort them and then take the first value.

Rob

Edited by: Rob Burbank on Feb 2, 2010 11:52 AM