ABAP Programming Projects Project Management and Documentation General All project files should be saved on a regular basis in your project folder on the network. Normally you should have a project folder for the course with subfolders for each project. Use the download utility in ABAP workbench to download your work from SAP. All programs should have a program header similar to the following. *------------------------------------------------------------------------------------------------* *Project XX – Airplane Data *Programmer: Your Name *Date: 09/15/2003 *Program: Zfmln_L1A_hello_world *Description: This program generates a list of the data that is in the table SPFLI *------------------------------------------------------------------------------------------------* Note that all program names start with a Z. The next 3-4 characters are your initials/dana account. Next is the Project ID. Last is some name that identifies the program function. *-----------------------------------------------------------------------------------------------* * Document major sections of your program with blocks similar to this * You can use dash, solid or other types of lines to form the block *-----------------------------------------------------------------------------------------------* * You can use single comment lines like this and inline comments using “ * to document a statement or groups of statements. Submitting projects Submit a copy of the source code and examples of executions. Examples of executions should demonstrate testing of more than one scenario. Test both friendly and unfriendly use to the extent that you program for unfriendly scenarios. Network Drive Set up a folder for this course on your network drive. The folder name should have the course number in it. Save your source to this folder as backup. ABAP Projects Project - L1A Hello World Project Objectives: Become familiar with ABAP workbench, SAP Environment, and the mechanics of building and testing a program. Project Requirements: 1) Enter the Hello World program from Keller p26 2) Test and show the result. Project - L1B Airline Database Project Objectives: Become familiar with the tables, data, and table relationships used in the airline database. Project Requirements: 1) Capture a graphic that contains the ER diagram for most of the entities in the airline database 2) Capture data element definitions for sflight, spfli and sbook. 3) Write a list program to obtain a listing of sflight. Download this list to a spreadsheet. 4) Write a list program to obtain a listing of spfli. Download this list to a spreadsheet. 5) Write a list program to obtain a listing of sbook. Optional - Download this list to a spreadsheet. This file is rather large. 6) Look at the content of sbook using the list in the data dictionary. Capture a screen showing the initial rows. Notes: 1) Use Data Modeler on Tools – Workbench – Development. Look up models starting with BC. Put in BC* and use the drop down to get a list. 2) Use BC_Travel and graphic ICON to view the entire model. 3) Use data dictionary in SE80 or SE85 to look at specific tables, structure and content. Note the icons for graphic, list and definition. 4) Use /n to get back to initial menu or /nse85 to go direct to SE85 Project – L2A Basics A Project Objectives: Practice basic ABAP statements Project Requirements: 1) Accept two decimal (8.2) amounts and two integer amount from the screen. 2) Accept two character fields (15) from the screen 3) Accept a date from the screen 4) Add, subtract, multiply and divide some combination of numbers. 5) Display the results 6) Compare two numbers, display messages on >, = , and < 7) Set up a Do loop to add numbers from 1 to one of the integer inputs. 8) Display the amount 9) Obtain the starting position of where one string starts in another string. 10) Concatenate two strings and display 11) Determine how old you are by using the input date and today’s date 12) Display in years (decimal) and in days Project – L2B Basics B Project Objectives: Practice basic ABAP statements and the CASE statement Project Requirements: 1) Create a calculator program. 2) The program accepts two numbers(8.2) and an operator that is +, -, *, /, ^ 3) Display the inputs and the result. 4) Test for input errors and display an appropriate message. 5) Use a CASE statement on the operator. 6) Check what happens on large exponential results. 7) Divide by zero? Project L3A – Overview List Program using ALV (List Viewer) Project Objective: Obtain an overview of the ABAP programming environment using screens, list and objects. Project Requirements: 1) Study, enter and run the program starting on page 31 of Keller. 2) Obtain source listing, screen shots and output Notes: 1) This project is a little advanced, but it will give you some perspective of some of the overall framework of ABAP programming. Project – L3B Processing Blocks Project Objectives: Become familiar with ABAP program structure and processing blocks. Project Requirements: 1) Write the program on p67 of the Keller book. 2) Show an example of dead code 3) Capture an example of the processing blocks. 4) What are the event blocks? Project L4A – Simple lists A. Project Objectives: This project will give you some background on using a logical database in SAP, programming SQL queries, database loop processing, and simple selections screens. Project Requirements: 1) Enter the Airline (carrid) and flight connection JFK to SFO on a selection screen. 2) Use the LDB F1S on the program attributes window. 3) Select selection screen values using the drop downs on the selection screen. 4) List the bookings for that flight (use table sbook) Booking data can include bookid, customid and loccuram. Flight data can include carrid, connid and fldate. 5) Process bookings within sflight. 6) Do the project two ways (Using the LDB and using a SQL statement). Project L4B – Simple lists B. Project Objectives: This project will give you some background on processing multiple DB tables using SQL. Project Requirements: 1) Enter the Airline (carrid) on the selection screen. 2) Enter a date range on the selection screen – See data for date ranges 3) Process the bookings (sbook) for that carrid by flight number and date (sflight). (2 select loops) 4) Do not display detail sbook rows. 5) Sum and display the total amount of revenue and number of bookings by flight 6) Display using some color. 7) Display headings. Sample Solution: See solution for L4C. Project L4C – Lists C using a table. Project Objectives: This project will give you some perspective of processing multiple DB Tables using a Join with an internal table. Project Requirements: 1) Similar to L4B except you use a SQL Join to load an internal table 2) Enter the Airline (carrid) and flight date range on the selection screen. 3) List the bookings for that carrid by flight number (connid) by processing the internal table. 4) Add and display the total amount of revenue and number of bookings by flight 5) Loop processing on table 6) Use ON change of on keys carrid, connid and fldate 7) Save keys in work area to print the correct keys being processed when there is a change. This is a little tricky. Don’t print first change (count = zero). Print last set when the loop is complete. Printing is on a delay. 8) Display lines using some color. Sample Solution Project L4D – Lists D. Project Objectives: This project will give you some perspective of processing multiple DB Tables producing a list using some control break features. Project Requirements: 1) Enter the Airline (carrid) and date range on the selection screen. 2) List the bookings for that carrid by flight number. 3) Add and display the total amount of revenue and bookings by flight 4) Display lines using some color. 5) You choose your SQL approach. 6) Use the TOP OF PAGE and AT NEW events for control break processing. 7) Use option buttons on selection screen for select Detail or Summary reporting 8) Detail lists the detail lines and summary, Summary lists only the totals by flight. Project L4E – Lists E. Project Objectives: This project gives you some perspective on programming interactive lists (Lists with drill down capability). Project Requirements: 1) No Selection Screen. 2) List all the airlines (scar). 3) Write lines with hotspot. 4) On selection of an airline, display the flights (sflight). a. city from, city to, date, seats max, seats occ, payment sum 5) On selection of a flight, display summary of bookings a. Number and total of local currency amount. 6) Use HIDE to save keys necessary for the next SQL Project L5A – Basic Tables A. Project Objectives: This project covers introductory use of internal tables. Project Requirements: 1) Load a table with flight data (spfli). 2) Load a table with carrier data (scar). 3) Loop through the flight data table 4) For each flight in the flight data table. a. Read the carrier data for the carrid on that flight. b. Print carrid, carrier name, distance, city from and cityto c. Program an option to use a DB select instead of a Read. Project L5B – Basic Tables B. Project Objectives: This project introduces the concept of constructing and using internal tables. Project Requirements: 1. Load a table with carrier data (scarr) 2. Loop through the carrier data table 3. Print carrier data with headings and a uline separating carrid groups. 4. For each carrier in the carrier table: d. Load data pertaining to that carrier from the spfli DB table into an internal table. e. Loop thru this internal table printing connid, cityfrom and cityto Project L6A – More Tables A. Project Objectives: This project covers the use of internal tables. Project Requirements: 5) Load a table with flight data (sflight) 6) Loop through the flight data table 7) For each flight in the flight data table, select a summary from the flight booking DB table using an aggregate select. 8) Display the summary data by flight. a. city from, city to , flight date, seats available, number of bookings, total amount. Project L6B – More Tables B. Project Objectives: This project produces the same solution as L6A through different approach of using another internal table instead of an aggregate select. Project Requirements: 1) Load a table with flight data (sflight) 2) Load a table with booking data (sbook). 3) Sort the booking data table 4) Loop through the flight data table 5) For each flight in the flight data table, read the first booking using a key. 6) Process the remaining booking records for that key adding up the number and the total amount. 7) Display the summary data by flight. a. city from, city to , flight date, seats available, number of bookings, total amount. Notes: 1) Set up one version using a standard table for booking data 2) Set up a second version using a sorted table for booking data Project L8 – Functions and Sub Routines Program Objectives: The purpose of this project is to give you some experience with setting up program flow through the use of internal and external sub routines (functions). Project Requirements: 1) Write an include program that defines a data structure based on spfli. a. carrid, conid, cityfrom, cityto, deptime, arrtime, fltime, distance, avgspeed 2) Write a function using the function builder to return the speed per hour using distance and flight time. 3) Write a program that uses the function and the include and prints the data from the table. 4) Set up the print routine in the program as an internal subroutine that you perform. Project L9A – Create Database Table Program Objectives: The purpose of this project is to give you some experience with setting up a database table in SAP. Project Requirements: 1) Create a database table including related domains data elements and fields for airplane data. 2) Airplane data consists of planeID(3) , planetype(3) , first class (int), coach rows (int), coach seats per row (int), Gate size(3). Gate size is Sm, Med, Lg. Planetype is JET or TBO. Project L9B – Populate Database Table Program Objectives: The purpose of this project is to give you some experience with setting up an interface to upload data to the database table you created. Project Requirements: 1) Use Gui_upload function module to upload a file of data to the database table. 2) Use the open_file_dialog method in the cl_gui_frontend_services class to pop up a file selection window on the value request help event for the file name field on the selection screen. Project L9C – Database Table Interactive Update Program Objectives: The purpose of this project is to give you some experience with interactive data maintenance on a database table. Project Requirements: 1) Set up a screen with option buttons for add, query, modify, delete. Add fields for all the fields in the database table. 2) Write a program to add, query, modify and delete data in the database table. Project L9D – Upload Excel Data to SAP Program Objectives: The purpose of this project is to give you some experience in uploading data to SAP from an Excel spreadsheet using a function module. Project Requirements: 1) Write a program to upload data from Excel using function module ALSM_EXCEL_TO_INTERNAL_TABLE and the spreadsheet downloaded from sflight. 2) Create an internal table and load the data from the upload into the internal table by row. 3) Print the internal table. Project L10A – Create an Airplane Class Program Objectives: The purpose of this project is to give you some experience in building a class using ABAP objects. Project Requirements: 1) Create an airplane class with the attributes airplane ID, airplane type and gate size. Define methods constructor and display airplane. The constructor method increments the static variable no_of_airplanes and loads the instance attributes with values. 2) Create a database class with the attributes airplane ID, airplane type, gate size, first class seats, coach rows and coach seats and the method get airplane. 3) Create a test program with a selection screen that accepts an airplane ID. 4) Create an instance of the database class. 5) Create an instance of the airplane class using the get airplane method based on the airplane ID. Project L10B – Create an Airplane Sub Classes Program Objectives: The purpose of this project is to give you some experience in building sub classes using ABAP objects. The sub classes will demonstrate inheritance and polymorphism. Project Requirements: 1) Create a Turbo subclass that inherits from the airplane class. 2) The Turbo subclass has one attribute passenger capacity. 3) The Turbo subclass has a constructor method and a display capacity method. 4) The constructor method uses the super constructor in airplane and loads the turbo instance attributes. 5) Create a Jet subclass that inherits from the airplane class. 6) The Jet subclass has the attributes first class seats, coach rows and coach seats. 7) The Jet subclass has a constructor method and a display capacity method. Capacity for the jet is first class + ( coach rows * coach seats ). 8) The constructor method uses the super constructor in airplane and loads the Jet instance attributes.