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

simple logic for min andmax

Former Member
0 Likes
507

RECDV Max min total

100 700 100 600

200

300

400

500

600

700

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
486

hi

Use MAX( itabfield ) and MIN( itabfield ) to accomplish the same.

Swetha Singh

RECDV Max min total

100 700 100 600

200

300

400

500

600

700

3 REPLIES 3
Read only

Former Member
0 Likes
486

if you are using an internal table to hold these values then sort the table by that field in assending order and read the table using index 1, you will get the minimum no. Then again sort it in decending order and read the table using index 1, you will get the maximum no.

Hope this will help you.

Read only

Former Member
0 Likes
486

sort itab1 by matnr ascending.

sort itab1 by matnr ascending.

read table itab1 index 1.

read table itab2 index 1.

if itab1-matnr LT itab2-matnr.

itab1 matnr is min.

else.

itab2-matnr is min.

endif.

You can do the same thing for Maximum but sort the tables by descending and do the same proceedure

Regards

Kiran

Read only

Former Member
0 Likes
487

hi

Use MAX( itabfield ) and MIN( itabfield ) to accomplish the same.

Swetha Singh