Current Position:Home > ABAP Query to display top 5 employees who are having highest salary

ABAP Query to display top 5 employees who are having highest salary

Update:11-30Source: network consolidation
Advertisement
How will you write a query in abap to display top 5 emplyeee records who are having Highest Salary Among all the employees.
Please Reply...

The Best Answer

Advertisement
Hi Kush,
Before writing any Database Query, always keep 2 important thumb rules in your mind :
1. Keep the number of data base access small
2. Keep the amount of data transfer small.
As you mentioned the Database Table has only 100 records, you can locally buffer the Table. So, make a local buffering and then you can sort the table based on the salary.
Select *
  from Table_name
into table gt_itab.
Sort gt_itab by salary descending.
Now you can read the  entries one after the another based on the index.
Have a look at the following code for an efficient performance feature. Goto SE38 and have a look at the ABAP Examples.
demo_select_some_columns. Package : SABAPDEMOS
Hope this will help.
Thanks,
Samantak.
  • ABAP Query to display top 5 employees who are having highest salary Update:11-30

    How will you write a query in abap to display top 5 emplyeee records who are having Highest Salary Among all the employees. Please Reply...Hi Kush, Before writing any Database Query, always keep 2 important thumb rules in your mind : 1. Keep the numb

  • Query to display one row per group based on highest value Update:11-30

    I have the following table and I want to be able to create a query that displays only the highest number based on a group. (see below) Acode aname anumber a Jim 40 a Jim 23 a Jim 12 b Sal 42 b Sal 12 b Sal 3 Acode aname anumber a Jim 40 b Sal 42Multi

  • How can we get the top 5 employees list ................ Update:11-30

    How can we get the list of top 5 employees who are drawing highest salaries from a tableSQL> select * from   2  (select ename,sal from emp order by sal desc)   3  where rownum < 6; ENAME             SAL KING             5000 SCOTT            3000 FO

  • SQL query on emp table(SCOTT Schema): Highest salary per department Update:11-30

    From emp table of SCOTT schema. I would like to know the name, sal,the deptno he belongs of the highest paid employee from each dept. Explaining further: The following query only returns deptno and max(sal) of each department. I need the name of the

  • ABAP QUERY PROGRAM OUTPUT SHOULD DISPLAY FROM SAP SCRIPT. Update:10-11

    THIS IS MY URGENT REQUIREMENT ... I DONT KNOW ABAP QUERY PROGRAM .. PLEASE SUGGEST ME A WAY ON THIS .... Functional requirements Introduction The wish of the customer is a printable customer overview. All desired fields will be shown in a new query c

  • Display long text in an ABAP Query. Update:11-30

    Hi all, Could any one please help me in guiding me, to tell how can I display the long text which is got from the function module 'READ_TEXT'  in an ABAP query. The issue here is that Iam able to loop at the <itab> table and get the long text for ea

  • ABAP Query display variant problem Update:11-30

    Hi,   We have three different SAP clients development DV1, Staging ST1 and production PC1. I have created an abap query for which I m trying to create a global display variant (not user specific). I m able to do so easily in DV1 and PC1 systems. But

  • ABAP Query : code to change the display Update:11-30

    Hi all, I have created an Abap Query and generated it. I see the output now as follows: <u>Bill.doc</u>     <u>Item</u>   <u>Net value</u>  <u>Total amt</u> 900000                    10                  100 

  • Pnp- logical db in abap query Update:10-11

    hi. i need to create an ABAP/sap query. when i created the InfoSet i used logical db-pnp. if i want to get only the employees which entered my organization during the last month where should i add the ABAP code,  under which section => extras -> cod

  • Adding code in ABAP Query(ABAP HR) Update:11-30

    I have created an ABAP Query for getting the Absence details of employee within a specified period.I am populating the fields Employee number, Organization Unit,Absence start date,Absence hours, Absence enddate. If an employee is in leave for 10 days