Sunday, August 2, 2015

Average Sum Maximum Minimum by Select

We can calculate the average and sum of any quantity type field directly from select statement. Similarly we can extract the maximum value or minimum value from quantity type field. In the below example the system fetches the data of MENGE field from EKPO table and calculate its average and sum and then put into the packed type variable ‘average’ & ‘sum’ respectively. Similarly it fetches the maximum and minimum values from MENGE and put it packed type variable ‘maximum’ & ‘minimum’. Here the WHERE clause is optional. To avoid the entire field records we have used this clause.

In the database we find this MENGE field with PO number '3000000057'.






















REPORT  zabap_gui.

DATA:
      average TYPE p DECIMALS 2,
      sum     TYPE p DECIMALS 2,
      maximum TYPE p DECIMALS 2,
      minimum TYPE p DECIMALS 2.

* Here the MENGE field of EKPO table has been used
* to calculate the average, sum, maximum & minimum
SELECT AVG( menge )
       SUM( menge )
       MAX( menge )
       MIN( menge )
  FROM ekpo
  INTO (average, sum, maximum, minimum)
  WHERE ebeln = '3000000057'.

WRITE: / 'Average = ', average,
       / 'Sum     = ', sum,
       / 'Maximum = ', maximum,
       / 'Minimum = ', minimum.

Here is the output.




12 comments:

Phani Indra said...

Hiii sir... Ur blog is excellent its very easy to understanding the concepts ... u described in a very easy manner I want to be a touch... can u share ur email or SAP SCN OR FB ID... I hav some doubts in abap plz help me out

Thanks,
Phani N

Rahul said...

It was very nice blog to learn about Selenium.Thanks for sharing new things.selenium training in chennai

Bhavya Kumar said...

Best blog.Got to learn new things.Thanks for this Blog SAP Success Factors Training in Chennai

Shalini said...


Hi, This is shalini from Chennai learned SAP Training in Chennai from mr.karthick. The training really was good and i got selected in leading mnc company as SAP Consultant.

You can contact 8122241286 for Best SAP Training in Chennai or reach www.thecreatingexperts.com

Shruti Ramalingam said...


From My search…Creating Experts provides Best SAP Training with real time projects assistance.

Most of the modules are equipped with advance level topics which the student can learn from the basics to the advance level stage.

They also provide placement assistance in leading MNC companies across the globe according to the current requirements.

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

And these are the Best SAP training institute which provides Real Time Hands on Training…

codedion Technologies-9003085882

creating Experts-8122241286

http://thecreatingexperts.com/sap-mm-training-in-chennai/

Shalini said...

SAP Success Factors Real Time Hands on Training in Chennai…

Don’t always Depend on Training Institute alone.Please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286
http://thecreatingexperts.com/sap-mm-training-in-chennai/

Both Classroom/Online Training is Available!!!!!!

kavi kalyan said...

Best SAP Success Factor Training in Chennai

http://thecreatingexperts.com/sap-training-in-chennai/
http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
http://thecreatingexperts.com/sap-mm-training-in-chennai/
http://thecreatingexperts.com/sap-fico-training-in-chennai/

suganya said...

SAP Success Factors Real Time Hands on Training in Chennai…

Don’t always Depend on Training Institute alone.Please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286
http://thecreatingexperts.com/sap-mm-training-in-chennai/

Both Classroom/Online Training is Available!!!!!!

Unknown said...


Best SAP MM Material Managemnt Real time hands on Training in chennai

http://thecreatingexperts.com/sap-mm-training-in-chennai/

sushma said...

Informative Blog...For a long time I was craving for a career growth in programming and then I came to know that THE CREATING EXPERTS is the one who provide training with hands on training and real time scenarios

http://thecreatingexperts.com/sap-abap-training-in-chennai/

contact 8122241286

ragu varan said...

Best SAP HANA Training in Chennai by leading HANA Consultant.
Reach at 9003085882
http://thecreatingexperts.com/category/sap-hana-training-in-chennai/

gilledashivani said...

Great information. the information provided is of great use as i got to learn new things. If you are looking for real time training in SAP ABAP, kindly contact sieve software
Sieve software offers real time training by industry experts with live projects and placement support.
SAP ABAP TRAINING IN HYDERABAD