Professional Documents
Culture Documents
03 - ABAP Basics
Internal Tables
Exercise 02.03 - ABAP Basics Internal Tables Create the following programs using ABAP Workbench tool
Note: All the following objects to be created should follow a naming convention YEMPID_##$$%%, where ##$$ indicates the exercise number and %% indicates the question number in the exercise (0203 in this case) and EMPID indicates the employee ID.
1.
a.
Create a field string according to the following structure. b. Create an internal table using the above field string and populate it with the following data. Customer num ber C001 C002 C003 Customer name JOHN MIKE ARNOLD City NEW YORK LONDON MINNESOTA LONDON MINNESOTA NEW YORK
c.
Get the following output using the internal table. C002 MIKE C003 ARNOLD C001 JOHN
2.
a.
Create an internal table to store the following data. Customer numb er C001 C002 C003 C002 C001 C003 Customer name JOHN MIKE ARNOLD MIKE JOHN ARNOLD Amount 5000 2000 2000 2000 1000 3000
b. Get the following output. C001 C002 C003 JOHN MIKE ARNOLD 6000 4000 5000
a. Create an internal table to contain the following purchase details and populate the internal table. Purchase order number 6001 6002 Customer num ber C001 C002 Quantity 10 20 Customer name
- Page 1 of 10 -
b. Create an internal table to contain the following customer details and populate the internal table. Customer Num ber C001 C002 C003 Customer nam e JOHN MIKE ARNOLD City NEW YORK LONDON FLORIDA
c. Process the internal tables and get the following output from Purchase details table (only). 6001 6002 6003 C001 C002 C003 10 20 15 JOHN MIKE ARNOLD
3. Create an internal table to contain the following data and populate it:
Airline Carrier id AA DL AA UA LH LH
a. Display the following details from internal table. (Dont use WHERE clause) AA 0026 04.08.1999 b. Display all the Lufthansa flights information. c. Display all the flights information that are scheduled after 01.05.2000.
4. Create an internal table and populate the following data in it.
Airline Carrier id AA DL AA DL UA LH UA LH
Flight Connection id 0017 0009 0017 0009 1914 0941 1914 0941
Seats Occupied 200 100 200 100 300 195 300 195
Max Seats 200 150 200 150 300 200 300 200
- Page 2 of 10 -
a. Filter the contents to get the following output. (without using the where clause in the LOOP AT statement). DL 0009 100 150 DL 0009 100 150 UA 1914 300 300 UA 1914 300 300 b. Process the internal table to get the following output. AA 0017 200 200 DL 0009 100 150 LH 0941 195 200 UA 1914 300 300
5.
a.
Create an internal table to contain the following data and populate it. Employee number E001 E002 E003 E001 E002 E003 Employee name MADHAVI SEEMA GEETA MADHAVI PRANATHI GEETA Salary 5000 2000 3000 2500 2000 6000
b.
Display the contents of this internal table. c. Modify the contents of the internal table such that it contains only one record per employee number and display the contents of the internal table. (Numeric values need not be summed up).
6.
a.
Create a nested internal table to contain the following data and populate it. Student Id 001 Student Name RAVI Subject HINDI ENGLISH MATHEMATICS PHYSICS CHEMISTRY HINDI ENGLISH MATHEMATICS PHYSICS CHEMISTRY HINDI ENGLISH MATHEMATICS PHYSICS CHEMISTRY Marks 55 65 80 60 72 30 39 67 35 56 78 84 99 89 90
002
RADHA
003
RAMA
- Page 3 of 10 -
b. Get the output in the following format: if a student gets less than 40 marks in any subject indicate it.
7.
a.
Create an internal table to hold the following data. Airline Flight carrier ID connection ID LH 400 LH 400 LH 400 LH 400 Flight date Plane type 02/28/1995 02/28/1996 02/28/2001 12/01/2001 A319 A319 A319 A319 Maximum capacity 350 350 350 150 Seats occupied 100 100 100 100
b.
Display the contents of the internal table in the following tabular format.
- Page 4 of 10 -
8.
a. Create a field string of the following structure: Customer number Customer name C001 JOHN C002 MIKE C003 ARNOLD C004 ADAM C005 TOM C006 PATRICK C007 ROBERT
b. Create an internal table using this structure and populate it with the above data. c. Display the contents of the internal table as follows: C007 ROBERT 12,000 C001 JOHN 5,000 C006 PATRICK 6,000 C002 MIKE 2,000 C005 TOM 2,000 C003 ARNOLD 3,000 C004 ADAM 1,000 d. Delete all customers whose amount is greater than 3000 and output the contents of the internal table.
9. Create an internal table to hold the following data. Ensure that there is no include
statement or occurs clause in the program. Display the contents of the internal table. Name of the Programmer Date of birth ALTAF 07/02/1961 ANAND 04/12/1966 JULIANA 01/31/1968 KAMALA 10/30/1968 MARY 06/24/1970 Proficiency CLIPPER PASCAL COBOL C CPP
- Page 5 of 10 -
Proficiency COBOL
EmpNo 100 101 102 103 104 105 106 107 108 109 110 a.
Ename Soha Sona Soma Somi Sana Sama Sima Simi Suma Somu Soni
Department AA CC BB BB BB CC AA BB CC BB AA
Without sorting the above internal table display the employees who belong to the same department together.
11. With out using the COLLECT statement display the output specified in question
#2.
12. Create two internal tables with the same structure and populate them with the
following data. Contents of the first internal table: Airline carrier id Flight con nec tion id 0017 0021 1984 0941 1699
AA AI DL UA LH
Contents of the second internal table: Airline carrier id Flight con nec tion id 0017 1984
- Page 6 of 10 -
AA DL
Store all the records that are present in only one of the above internal tables, in another internal table, as follows: Airline carrier id Flight con nec tion id 0021 0941 0263 A2 A4 B3 Table row
AI UA LI
For the table row column, using A for the first table and B for the second table, concatenate it with the row number of the record in the corresponding internal table.
- Page 7 of 10 -
13. Create two internal tables with the following structures and populate them as
follows: Cust Id Name 1001 Rajesh 1002 Dravid 1003 Sachin Cust Id 1001 1001 1001 1001 1001 1001 1001 1002 1002 1003 1003 1003 1003 Item P0001 P0002 P0003 P0004 P0005 P0006 P0007 P0001 P0002 P0001 P0002 P0003 P0004
Hno 12 103 99
State AP AP AP
Customer
1001
Address
Rajesh 12 Wellington Road Hyd A.P 500033
Items
P0001 P0002 P0003 P0004 P0005 P0006 P0007 P0001 P0002 P0001 P0002 P0003 P0004
1002
Dravid 103 Arlington Road AP 500026 Sachin 9 Gandhi Marg Secd AP - 500021
1003
- Page 8 of 10 -
Dept No 10 20 20 10 20 10 10
Output the contents of the internal table in the following format: Dept No Emp name 10 Rama Reshma Raksha Rani Clerk Manager Accountant Clerk 3000 35000 5000 3000 Designation Salary
Total number of Employees in department 10: 4 20 Reema Roma Ria Manager Accountant Clerk 25000 4000 2000
- Page 9 of 10 -
Output the contents of the internal table in the following format: Material Purchase order PO Date Quantity Unit
MAT_001 6001 6004 6002 Total quantity ordered MAT_002 6006 6008 Total quantity ordered MAT_003 6003 6005 6007 Total quantity ordered 01.19.2002 05.08.2002 02.24.2002 20 6 10 20 16 EA CA CA EA CA 01.30.2002 02.24.2002 40 5 45 EA EA EA 04.03.2002 05.10.2002 01.19.2002 10 15 5 25 5 EA EA CA EA CA
********************The End*********************
- Page 10 of 10 -