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

minimum value

Former Member
0 Likes
3,124

Hi all,

I have 2 values,

a = 2300.

b = 2700.

I want to find the minimum value of this 2 by using "Min" function can you tell me the syntex.

7 REPLIES 7
Read only

Former Member
0 Likes
1,615

hii

use less than

if (a < b)

write:/ a ,is minimum .

else.

write:/ b ,is minimum .

hope this helps

Thanks& Regards

Naresh

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,615

Hi u dont have seperately 'MIN' function.

But u can have aggregate function to be used in the select statement.

If u want which is smaller.

U can use.

If a>b.

Write: b 'is minimum'.

endif.

cheers

simha.

Read only

Former Member
0 Likes
1,615

hi

if u want the syntax is

MIN( [DISTINCT] fdescriptor )

check this code


DATA: name     TYPE scustom-name, 
      postcode TYPE scustom-postcode, 
      city     TYPE scustom-city, 
      min      TYPE sbook-loccuram. 

SELECT scustom~name scustom~postcode scustom~city 
         MIN( sbook~loccuram ) 
       INTO (name, postcode, city, min) 
       FROM scustom INNER JOIN sbook 
         ON scustom~id = sbook~customid 
       WHERE sbook~fldate BETWEEN '20010101' AND '20011231' AND 
             sbook~carrid   = 'LH '                         AND 
             sbook~connid   = '0400' 
       GROUP BY scustom~name scustom~postcode scustom~city 
       ORDER BY scustom~name. 
  WRITE: / name, postcode, city, min. 
ENDSELECT. 

Read only

vinod_gunaware2
Active Contributor
0 Likes
1,615

Use the following logical operators to compare two data objects with different data types:

<operator>

Meaning

EQ

equal to

=

equal to

NE

not equal to

<>

not equal to

><

not equal to

LT

less than

<

less than

LE

less than or equal to

<=

less than or equal to

GT

greater than

>

greater than

GE

greater than or equal to

>=

greater than or equal to

regards

vinod

Read only

Former Member
0 Likes
1,615

Hi Manankumar,

Create your own Z function module.To the Function module give two values as Import parameters and Get the minimum value as Export Parameter.

The code for Function module as follows.

FUNCTION ZMINMUM.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(I_VALUE1) TYPE I

*" REFERENCE(I_VALUE2) TYPE I

*" EXPORTING

*" REFERENCE(E_MIN) TYPE I

*"----


if i_value1 < i_value2.

e_min = i_value1.

else.

e_min = i_value2.

endif.

ENDFUNCTION.

Assign function module to a Function group.

Thanks,

Vinay

Read only

Former Member
0 Likes
1,615

HI

GOOD

THE SYNTAX IS

MIN( [DISTINCT] col)

IT RETURNS THE MINIMUM VALUE IN THE COLUMN COL.

THANKS

MRUTYUN

Read only

Former Member
0 Likes
1,615

hi

u have create your z fun.

pass 2 values to it.

return minimun value from it.

u can calculate min value using,

if a < b.

min = a.

else.

min = b.

endif.