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 / jitendra

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.

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.
SORT ITAB BY SAL DESCENDING.
READ TABLE ITAB INTO WA_IT INDEX '3'.
SAAL = WA_IT-SAL.
clear wa_it.

LOOP AT ITAB INTO WA_IT where sal eq saal.
*append wa_it to itab1.
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

What is the use of buffering?

744


What is the last entry in all bdc tables? : abap bdc

763


Explain what are the events used in interactive reports?

680


what are the important fields while preparing sales order,inquiry?

2085


how 2 create the normal form by using functional module

2326






What are the types of data types in the sap abap?

645


where are the passwords for ITS stores?

1807


What are logical data bases used in hr module? : abap hr

860


What is a data dictionary? : abap data dictionary

754


What are Table control and tab strip control in dialog programming ?

5453


How can I get ascii value of any letter? Is there any function?

867


Differentiate database index and match code.

791


What are the different modules of sap? : sap abap hr

767


What are the different types of mode (run code) in call transaction method?

804


hi frends this is bala raju from pune.i want to know diff between 4.7ee and ecc 5.0.if possible give me brief explanation.this question was asked in EDS(tele interview) in pune bye.

1902