ABAP Basics - Modularization
ABAP Basics - Modularization
Exercise on Subroutines:
1) Write a subroutine to print the user name, run date, and run time and invoke the subroutine. 2) Write a program to accept two numbers and an arithmetic operator. Perform the specified arithmetic operation on the number inputs, in a subroutine by passing the accepted inputs by value. Print the numbers, the operator and the result in the main program. If the accepted values are invalid, display that information on the list. (Use another subroutine to validate the inputs). 3) Accept a number N from the user and print the first N numbers of the fibonacci series using a subroutine. Implement this using recursion technique. 4) Do the necessary modularization for the following requirement: Create internal tables to populate the following data: Contents of the first internal table. Plant 0100 0110 0200 Description YASH plant1 YASH plant2 Test plant
Contents of the second internal table. Material MAT001 MAT002 MAT001 MAT001 MAT002 MAT003 MAT002 MAT001 MAT002 Material type Raw material Trading goods Raw material Raw material Trading goods Finished goods Trading goods Raw material Trading goods Plant 0100 0300 0110 0400 0110 0100 0100 0100 0110 Quantity in CA 20 10 15 10 5 12 5 10 6
Display the contents of the second internal table, only when there are corresponding entries in the first internal table.
Plant: 0110 YASH plant2 Material Material type Quantity MAT001 Raw material 15 MAT002 Trading goods 11 Total Qty for plant 0110 Gross total quantity 26 73
5) Write two include programs to perform the following: a) Create an internal table with the structure as specified below: Field Name Data Type Length Airline_Carrier_id C 2 Flight_Connection_id N 4 Flight_Date D b) Write a subroutine to populate the internal table with the data as specified below: Airline Carrier id AA DL AA UA LH Flight Connection id 0017 1984 0026 0941 1699 Flight Date 12.12.1999 06.05.2000 04.08.1999 11.11.2000 01.02.2000
6) Create a program to output the contents of the internal table created in the previous question as specified below. Print user details like the user name, run date and run time using the subroutine, which is created in question 1. <User details should be displayed here> Flight Connection Details Airline Carrier id AA AA DL LH Flight Connection id 0017 0026 1984 1699 Flight Date 12.12.1999 04.08.1999 06.05.2000 01.02.2000
11) Write a program to populate an internal table with the following data: Name Employee1 Employee2 Employee3 Age 30 10 25 Over time in Hours 7 3 15
Use a function module to calculate the amount considering the pay per hour as 150/-, by accepting the Age and over time. Handle the following exceptions in the function module: a. If employee age is less than 18 Child labor b. If the employee works for more than 10 hours as over-time Over strain Display the contents of the internal table as follows: Name Employee1 Employee2 Employee3 Employee4 Employee5 Employee6 Employee7 Employee8 Age 30 10 25 45 15 32 25 32 Over time 7 3 15 10 4 7 16 5 Amount 1050 1500 Child labor 1200 Over strain 750 Comments Child labor Over strain