Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
bruno_esperanca
Contributor

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.kumar19 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 5 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 maximum value for a certain column
  • GET_MIN_VAL - Get the minimum value for a certain column
  • GET_AVG_VAL - Get the average 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.

EDIT: Github successfully set up! You can follow this project here:

EsperancaB/sap_project_object · GitHub

Thanks!

For revision 3 I have changed the exception throwing strategy (much cleaner now) and taken shai.sinai's suggestion of using the component's name instead of looking for its index. GREAT catch!!

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

Best,

Bruno

58 Comments