Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Hi, My question is " How to display 3rd highest salary
record from the internal table. The internal table has 2
fields named emno(Employee number) and salary.".
Send answer to my mail shaiksha.it@gmail.com.
Thanking you.

Answer Posted / nandana sai

TYPES : BEGIN OF ty,
eno(6) TYPE c,
sal TYPE labst,
END OF ty.

DATA : itab TYPE STANDARD TABLE OF ty,
wa_it TYPE ty,
itab1 TYPE STANDARD TABLE OF ty,
wa_it1 TYPE ty.

DATA : saal TYPE labst.

wa_it-eno = '1000'.
wa_it-sal = '10000'.
APPEND wa_it TO itab.
CLEAR wa_it.

wa_it-eno = '1001'.
wa_it-sal = '19000'.
APPEND wa_it TO itab.
CLEAR wa_it.

wa_it-eno = '1002'.
wa_it-sal = '10500'.
APPEND wa_it TO itab.
CLEAR wa_it.

wa_it-eno = '1003'.
wa_it-sal = '10080'.
APPEND wa_it TO itab.
CLEAR wa_it.

wa_it-eno = '1004'.
wa_it-sal = '10200'.
APPEND wa_it TO itab.
CLEAR wa_it.

wa_it-eno = '1006'.
wa_it-sal = '10400'.
APPEND wa_it TO itab.
CLEAR wa_it.

wa_it-eno = '1005'.
wa_it-sal = '10400'.
APPEND wa_it TO itab.
CLEAR wa_it.

wa_it-eno = '1007'.
wa_it-sal = '19000'.
APPEND wa_it TO itab.
CLEAR wa_it.

SORT itab BY sal DESCENDING.

itab1 = itab.

DELETE ADJACENT DUPLICATES FROM itab1 COMPARING sal.

READ TABLE itab1 INTO wa_it1 INDEX '3'.
saal = wa_it1-sal.

LOOP AT itab INTO wa_it WHERE sal EQ saal.

WRITE :/ wa_it-eno, 10 wa_it-sal.
ENDLOOP.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we reuse a userexit?

1484


What are the steps in creating screen ?

2044


What are standard layouts sets in the sap script?

1093


What is its?

1090


What is a predefined type in abap?

1172


What is a subscreen? How can we use a subscreen?

1063


Explain the Inportance of pa40? : abap hr

1058


What is tmg?

1138


how 2 create the normal form by using functional module

2588


How to find the return code of an stmt in abap programs?

1155


Create any functions? How to go about it?

1034


Write an abap program for creation of customer enquiry using BAPI 'BAPI_INQUIRY_CREATEFROMDATA'.

2190


How will u handle the situation – In a report using function module to generate a IDOC, How will u handle the error IDOC in the same report ?

2193


What is the difference between a pool table and a transparent table and how they are stored at the database level?

1062


what is the exact code that shoud be implimented in sap note

2493