Course Number: ABAP/4 Dialog Program
Exercises for Unit 1: Review Dialog Programming SUBJECT \* MERGEFORMAT SUBJECT \* MERGEFORMAT
Unit 1 Review Dialog Programming
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##1
Transaction code
Z##1
Screen 100
Key input
Screen 200
Fields of entry to be displayed
Note: ## Group number
1-1. Write a program that displays an entry in the database table SFLIGHT (see ZCA1).
a) Create a key input screen and include the elements in the following table:
100
Element
Input Data
(Key fields of the table SFLIGHT)
SFLIGHT-CARRID
SFLIGHT-CONNID
SFLIGHT-FLDATE
For each field:
Input / Output, Required
b) Read a single entry from the table SFLIGHT after the user has entered values on the key input screen ( 100 ).
c) Create a detail screen and include the elements in the following table:
200
Element
Input Data
Key fields of the table SFLIGHT
Output only
SFLIGHT-PRICE
Output
SFLIGHT-CURRENCY
Output
SFLIGHT-PLANETYPE
Output
SFLIGHT-SEATSMAX
Output
SFLIGHT-SEATSOCC
Output
SFLIGHT-PAYMENTSUM
Output
Unit 2 Additional Techniques in Screen Painter and Menu Painter
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##A
Transaction code
Z##A
Screen 100
Key input
Screen 200
Detail
Screen 300 ( Sub screen )
Fields of entry to be displayed
Note: ## Group number
2-1. Copy program SAPMZ##1 as a starting point and change the program to practice the different layout options available in Screen Painter. See transaction ZCB1.
a) Add the elements in the following table to the key input screen ( 100 ).
100
Element
Input Data
two check-boxes within a box
Input / Output
two radio-buttons within a box
Input / Output, Defined as one radio button group
two push-buttons
Function codes ‘ACT1’ and ‘ACT2’
b) Determine whether and which check-boxes have been selected, which radio button was chosen, and which push-button was pressed. Record the results using the text variables from the structure SB410FIELD.
c) Add a sub-screen area to screen 200.
200
Element
Input Data
SUB1
Sub-screen
d) Insert a call to sub-screen 300 in the flow logic of screen 200.
e) Create a sub-screen ( 300) and include the elements in the following table. Note: the values of these elements must be determined before entering screen 200.
300 (Sub-screen)
Element
Input Data
SB410FIELD-CHECK
Checkbox selection result
SB410FIELD-RADIO
Radio button selected
SB410FIELD-ACTION
Push button pressed
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##B
Transaction code
Z##B
Screen 100
Key input
Screen 200
Fields of entry to be changed
Screen 300 (Modal dialog box)
General flight data
Note: ## Group number
2-2. Write a program that changes an entry in the database table SFLIGHT. See transaction TCB2.
a) Create a key input screen and include the elements in the following table:
100
Element
Input Data
(Key fields of the table SFLIGHT)
SFLIGHT-CARRID
SFLIGHT-CONNID
SFLIGHT-FLDATE
For each field:
Input / Output, Required,
Enable SET/GET Parameter functionality
b) Read a single entry from table SFLIGHT for the entered key. If it does not exist, react with the error message 007 (message ID AT).
c) Define a status for screen 100 with the functions Change, Back, Cancel and Exit. The latter two are type E.
d) Implement the functions Back, Cancel and Exit in the flow logic. The latter two should be executable before the dialog processor performs automatic checking. Back and Cancel should have the same meaning here as Exit, in that it should end the program.
e) Implement the Change function in the flow logic. This should send the user to the detail screen ( 200 ). No other selection should branch the user to the detail screen.
f) Add the elements in the following table to the detail screen.
200
Element
Input Data
Key fields of the table SFLIGHT
Output only
SFLIGHT-PRICE
Input / Output , Required
SFLIGHT-CURRENCY
Output
SFLIGHT-PLANETYPE
Input / Output, Required
SFLIGHT-SEATSMAX
Output
SFLIGHT-SEATSOCC
Output
SFLIGHT-PAYMENTSUM
Output
g) If the plane type changes: Determine the maximum occupancy (SFLIGHT-SEATSMAX) from the table SAPLANE. If the number of seats already occupied is greater than the maximum occupancy, react with the warning message 109
h) If the price changes: Recalculate the total booking revenue (SFLIGHT-PAYMENTSUM).
i) Define a status with the functions Save, Back, Cancel, Exit, General flight data, and Flight times . Use the menu bar from the status of screen 100 ( Hint: link the menu bar ), and add the additional functions.
j) Implement the Display of flight times as a transaction call from the status. The function code should be Z##1, or ZCA1 (See exercise for Chapter 1), use function type T.
k) Implement the functions Back, Cancel and Exit in the flow logic. The latter two should be executable before the dialog processor performs automatic checking. Back and Cancel should return the user to the initial screen. Exit should end the transaction.
l) Implement the Save functionality in the flow logic. Use the UPDATE SFLIGHT command. If the update is successful, react with the success message 009 and branch to screen 100. If the update is unsuccessful, react with the abend message 008.
m) Implement the General flight data functionality in the flow logic. Call a modal dialog box ( 300 ) to present to the user.
n) Create a modal dialog box and include the elements in the following table:
300 ( Modal dialog box )
Element
Input Data
SPFLI-CITYFROM
Output only
SPFLI-CITYTO
Output only
SPFLI-DISTANCE
Output only
SPFLI-FLTIME
Output only
SPFLI-DEPTIME
Output only
SPFLI-ARRTIME
Output only
o) Read data from the table SPFLI using the key Carrier id and Connection id, before the modal dialog box is displayed to the user.
p) Define a status of type ‘Dialog Box’ with the function Continue.
q) Implement the function Continue in the flow logic. This should cancel the call screen sequence.
Unit 3 Asynchronous Update
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##C
Transaction code
Z##C
Screen 100
Key input
Screen 200
Fields of entry to be changed
Screen 300 ( Modal dialog box)
General flight data
Function module
Z_TRAIN410_##C
Function group
ZC##
Note: ## Group number
3-1. Copy your program for changing SFLIGHT entries ( SAPMZ##B ) or the solution program ( SAPMTCB2 ) and replace the synchronous update with an asynchronous update. See transaction TCC1.
a) Create an update function module which receives the SFLIGHT data structure and updates the SFLIGHT table.
b) Replace the current ‘Save’ functionality in the flow logic with a call to the update function module. React with the success message 009 and branch to screen 100.
Unit 4 SAP Locking Concept
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##D
Transaction code
Z##D
Screen 100
Key input
Screen 200
Detail fields for update
Screen 300 ( Modal dialog box)
General flight data
Lock object
EZ##FLT
Note: ## Group number
4-1. Copy your program for changing SFLIGHT entries ( SAPMZ##C ) or the solution program ( SAPMTCC1 ), and implement the SAP locking concept. See transaction TCD1.
Note: when the user is in the key input screen ( 100 ), no locks should exist.
a) Create a lock object, EZ##FLT, for the primary table SFLIGHT. Menu path: Tools->ABAP/4 Workbench -> Data Dictionary. Select the ‘lock-object’ radio-button and press create. Use SFLIGHT as the primary table and set the lock arguments and the lock mode. Save and activate your lock object.
b) Call the enqueue function module ENQUEUE_EZ##FLT to lock the key fields selected. If an entry is already locked, react with the error message 101. If the lock cannot be set due to a system error, use the error message 102.
c) Before returning to the key input screen ( 100 ), ensure that no lock remains by calling the dequeue function module DEQUEUE_EZ##FLT.
Hint: you may need to call the dequeue function module from more than just one place.
Unit 5 Dynamic Screen Modification
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##E
Transaction code
Z##E
Screen 100
Key input
Screen 200
Fields of entry to be changed
Screen 300 ( Modal dialog box)
General flight data
Note: ## Group number
5-1. Copy your program for changing SFLIGHT entries ( SAPMZ##D ) or a solution program ( SAPMTCD1 ). See transaction ZCE1.
a) Add a push button “Further-information” on the detail screen ( 200 )
b) Add a PBO module to implement dynamic screen modification in the flow logic of the detail screen ( 200 ).
c) When the detail screen is being sent for the first time, the information about the plane type (SFLIGHT-PLANETYPE; SFLIGHT-SEATSMAX) should not be displayed, but the pushbutton should be visible.
d) When the user presses the pushbutton “Further information”, the information about the plane type should be displayed, but not the pushbutton.
( Alternate - CHALLENGING)
Object
Name / Description
Program name
SAPMZ##E
Transaction code
Z##E
Screen 100
Key input
Screen 200
Fields of entry to be changed
Screen 300 (Modal dialog box )
General flight data
Note: ## Group number
5-2. Copy your program for changing SFLIGHT entries ( SAPMZ##D ) or a solution program ( SAPMTCD1 ) and allow the user to enter the detail screen ( 200 ) in either change mode or display mode. Allow the user the opportunity to toggle between change mode and display mode while in the detail screen ( 200 ). See transaction TCE1.
a) Add the function Display to the status for screen 100.
b) Implement the function Change in the flow logic. Lock the selected SFLIGHT entry using the SAP locking concept. In the event that the record can not be locked, switch the screen mode to display and inform the user.
c) Implement the function Display in the flow logic. No locks are required. All fields should be in display (output ) mode on the detail screen ( 200 ).
d) Add the function Toggle to the status for screen 200.
e) Implement the function Toggle in the flow logic. The screen should toggle modes from either change to display or display to change. Manage the appropriate lock entries using the SAP locking concept. The user may not toggle to change mode if a lock can not be placed.
Unit 6 Table Control
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##F
Transaction code
Z##F
Screen 100
Key input
Screen 200
Display flight times
Note: ## Group number
6-1. Write a program that displays flight times from table SFLIGHT for a particular flight connection, table SPFLI. Use a table control on the detail screen to list entries from the table SFLIGHT. See transaction TCF1.
a) Create a key input screen and include the elements in the following table:
100
Element
Input Data
SPFLI-CARRID
Input / Output, Required
SPFLI-CONNID
Input / Output, Required
b) Check for valid entry against the flight connection table (SPFLI). If an entry does not exist, react with the error message 107.
c) Define a status with the functions Display, Back, Cancel and Exit.
d) Implement the functions Back, Cancel and Exit in the flow logic. The latter two should be executable before the dialog processor performs automatic checking. Back and Cancel should have the same meaning here as Exit, in that it should end the program.
e) Implement the function Display in the flow logic. Read the relevant entries from the flight time table (SFLIGHT) for the entered key and store them in an internal table (SFLIGHT_TAB).
f) Create a detail screen and include the elements in the following table:
200
Element
Input Data
SPFLI-CARRID
Outside the table control, Output only
SPFLI-CONNID
Outside the table control, Output only
SFLIGHT_TC ( Table Control )
Contains fields from SFLIGHT
g) Define the table control with the following attributes:
TC Attributes
Setting
Vertical and Horizontal re-sizing
On
Vertical and Horizontal grid
On
Column Selection
Single
Line Selection
Single
Line Selection Field Name
FLAG
h) The names of the fields in the table control should be brought in from the data dictionary table SFLIGHT.
i) Move the entries in the table used to "buffer" the SFLIGHT entries, . SFLIGHT_TAB-FLDATE, into the associated table control fields, . SFLIGHT-FLDATE.
j) Define a status with the functions Sort, Back, Cancel and Exit.
k) Implement the functions Back, Cancel and Exit in the flow logic. The latter two should be executable before the dialog processor performs automatic checking. Back and Cancel should return the user to the initial screen. Exit should end the transaction.
l) Implement the function Sort in the flow logic. Identify the column selected by the user and sort the internal table using the identified column.
Unit 7 Linking Program Components
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##G
Transaction code
Z##G
Screen 100
Key input
Screen 200
Display flight times
Screen 300 ( Modal dialog box )
Display booking list
Note: ## Group number
7-1. Copy your program ( SAPMZ##F ) or the solution ( SAPMTCF1 ) and extend it to use the functions discussed in this Unit. See transaction TCG1.
a) Modify the status for screen 200 and add the following functions: Bookings 1 flight, Bookings n flights, Further flight data.
b) Implement the function Further flight data in the flow logic. Here, the cursor must be on the line to be changed. For this entry, call the transaction TCD1 and skip the first screen. Pass the values for the line selected via parameter id’s. (GET CURSOR, CALL TRANSACTION ... AND SKIP FIRST SCREEN ).
c) Implement the function Booking 1 flight in the flow logic. Here, the cursor must be on a table control line. Call a dialog box and display a list of all bookings for the flight time (table SBOOK). After leaving the list, the cursor should be positioned on the selected line (GET and SET CURSOR, CALL SCREEN, SUPPRESS DIALOG, LEAVE TO LIST-PROCESSING).
d) Implement the function Bookings n flights in the flow logic. Here, the user must have selected several lines (. use the line selection column of your table control). For the selected flight times, start the report RSCCC071. To do this, you enter the selected times in an internal table defined with RANGES and then pass the table to the report when it is started (RANGES, SUBMIT report).
Unit 8 Automatic and Programmed Help Functions
Activity List: The following are the activities for this unit:
Object
Name / Description
Program name
SAPMZ##H
Transaction code
Z##H
Screen 100
Key input
Screen 200
Display flight data
Matchcode object
SPFL or ZM##
Note: ## Group number
8-1. Copy your program ( SAPMZ##G ) or the solution ( SAPMTCG1 ) and extend it to include the option to perform a matchcode search for the field SPFLI-CONNID. See transaction TCH1, matchcode object SPFL.
a) Create a matchcode object ( ZM## ) and assign the primary table SPFLI. Include all fields of the table SPFLI and set the search field to CONNID.
b) Create a matchcode ID to support a search by departure city and destination. Don’t forget to include the search field.
c) Assign the matchcode to the SPFLI-CONNID field on your key input screen ( 100 ).
Object
Name / Description
Program name
SAPMZ##I
Transaction code
Z##I
Screen 100
Key input
Screen 200
Display flight time
Note: ## Group number
8-2. Copy your program SAPMZ##D or the solution SAPMTCD1 and extend it to include F4 functionality (possible entries) for the field SFLIGHT-FLDATE. See transaction TCH2.
a) Use the function module HELP_VALUES_GET_EXTEND.
b) If the fields SFLIGHT-CARRID and SFLIGHT-CONNID contain values, they should be used to restrict the possible entries display.
Object
Name / Description
Program name
SAPMZ##J
Transaction code
Z##J
Screen 100
Key input
Screen 200
Display flight time
Note: ## Group number
8-3. Extend your program SAPMZ##I to include F1 functionality (help) for the field SFLIGHT-FLDATE. See transaction TCH3.
a) Use the data element supplement documentation for data elements 0001 and 0002. The supplement 0001 should be displayed if the field SFLIGHT-CARRID is blank, the supplement 0002 if it contains a value.
b) To determine the screen field contents in the event PROCESS ON HELP-REQUEST, use the function module DYNP_VALUES_READ.
August 1997 Exercises for Unit One
SAP R/3 Release 1 KEYWORDS \* MERGEFORMAT - PAGE 2
Filename: FILENAME \p \* MERGEFORMAT S:\DEVELOP\LEVEL3\BC410\BC410_EX\
Copyright SAP America, Inc. All rights reserved.