SAP ABAP Eclipse

profileTriple_R18
hw8.docx

CALIFORNIA STATE UNIVERSITY, LONG BEACH

IS 482 – Enterprise Systems

Spring 2019 Term – Session 01 (#10625) – Individual Assignment 8

DUE: Not Collected

Tutorial 6 – ABAP4 Subroutines

Exercises

1. Recall Z_###_STUDENTLEVEL that you created in a previous assignment:

User inputs how many units they have earned.

The program outputs their student level as follows: 0 – 30 units earned – Freshman

31 – 60 units earned – Sophomore

61 – 90 unites earned – Junior

> 90 – Senior

If a negative number is entered, the program writes: Invalid input. Units earned must be a positive number.

Create a revised version that uses a subroutine: Z_###_STUDENTLEVEL_SUB

Your main program will call a subroutine that performs the following:

Input: Number of Units Output: Student Level.

2. Create a program to print the first fifty prime numbers: Z_###_PRIMENUMBERS.

Your main program is to loop until you get 50 prime numbers. The main program will call a subroutine that performs the following:

Input: A number

Output: A single character

‘Y’ - Yes, the number is prime

‘N’ – No, the number is not prime.

Output 10 prime numbers per line. A single space between prime numbers. See below output:

3. Note: If you performed the database exercises. Revise your Add Item program as follows (call it: Z_###_ADDITEM_SUB).

Add a subroutine ValidateProduct that performs the following:

Input: Product ID

Output: A single character

‘Y’ – If the product exists

‘N’ – If the product does not exist.

If ‘N’ is returned, print the error message.

If ‘Y’ is returned, proceed with the rest of the operation.

A. Asher IS82 S01 – Spring 2019