Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Utility class for internal table manipulations (get min/max from any column in a table)

$
0
0

Hi SCN community!

 

Ever wanted to get the line in a table where the max value for a certain field was? I had to last week, and I remembered just how awful it was to do it. Declare an auxiliary table of the same structure, copy the entire contents, sort for the right field, get the first line, correct?

 

I thought that there had to be a better way to do this, and I searched for it, and couldn't find it. And I was actually challenged by Manish Kumar to create a class for this, and so I did.

 

What I'm sharing is a simple class for internal table manipulations. So far it has 4 methods:

  • GET_MAX_LINE - Get the line with the maximum value for a certain column
  • GET_MIN_LINE - Get the line with the minimum value for a certain column
  • GET_MAX_VAL - Get the the maximum value for a certain column
  • GET_MIN_VAL - Get the the minimum value for a certain column

 

I'm trying to set up github so that we can all work on this together, hopefully we will be able to work on other utility classes like this one.

 

If you have any suggestions or contributions please feel free to join

 

I'm sharing a slinkee that you can import using SAPLINK and also a source code-based class implementation that you can copy paste in SE24. The slinkee is the file called "CLAS_ZCL_ITAB.txt" and you'll have to change the extension to 'slnk'.

 

Best,

Bruno


Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>