Exercise (Chapter 2):
REMEMBER! Whenever you see `XX' used in your exercises (usually for naming conventions), it is a substitute for the last two digits of your logon id. For example, if you are ABAP50 and you are asked to name something YXXB, the name you should give to the object will be Y50B.
The following exercises are designed to help introduce you to ABAP.
The solutions for the programs can be found in development class “YINTRODUCTION”.
Before you begin the Introduction to ABAP exercises, you must create a new Development Class and a new Change Request, so your work is stored as it might be on a client project. To do this, find the sheet used for your first Development Class and Change Request Exercise and use this if you need it to help you through the abbreviated instructions below:
Create a new Development Class, by going to the Object Navigator (transaction SE80), and pressing the “Other Object” button. The object selection screen will appear (see screen shot below). Choose the “Other” tab, and type YXXB in the in the Development Class field (where XX is the last two digits of your logon id).
Click on the “Create” pushbutton, and name the new Development Class, calling it something like `Intro to ABAP Development Class for <your name>'.
NOTE: When you hit the save button, do not use your previous Change Request. Instead, when the Change Request Query Screen appears, click on the Create Request pushbutton, enter a short description, such as `Introduction to ABAP Change Request for <your name>', and save.
Write down the number of your change request here: ____________________________
Use the green arrow to go back to your new Development Class, and ensure that all your programs in the Introduction to ABAP section of the course are stored in this Development Class.
IMPORTANT NOTE: The following exercises will at first use the YCONCERT and YMOVIE tables. These are not SAP standard tables, as you can tell by their names, which begin with a `Y'. The ABAP team created these tables for exercise purposes. These tables are not representative of the tables you will come across when doing development work. Usually, you will have to research tables to find out about the information they contain. You can do this by going into the ABAP Dictionary and displaying the table of interest. (Or use transaction SE11). Then go to Utilities Table Contents Display, and hit Execute (F8). The later exercises will use SAP standard tables, so try doing this research with some of those tables.
Exercise (Chapters 1-2):
In this exercise, you will research the ABAP Workbench in order to familiarize yourself with it.
Objectives
After completing this exercise, you will be able to:
Navigate through the ABAP Workbench
Estimated time to complete this exercise: 60 minutes
Exercises
The following exercise provides practice working with the concepts learned in Chapters 1 and 2.
Exercise 1: Introduction
List five components of the Workbench NOT mentioned in Chapter 1.
Exercise 2
What is the type of program consisting of a collection of one or more screens?
What kind of programs creates lists? Name the two types of that kind of programs and describe the differences between them.
Exercise 3
This exercise is to help you practice some of the tools mentioned in Chapter 2. Please refer to Program YIN001 in Development Class YINTRODUCTION.
Navigation
Please keep in mind that you'll find many different ways of accomplishing the same task in the system. These exercises will enumerate but a few. Please do not assume that the methods listed in these exercises are comprehensive. To get to the program, go into the ABAP Editor. Two ways that you could do this are:
From the SAP Easy Access Screen, go to Tools ABAP Workbench Overview Object Navigator, then type in the Development Class and press Enter. Expand the program list, double-click on the program name, and in the next screen, double-click on the folder with the program name.
In the command field, call transaction SE38 (ABAP Editor), type in the name of the program, and choose Display
You should now be in display mode of the ABAP Editor. The Display<>Change button
is used to switch between display and edit mode, but you should not be able to edit this program since it was created on another system.
Copying programs
Notice the structure of the program, the Program Name Area, then the Declarations section, followed by the statement section. Notice the syntax: a keyword followed by a parameter, field or constant, with colons used if the statement is chained. Also, look at the program attributes screen by using Goto Attributes and compare this information with the notes in your manuals.
After you've looked through the program, hit the green arrow back
(the same as the function key F3), in order to get back to the ABAP Editor. (Look at the titlebar for information as to where you are in SAP). If you used the Object Navigator to view the program, you'll need to use transaction SE38, to copy it. Make sure the program name YIN001 is in the Program Name field before you copy it.
Hit the copy pushbutton on the application toolbar and name the TARGET PROGRAM YIN001_XX where XX are the last digits of your logon id. Then hit the copy pushbutton. You will be prompted with checkboxes asking you if want to copy the source program's documentation, variants, gui status, screens and includes to the target program. Go ahead and check all of them and then hit the copy pushbutton once again.
You will now be asked in which development class you'd like to put the target program. Enter your development class for these exercises (YXXB). Then hit the save pushbutton. You will now be prompted for a change request number. Make sure it is the change request you created for this development class. If not, and you've already created a change request for this development class, hit the Own Requests pushbutton to retrieve that change request. If you have not yet created a change request for this development class you may do so now by hitting Create Request and then following the directions on page 1 of this section. N.B. Logically, development classes and change requests should have a one to one relationship, though this is not mandatory. This is done for Correction and Transport reasons. Change Requests and development classes will be discussed further in the System Architecture section of the course.
Playing in the Editor
Hit the Change/Display pushbutton so that you may edit the code. (The screen in the editor will change from gray to white). You can select multiple lines of code by clicking and dragging your mouse over them. You can comment out lines of code after selecting them by using the Utilities Block/Buffer Insert Comment menu path.
Comment out by using * symbol:
Comment lines at the top of the program,
Report statement on line 17,
Declaration Section on line 21,
Statement Section on line 28.
2. Now comment out by using the “ symbol:
Report name. Automatically created. on line 19,
Table work area declaration on line 23,
Data Declarations on line 25, and
At any point in your exercises, you may want to hit the undo pushbutton.
Perform a syntax check by:
hitting the check pushbutton or,
going to Program Check Syntax.
Notice that this is also the menu path where you will find the extended program check and where you can display warnings if you've received a message “No syntax errors, but some warnings exist.”
Save the program by:
hitting the save pushbutton on the toolbar or
using the menu path Program Save
Activate the program by:
hitting activate pushbutton on the toolbar or
using the menu path Program Activate
Execute the program to see what the output looks like. Do this by:
hitting the F8 function key or,
using the menu path Program Test or
by pressing the test button
Notice that the column headings are off. Fix this from the Object Navigator window (transaction SE80) by using the menu path Goto Text Elements List Headings. You must space the headings appropriately across the page using the space bar and trial and error. Refer to Program YIN001_ANSWER for the solution.
The list produced should look like this:
Introduction to ABAP ABAP Exercises
Exercise
Chapter 2