# Intro to ABAP - Chapter 04Exercise by Guihong

VIEWS: 0 PAGES: 4

• pg 1
```									Introduction to ABAP        ABAP Exercises

Exercise
Chapter 4
Introduction to ABAP                                                  ABAP Exercises

Exercise (Chapter 4):
In this exercise, you will write a simple program to test your understanding of data
declarations, parameters, selection texts and default values.

Objectives
After completing this exercise, you will be able to:
 Understand different data types and declarations and using selection texts

Estimated time to complete this exercise: 60 minutes

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

Exercise 1:
Name your program YIN003_XX. Create the following output. You should get the user’s
name and birthday with a parameters statement. Use selection texts to make the
parameters more user-friendly. Put your own name and birthday as the defaults. Your
program should then calculate how many days old the user is, based on the date entered.
We will not worry about error-handling in this program, so don’t worry about whether or
not the user enters an invalid date. SY-DATUM will come in very handy for this
program. Try declaring your birthday parameter as TYPE D, and also LIKE SY-
DATUM, and see the difference in functionality of your program. Refer to Program
YIN003 in Development Class YINTRODUCTION for the solution.
Introduction to ABAP                                              ABAP Exercises

Exercise 2
Name your program YIN004_XX. Write a program that asks the user for 10
numbers, all integers and then adds them up and displays the totals. You should
set default values. Refer to Program YIN004 in YINTRODUCTION for the
solution.
Introduction to ABAP                                              ABAP Exercises

Once that program works properly, change it so that you use type p variables with
two decimals shown, and alternately multiply and divide the numbers the user has
entered by each other. Make sure not to put 0 (zero) as one of the numbers by
which you divide or your program will short dump. You can find the solutions for
this part of the exercise at the bottom of program YIN004 in the development
class YINTRODUCTION.

```
To top