# Intro to ABAP - Chapter 09Exercise by Guihong

VIEWS: 7 PAGES: 3

• pg 1
```									Introduction to ABAP        ABAP Exercises

Exercise
Chapter 9
Introduction to ABAP                                                      ABAP Exercises

Exercise (Chapter 9):
In this exercise, you will write programs to help you to understand subroutines and
function modules and see their similarities and differences.

Objectives
After completing this exercise, you will be able to:
 Understand how subroutines and function modules work

Estimated time to complete this exercise: 60 minutes

Exercises
The following exercise provides practice working with the concepts learned in Chapter 9.

Exercise 1:
In exercise YIN012_XX you will write a program using subroutines. Using table
YCONCERT, you will use one subroutine to write out the header information, another
subroutine to select the necessary records based on the value for yconcert-artist entered
by the user, and a third subroutine to calculate the total sales for a concert. The total sale
is based on an attendance number (seats occupied) and a ticket price. The output should
look similar to the following:
Introduction to ABAP                                                    ABAP Exercises

Exercise 2:
Copy your last program as YIN013_XX. Before creating a function module, you must
create a function group called “YCONC_SALES_FG_XX”. Code the program to use
your own function module, “Y_CONC_SALES_xx”. Remember to use the PATTERN
pushbutton to insert a function module. You should never manually code the
parameters of a function module.

The function module you create should calculate the total sales for a concert. This total
sales is based on an attendance number (seats occupied) and a ticket price. Before
calculating the total sales, this function module should check to see that the concert has
already taken place (i.e., the concert date is before the current date). If not, an exception
should be raised. This function module should be used in your code instead of the
subroutine in the previous exercise which calculates the total sales. Refer to Program
YIN013 and function group YCONC_SALES_FG for the solution.

The output is identical to the previous exercise except that there should be error-handling
involved to prevent the output of a record with an invalid year.

```
To top