# Intro to ABAP - Chapter 13Exercise by Guihong

VIEWS: 11 PAGES: 5

• pg 1
```									Introduction to ABAP   ABAP Exercises

Exercise
Chapter 13
Introduction to ABAP                                                   ABAP Exercises

Exercise (Chapter 13):
In this exercise, you will write a program to help you to understand the different events in
ABAP.

Objectives
After completing this exercise, you will be able to:
 Code the following four events:
 INITIALIZATION
 AT SELECTION-SCREEN
 START-0F-SELECTION
 END-OF-SELECTION

Estimated time to complete this exercise: 30 minutes

Exercises
This exercise provides practice working with the concepts learned in Chapter 13.

Exercise 1

STEP 1: In this program, you will create a selection screen by declaring a parameter of
type C length 3 just like the SFLIGHT-CARRID in the data dictionary (you should
always declare parameters to begin with a P_ ).

Remember to use a TABLES statement to declare a work area for the table SFLIGHT.

STEP 2: Code the INITIALIZATION event. Inside this event, default the value LH to
the parameter you declared above.

STEP 3: Code the AT SELECTION-SCREEN event. Inside this event check the value
of your parameter. If your parameter is equal to a value of LH, issue an information
message (see solution YINO09 if you don’t know how to do this yet) that tells the user to
enter a value of SQ next time they run the program.
Introduction to ABAP                                                  ABAP Exercises

This is what your selection screen should look like:

STEP 4: Code the START-OF-SELECTION event. Inside this event select the field
CONNID from SFLIGHT only if the value of your parameter is not equal to LH, else you

STEP 5: Code the END-OF-SELECTION event. Inside this event you should check to
see if SFLIGHT-CONNID (from your work area) has a value, if not then you should
write a message to the basic list saying that you skipped the START-OF-SELECTION
event and that the user should have changed the parameter value from LH to SQ. If
SFLIGHT-CONNID does have a value, you should write a message to the basic list
saying that the user has successfully executed all four events. INITIALIZATION, AT
SELECTION-SCREEN, START-OF-SELECTION and END-OF-SELECTION.

Note: Don’t forget to use the menu path GOTO->Text Elements->Selection Texts to give
your selection screen parameter a more user friendly appearance.

Also, only two valid values exist for the SFLIGHT-CARRID field, LH and SQ. This is a
simple example to show you when ABAP events occur, so you should focus on the
events - when and why they occur!

This is what your information message and basic list should look like if the user skips the
START-OF-SELECTION event:
Introduction to ABAP                                                   ABAP Exercises

Information Message

Basic List

This is what the basic list should look like if the user changes the parameter value to SQ
and then executes the program:
Introduction to ABAP   ABAP Exercises

Basic List

```
To top