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

can we use function MAX MIN on internal table

Former Member
0 Likes
714

can i use MAX, MIN function on internal table , i can use while selecting data from database table but can i use the same from internal table, if no then is there any thing from which i can calculate the max , min and avg value

there are approx 40 fields in a table .

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
3 REPLIES 3
Read only

Former Member
0 Likes
531

There is one way you can get the Max, MIn & avg values from internal table.

SORT (the internal table) BY (Key).
          READ TABLE it_table  INTO wa_table INDEX 1.
          IF sy-subrc EQ 0.
         "This forms the Min value
          ENDIF.
          DESCRIBE TABLE it_table LINES v_line.
          READ TABLE it_table INTO wa_table INDEX v_line.
          IF sy-subrc EQ 0.
            "This forms the Max value
          ENDIF.
        ENDIF.

Calculate the average from this.

Regards

Kannaiah

Read only

Former Member
Read only

Former Member
0 Likes
531

thanks