Intro to«AP ChapterExercise


0x08 graphic
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:

Estimated time to complete this exercise: 30 minutes

Exercises

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

Exercise 1

Name your program YIN019_XX.

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.

This is what your selection screen should look like:

0x01 graphic

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 should finish this event and jump to your END-OF-SELECTION event.

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:

Information Message

0x01 graphic

Basic List

0x01 graphic

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

Basic List

0x01 graphic

0x01 graphic

Introduction to ABAP ABAP Exercises

Exercise

Chapter 13



Wyszukiwarka

Podobne podstrony:
Intro to?AP ChapterExercise
Intro to?AP ChapterExercise
Intro to?AP ChapterExercise
Intro to?AP ChapterExercise
Intro to ABAP Chapter 13
Intro to ABAP Chapter 07
Intro to ABAP Chapter 12
Intro to ABAP Chapter 15

więcej podobnych podstron