Chapter 12 Introduction to Dialog Programming

Similar documents
LIST PROCESSING. Objective Extract datasets. Filling an extract with data Reading an extract Sorting an Extract. Lists

Chapter 08 ABAP/4 Open SQL

Attachment of note CR 642 Additional fields in customer and vendor master data

BC ABAP Workbench Tutorial

Setting Attributes Dynamically

In this Chapter you will learn...

Applies To:...1. Summary...1. Table of Contents...1. Procedure..2. Code... Error! Bookmark not defined.0

Logical Databases. Objectives. In this Chapter we will discuss. Overview of LDB Usage of LDB in ABAP Program Advantages of LDB

Dynamically Enable / Disable Fields in Table Maintenance Generator

Preface. Question 1. Assignment 4 Stephan Brumme June 27 th, th semester,

qwertyuiopasdfghjklzxcvbnmqwertyui opasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer

BC ABAP Workbench Tools

SAP ABAP Interview Questions & Answers

qwertyuiopasdfghjklzxcvbnmqwertyui opasdfghjklzxcvbnmqwertyuiopasdfgh jklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwer

Function Modules Objective The following section is intended to explain: What function modules are Components of function modules

BC427 Enhancement Framework Instructor Handbook

INTERVIEW QUESTIONS SAP ABAP (SAMPLE) May 23,

Changing the SAP Standard (BC)

Can be used in diverse languages / Development Environments

BC - ABAP Dictionary HELP.BCDWBDIC. Release 4.6C

How to pass data from ABAP to Web Dynpro ABAP - Part 1

The ABAP/4 layer describes the data formats used by the ABAP/4 processor. The database layer describes the data formats used in the database.

C_TAW12_740

SAP ABAP Training Course Content :

Generating Self-Defined Functions for ALV in Web Dynpro for ABAP

SAP NetWeaver Demo Examples Exercise Cancel Flight Booking

The Official ABAP" Reference

This post contains all database table operations- like select, insert, update, modify, collect, inner-join, left-outer-join, for all entries...

Working with Tabstrip in Webdynpro for ABAP

A SAP User Exit is a user defined FORM routine that is used to calculate and/or replace values within a validation, substitution, or rule.

REPORT zalv_fcat. * Output table T006 structure declaration. TYPES : BEGIN OF ty_t006. INCLUDE STRUCTURE t006. TYPES : END OF ty_t006.

Business Data Toolset (BDT) Developer s Manual

How to Attach Documents to Any Custom Program Using Generic Object Services

SAP ABAP ONLINE TRAINING COURSE

SAP- ABAP/4 ADVANCED COURSE CONTENT

Dynamic Context Menus in Web Dynpro ABAP.

SAP' ABAP. Handbook. Kogent Learning Solutions, Inc. Sudbury, Massachusetts JONES AND BARTLETT PUBLISHERS BOSTON TORONTO LONDON SINUAPORI:

ABAP FAQ s on Reports / Scripts / BDC / Dialogs

SAP ABAP. Introduction to SAP ABAP

TABC41 ABAP Development Workbench Basics 1/2 TABC41 1/2. R/3 System Release 46B

ICS Tutorials: Basic Operations

Part2 Enhancement and Screen-Exit ZPMNOT CMOD

SAP Debug Tips Switching between the Classic Debugger and New Debugger

SAP NETWEAVER DECISION SERVICE MANAGEMENT A PARADIGM SHIFT

COURSE LISTING. Courses Listed. Training for Database & Technology with Development in ABAP Dialog Programming. Beginner. Intermediate.

COURSE LISTING. Courses Listed. with ABAP Dialog Programming. 25 December 2017 (08:57 GMT) NW001 - SAP NetWeaver - Overview

Code Inspector User Manual

The SAP Internet Programming Model Part II

C_TAW12_740

Implement a virtual InfoProvider with Services

Business Configuration Sets (BC-CUS)

Web Transaction API HELP.BCFESITSTRANAPI. Release 4.6C

Adding Custom Fields to Contract Account Screen

Excel4apps Reports Wand User Guide (SAP) 2013 Excel4apps

Table Popins and Business Graphics in Web Dynpro ABAP

for Q-CHECKER Text version 15-Feb-16 4:49 PM

Web Dynpro for ABAP: Tutorial 4 - Display Bookings of Selected Flight

BC SAPscript: Printing with Forms

Relius Documents ASP Checklist Entry , select option 2

ABAP Code Sample to Display Data in ALV Grid Using Object-Oriented Programming

Customizing System Setting (BC-CUS)

ABAP: Table Maintenance Events

SDN Community Contribution

Freely Programmed Help- Web Dynpro

MaineStreet Financials 8.4

Altering Layouts. Changing Font. Universal Engraving Machine. Chapter 18 Altering Layouts

PM4 + Partners Knowledge Articles

Visual Workflow Implementation Guide

The Test Workbench in the SAP System (BC-CAT-PLN)

Editor for Personnel Calculation Schemas (PY-XX-TL)

SmartView. User Guide - Analysis. Version 2.0

Add notes to a document

Customized Transaction to Trigger Process Chain from Failed Step

Using Drop Down By Index in Table UI Element in WebDynpro ABAP

Winshuttle STUDIO 11 TRANSACTION Developer Basic Training. Copyright ADSOTECH Scandinavia Oy

Designing Adhoc Reports

Text version 15-Aug-12. for Q-CHECKER V4, V5 and V6

SAP Certified Development Associate ABAP with SAP NetWeaver 7.02

SAP-ABAP Training Program. Topics Covered. ABAP Dictionary Concepts

1 2 3 DETERMINING THE SAP BUSINESS OBJECT AND ITS KEY FIELDS... 12

Users who require access to this application must seek it from their Security Administrator.

Contents Microsoft PowerPoint Lesson 1: The PowerPoint Window...2 The Quick Access Toolbar...3 The Title Bar...3 Rulers...

Data Structure Design Guide Release 9.2

SIMATIC. Working with STEP 7. Introduction to STEP 1. The SIMATIC Manager 2. Programming with Symbols. Creating a Program in 4

EUSurvey 1.4 Editor Guide

MULTIPROG QUICK START GUIDE

Handling Transactions with BAPIs in Web Dynpro

SYS 500 Visual SCIL User Interface Design

GV 2 Devicemanagement 2

Object Determination Softproviding Core User Documentation

VMS-A1 Client Software. User Manual

Internet Explorer/ Edge/ Chrome/ Opera (Windows) Edition

Value Help in Web Dynpro ABAP - Tutorial.

WDA Tutorial II: Using Select Options in a WDA Application

Agilent MassHunter Workstation Software Report Designer Add-in

Working with the Roadmap UI Element in Web Dynpro ABAP

Text box. Command button. 1. Click the tool for the control you choose to draw in this case, the text box.

POS Designer Utility

Table of Contents Lesson 1: Introduction to the New Interface... 2 Lesson 2: Prepare to Work with Office

Transcription:

Chapter 12 Introduction to Dialog Programming Overview and interaction of com ponents Basic techniques of dialog programming Defining interfaces with the M enu Painter

Chapter 12 Objectives Interaction of screen and ABAP/4 module pool Components of the Screen Painter Options for field input checking Dynamic screen flow control Creating GUI title and GUI status Basis ergonom ic guidelines

The Main Components of a Dialog Program Development environm ent ABAP/4 Dictionary Screen Painter ABAP/4 Menu Painter Runtime environm ent Dialog processor ABAP/4 processor You use the Screen Painter and the Menu Painter to create and design screen templates and screen programs You define the processing logic in an ABAP/4 program (module pool) Data structures are defined in the ABAP/4 Dictionary You can access these structures from the ABAP/4 program and when defining screen fields The dialog processor controls the flow of your dialog program

Screen Painter ABAP/4 Screen attributes Screen no 100 Short text Test Screen type Normal Next screen 200 Screen layout Number: Field attributes NUMBER CHAR 10 characters Input x Flow logic PROCESS BEFORE OUTPUT MODULE INIT PROCESS AFTER INPUT MODULE READ Screen Painter ABAP/4 Global data DATA: NUMBER(10) TYPE C PBO modules MODULE INIT OUTPUT CLEAR NUMBER ENDMODULE PAI modules MODULE READ INPUT SELECT ENDMODULE To create a screen, take the following steps: Define the basic features of a screen (screen attributes) Design the screen layout (in the fullscreen editor) Define the field attributes (field list) Write the screen flow logic The most important ABAP/4 program components are found in the following objects: Global data or Dictionary structures in the TOP include program (data declarations) PBO (Process Before Output) module PAI (Process After Input) module Subroutines (if required)

Communication: Screen ABAP/4 Module Pool Screen Painter Screen Painter PROCESS BEFORE OUTPUT MODULE INITIALIZE PROCESS AFTER INPUT MODULE READ_SPFLI MODULE 1 2 PROGRAM SAPMTALA MESSAGE-ID AT TABLES SPFLI MODULE INITIALIZE OUTPUT CLEAR SPFLI ENDMODULE MODULE READ_SPFLI INPUT SELECT SINGLE * FROM SPFLI WHERE ENDMODULE Control passes from the dialog processor to the ABAP/4 processor Control passes from the ABAP/4 processor to the dialog processor Screen work area SPFLI-CARRID LH SPFLI-CONNID 0400 OK-CODE 1 1 2 PBO PAI 2 Module pool work area TABLES: SPFLI LH 0400 CARRID CONNID DATA: OK-CODE(4) ABAP/4 ABAP/4 I D E N T I C A L N A M E S The screen flow logic is divided into two events for each screen: The PROCESS BEFORE OUTPUT event (PBO) is executed before the screen is displayed The PROCESS AFTER INPUT event (PAI) is executed after the user has pressed ENTER The system processes the modules in an event sequentially In each module, control passes from the dialog processor to the ABAP/4 processor After processing, control is returned to the dialog processor When all the PBO modules have been processed, the contents of fields in the ABAP/4 work area are copied to the identically named fields in the screen work area Before the PAI module is processed, the contents of fields in the screen work area are copied to the identically named fields in the ABAP/4 work area

Overview: Creating a Dialog Program Airline carrier Flight number LH 0400 Planned flight From To Time FRANKFURT NEW YORK 08:24:00 In the following, we are going to create a dialog program which displays a planned flight connection On the first screen, the user can enter the key of the planned flight connection On the second screen, the system displays the contents of the corresponding entry in table SPFLI

Creating Programs Development class Program Functional area Local private objects Edit $TMP Local objects of the user Create Programs Choose Program SAPMTALA with TOP Include Create your program (ABAP/4 module pool) in the ABAP/4 Development Workbench The TOP include program initially includes just the PROGRAM statement To this, you add all the data declarations (global data) If you are using includes, the system proposes names formulated according to a particular rule The first three bytes of the ABAP/4 module pool name are removed and the string starting from the fourth byte is moved three bytes to the left In the three free bytes at the end, the system then adds characters which are appropriate for the include Example: The name of the TOP include for the ABAP/4 module pool SAPMTALA is MTALATOP Note: In this chapter, create all of your objects as local private objects

Program Attributes Title Test Type Application M S Save In the program attributes, you maintain the title, the program type and the application For program type, enter the value M (module pool) Select S (Basis Component) as the application

Defining Screens $TMP programs SAPMTALA User's local objects Create screens Choose Program Screen no Continue SAPMTALA 100 Screen Attributes Short description Test Screen type Normal Next screen 200 Create the relevant screens for your module pool from the object list After you have entered the screen number, the system branches to the screen attribute maintenance Enter a short description, select the screen type Normal and specify the number of the follow-up screen

Using ABAP/4 Dictionary Fields Fullscreen Dict/ProgFields Dict/ProgFields Table/field name Get from Dict Get from program Field Format Length Shrt text Copy Template Key word - short - medium - long - header Generally, you define screen fields by using existing ABAP/4 Dictionary field attributes You can also use field attributes already stored in the module pool To do this, a generated version of the module pool must exist You can copy the field texts and the output templates individually or together

Screen Layout (Graphical Screen Painter) Field attr Dict/progfields Field list Text Entry Check Radio Box Airline carrier Connection number To design screens, you use the Screen Painter The interface of the graphical Screen Painter contains easy-to-use functions for defining the various screen elements (eg input/output fields, field texts, boxes, etc) You choose each screen element and position it on the screen using the mouse To delete screen elements, you select the element with the mouse and then choose Delete To move screen elements, you use the mouse to drag the element to the required position Note: From Release 30, the graphical Screen Painter is supported by Windows NT, Windows 95 and UNIX If you are using other operating systems, you use the alphanumeric Screen Painter

Alphanumeric Screen Painter Dict/program fields Attributes Graphical element Select Airline carrier Connection number The alphanumeric Screen Painter provides the same functionality as the graphical Screen Painter to design the layout of your screens In the alphanumeric fullscreen editor, you enter underscores for input/output fields For radio buttons and checkboxes, you first define an one-byte long input/output field and then enter a field text After maintaining the field list, you define both fields as a graphical element To create a group box, enter a title and then choose a graphical element and a group box

Field List Views Matchcode/reference Modification groups Display attributes General attributes Texts/templates Field types SPFLI-CARRID SPFLI-CARRID There are six field list views available for maintaining the screen field attributes Alternatively, you can define them from one of the lists Attribute maintenance for one field is also possible in the fullscreen editor In the Screen Painter, you use external data types The external data types of fields that you select from the ABAP/4 Dictionary are displayed in the Format column In the case of fields (templates) that do not have any ABAP/4 Dictionary reference, you define an external data type yourself You can find out the correspondence of external data types to internal data types (ie ABAP/4 data types) by referring to the documentation on the ABAP/4 key word TABLES Examples are as follows: ABAP/4 Dictionary data type CHAR NUMC ABAP/4 data type C N

Field Attributes Fullscreen Field attr Field attributes Graph type Field name Dict attributes Program attributes Display attributes You can also maintain the attributes of your screen fields from the Screen Painter by selecting a field and then choosing the Attributes function

Defining the Flow Control PROCESS BEFORE OUTPUT MODULE INITIALIZE PROCESS AFTER INPUT MODULE READ_SPFLI Screen Painter You specify define your MODULE statements in the flow logic If you choose a module by double-clicking, the system creates suitable MODULE ENDMODULE statements in the appropriate include program This is known as forwards navigation If no include program exists, the system will create one if you wish It also inserts an INCLUDE statement in the main program

Creating Follow-up Screens Screen 100 Copy Screen 200 Screen 200 Attributes Flow control Next screen PROCESS BEFORE OUTPUT PROCESS AFTER INPUT Screen SPFLI-CARRID SPFLI-CONNID SPFLI-CITYFROM SPFLI-CITYTO Field list SPFLI-CARRID SPFLI-CONNID SPFLI-CITYFROM SPFLI-CITYTO For screens with a similar structure, you can copy an existing screen and, if necessary, modify it (eg layout, flow logic) To do this, you work in the ABAP/4 Development Workbench by positioning the cursor on the screen you want to copy (usually the object) and choose the Copy function When you have successfully copied the screen, the system displays the screen as a new sub-object of the module pool and you can edit it

Defining Fields in the Module Pool Top include MTALATOP ABAP/4 PROGRAM SAPMTALA TABLES: SPFLI DATA: OR Global data DATA: ABAP/4 In dialog processing, data is passed between the screens and the ABAP/4 program at runtime The system performs this communication automatically, but you must use identical names in the screens and the module pool Define the relevant fields as global data in the TOP include program To do this, you process either the TOP include program as a whole or the sections concerning global data or Dictionary structures Even then, the TOP include program is still implicitly in control

Creating ABAP/4 Modules $TMP programs SAPMTALA User's local objects Create Create PBO modules Choose PAI modules Choose PBO module INITIALIZE PAI module READ_SPFLI in include prog MTALAO01 in include prog MTALAI01 When creating PBO and/or PAI modules, you can assign them to an include or the main program via a dialog box Normally, the system automatically assigns your PBO modules to the include program xxxxxi01

Processing in the Module Pool MODULE INITIALIZE OUTPUT CLEAR SPFLI ENDMODULE ABAP/4 ABAP/4 MODULE READ_SPFLI INPUT SELECT SINGLE * FROM SPFLI WHERE CARRID = SPFLI-CARRID AND CONNID = SPFLI-CONNID ENDMODULE The ABAP/4 MODULE statements for PBO modules contain the addition OUTPUT, while the MODULE statements for PAI modules contain the addition INPUT

Defining Calls (Transaction Codes) $TMP User's local objects Programs SAPMTALA Create Transactions Choose Transaction code Transaction type Dialog transaction TALA Continue Transaction code Transaction text Program Screen number TALA TEST SAPMTALA 100 You can start an ABAP/4 dialog program ("transaction") by specifying a transaction code Customer transactions must begin with Z or Y The system stores your specifications in the table TSTC (Instead of creating a transaction from the object list, you can maintain the table itself)

Action Sequence PROCESS BEFORE OUTPUT MODULE A PROCESS AFTER INPUT MODULE B Screen Painter Action sequence Execute module A Data transport from ABAP/4 to screen work area Send screen ENTER Data transport from screen to ABAP/4 work area Execute module B When all the PBO modules have been processed, the data of identically named fields is transported from the module pool work area to the screeen work area- Before the PAI modules are executed, the data of identically named fields is usually transported from the screen work area to the module pool work area

Field Format Checking Field list Screen Painter Field name DATE Amount Format DATS DEC Date 30021996 Date Amount Amount 12A3 E: Invalid date E: Please enter numeric value The dialog processor checks the input against the format attributes of the relevant field If the system detects an incorrect input value, it displays an error message and makes the field ready for input again

Obligatory Field Field list Screen Painter Field name PLANETYPE OBLIGATORY X? You can assign the attribute obligatory to a screen field The dialog processor processes the screen only after values have been entered for all required fields

Foreign Key Checking Foreign key table ABAP/4 Dictionary Check table ABAP/4 Dictionary Field no FELD1 KeyCheck table P1 Domain Field no PFELD Key X Field list Screen Painter Check table P1 Field FELD1 Foreign key Feld1 C X PFELD A B C Foreign key checking involves the system comparing the value entered in a screen field against a set of values If the entered value is not found in the set of values, the system displays an error message and makes the corresponding field ready for input again Here the following requirements apply: - The screen field is a field in an ABAP/4 Dictionary table (foreign key table) - The table against which the value is checked (known as the check table) is also defined in the ABAP/4 Dictionary - The foreign key table and the check table are assigned to the same domain - The check table is assigned to this domain as a value table - The value table becomes the check table by through the definition of a foreign key between the foreign key field and the check table field in the ABAP/4 Dictionary - The check table field must be the key field of the check table You can also perform foreign key checking against check tables with several key fields You can display the contents of the check table by placing the cursor on the screen field and pressing F4 By pressing F1, you can display the documentation defined at data element level

Input Checking in the Module Pool PROCESS AFTER INPUT FIELD <screen field> MODULE <module> Screen Painter MODULE <module> INPUT MESSAGE E ENDMODULE ABAP/4 1 1 E message 1 ready for input again If you want to check input values in the module pool and include an error dialog following a negative check result, use the MODULE parameter with the FIELD statement You also have to define an error or warning message in the module pool Please note that only the FIELD statement is responsible for modifying the status of a field to make it ready for input again: If you define a message in the module pool, but do not call the module within a FIELD statement, the system sends the message, but the fields are not ready for input

FIELD Statement and Data Transport PROCESS AFTER INPUT MODULE A FIELD X MODULE B FIELD Y MODULE C MODULE D Screen Painter A c t i o n s e q u e n c e ENTER Data transport for all fields other than X, Y from the screen to the ABAP/4 work area Execute module A Data transport for X Execute module B Data transport for Y Execute module C Execute module D In the PAI module, screen fields are transported to identically named ABAP/4 fields Fields not defined in FIELD statements are transported first All the other fields are copied only when the relevant FIELD statements have been processed

Setting the Next Screen Dynamically Screen attributes Screen Painter Screen attributes Screen Painter screen num ber 100 next screen 100 screen number 200 next screen 200 Screen Painter Screen Painter PROCESS AFTER INPUT MODULE OK_CODE PROCESS BEFORE OUTPUT MODULE OK_CODE INPUT SET SCREEN 200 LEAVE SCREEN ABAP/4 PROCESS AFTER INPUT If the functions in your dialog program require a different control process, you can control the screen sequence dynamically using the SET SCREEN statement The statement SET SCREEN nnnn temporarily overwrites the follow-up screen Screen nnnn must be a screen from the same module pool When the current screen has been processed, the system processes the follow-up screen unless you cancel the current screen process with LEAVE SCREEN You can also use the CALL SCREEN statement for dynamic screen sequence control Here, you can insert a screen sequence and then either return to the original call location after this has been executed or call a screen defined as a modal dialog box The CALL SCREEN statement is not covered in this course

Reading Function Codes in Programs Screen Painter PROCESS AFTER INPUT MODULE USER_COMMAND Screen Painter Display DATA: OKCODE(4), SAVE_OKCODE(4) ABAP/4 Field list Field name Lg Form FctCode PUSH_100 MORE OKCODE 5 OK Screen Painter MODULE USER_COMMAND INPUT SAVE_OKCODE = OKCODE CLEAR OKCODE CASE SAVE_OKCODE WHEN MORE ENDMODULE You define pushbuttons to enable the user to choose specific functions When the user presses a pushbutton, the PAI event is triggered You also assign a function code to each pushbutton When the user chooses a function, the function code is in the field you have defined in the field list with the attributes length 5 and format OK To be able to react to a function code in the ABAP/4 module pool, you define an identically named OKCODE field This contains the current function code after the field has been transported You are recommended to use a backup version of the OKCODE field to avoid sending a screen that already has a function code

Menu Painter: Overview Object List Development object Edit Goto Markers GUI title SET TITLEBAR code SY-TITLE: Title text ENTER F1 Help F2 Choose F3 GUI status SET PF-STATUS status SY-PFKEY: Status Title bar Menu bar Standard toolbar Application toolbar You use the Menu Painter to define functions on a screen in a particular status and assign them to the appropriate menu bar, standard toolbar and application toolbar You also define the title In general, you define a menu bar for each dialog program and assign it to a status For each status, you define which menu functions are to be active/inactive All the statuses of a dialog program make up the user interface If you add a new status, you have to regenerate the interface You assign a status and a title to a screen in the appropriate PBO module using the SET PF-STATUS and SET TITLEBAR statements respectively The status can be up to 8 characters long, while the title code should consist of no more than 3 characters

GUI Title SAPMTALA Create GUI title Choose Create title Title code 001 Continue Program Maint language Title code Title Test dialog program SAPMTALA ENGLISH 001 You can create and/or maintain a title either from the object list or from a GUI status To set a title in a PBO module, you use the statement SET TITLEBAR <code> WITH <value1> <value2> <valuen> The contents of <code> can be up to three characters long The system replaces & placeholders in the title with the contents of <value1><valuen> Once a title is set, it remains valid until you set a new title The system field SY-TITLE contains the current screen title

GUI Status SAPMTALA Create GUI status Choose Create status Program Status SAPMTALA STAT1 Short desc Test status Status type - screen - dialog box - list - list in dialog box Continue You can define one or more statuses for a screen A status defines which functions the user can choose and whether they can be selected via the menu bar or standard toolbar, or by pressing function keys or pushbuttons To set a status in a PBO module, you use the statement SET PF-STATUS <status> The contents of <status> can have up to eight characters By using the EXCLUDING parameter with the SET PF-STATUS statement, you can deactivate the functions of the current status which were defined as active in the Menu Painter Once a status is set, it remains valid until you set a new status The system field SY-PFKEY contains the current status By choosing a status type, you determine whether the status is to refer to a normal screen or a list The system offers different functions for each status type

Defining the Interface I Menu bar - Hide standards <Object> Edit Goto Func < > < > Name Other <object> Create F key assignment + Extended F key assignment WINDOWS MOTIF APPLE On request, the system proposes default values for the menu bar and the function key setting, but you can modify these Menu bars can contain up to eight menus You can define up to six of these yourself, but the System and Help menus are added automatically by the system A single menu can contain up to 15 entries, including the functions and their descriptions, sub-menu names and separator lines You should also specify all the functions that are active in a status as active in the menu bar (SAP ergonomic standard)

Defining the Interface II Standard toolbar Application toolbar Recom mended function key settings F2 F9 < > < > Choose Select Freely assigned function keys F5 F6 You assign the active functions that a user is most likely to need in the current status to the application toolbar Before you can do this, the function code must be assigned to a function key You assign function codes to function keys by entering them in the Recommended function key settings or the Freely assigned function keys sections The system automatically assigns the functions in the standard toolbar to special function keys (see next page)

Chapter 12 Summ ary Program of type M (module pool) with TOP include (optional) Define global data in the TOP include or main program Generate main program (only if global data is not yet known in the ABAP/4 Dictionary) Create first screen for module pool - design screen layout - maintain field list (field attributes) - define module calls in the flow logic Create other screens (by copying, if necessary) - complete screen definition - maintain field list Create modules in the module pool (general processing, dialog messages, GUI title, GUI status) Define transaction code BC400 / 12-1

Exercises Chapter 12: Introduction to Dialog Programming 1 Program name: SAPMZ##1 Transaction code: Z##1 Development class: $TMP Screens 100 Follow-up screen 200 200 Follow-up screen 100 ## Group number Write a dialog program to display the flight data for a selected flight To do this, use the table SFLIGHT On the first screen, the user should be able to enter values for the key fields of the table SFLIGHT For the second screen, copy the first one and add other fields (see example) Define all fields on the second screen as output fields only All fields on screen 100 should have initial values when the screen is called

a) Screen 100 Schluessel Flugdaten Fluggesellschaft Airline carrier Verbindungs-Nummer Connection number Datum Flight des date Fluges b) Screen 200 Airline carrier Connection number Flight date Flight information FlgtPrice Local currency Plane type Maximum capacity Occupied seats

2 Program name: SAPMZ##2 Transaction code: Z##2 Development class: $TMP Screens 100 Follow-up screen 100 200 Follow-up screen 200 ## Group number Copy your program SAPMZ##1 or the example solution SAPMTAL1 and add the following functionality: - The key fields of table SFLIGHT should be defined as required fields In addition, they should be used to transfer data to the SPA/GPA Memory and/or provided with data from the SPA/GPA Memory - If invalid values are entered in the key fields, you should display an error dialog message on the first screen and make the field Date of flight ready for input again Use message class - Changing screens should only be possible by pressing the appropriate pushbutton (see example)

a) Screen 100 Schluessel Flugdaten Fluggesellschaft Airline Verbindungs-Nummer Connection number Datum Date des of Fluges flight Display b) Screen 200 Airline Connection number Date of flight Back Flight information FlgtPrice Local currency Plane type Maximum capacity Occupied seats

3 Program name: SAPMZ##3 Transaction code: Z##3 Development class: $TMP Screens 100 Follow-up screen 100 200 Follow-up screen 200 ## Group number Copy your program SAPMZ##2 or the example solution SAPMTAL2 and modify the copy as follows: - The dialog program should have a GUI title - Define one GUI status When the transaction is executed, only the relevant function is to be active (see example) - On the first screen, implement the Display function as an icon in the standard toolbar (cf example) Note: When defining the status, use the system standards

Examples a) Screen 100 Display flight data Flight data Goto System Help! Display flight data Flight data Goto System elp! Display Back b) Screen 200 Display flight data Flight data Goto System Help! Display flight data Flight data Goto System Help! Display Back

Solutions Chapter 12: Introduction to Dialog Programming 1 Exercise 1 *&---------------------------------------------------------------* *& Module pool SAPMTAL1 Flow control * *&---------------------------------------------------------------* * Screen 100 PROCESS BEFORE OUTPUT MODULE INITIALIZE PROCESS AFTER INPUT MODULE READ_SFLIGHT *&---------------------------------------------------------------* *& Module pool SAPMTAL1 * *&---------------------------------------------------------------* PROGRAM SAPMTAL1 TABLES SFLIGHT *&---------------------------------------------------------------* *& Module INITIALIZE OUTPUT * *&---------------------------------------------------------------* MODULE INITIALIZE OUTPUT CLEAR SFLIGHT ENDMODULE " INITIALIZE OUTPUT

*&---------------------------------------------------------------* *& Module READ_SFLIGHT INPUT * *&---------------------------------------------------------------* MODULE READ_SFLIGHT INPUT SELECT SINGLE * FROM SFLIGHT WHERE CARRID = SFLIGHT-CARRID AND CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE * SY-SUBRC is not read in this program ENDMODULE " READ_SFLIGHT INPUT

2 Exercise 2 *-------------------------------------------------------------* *& Module pool SAPMTAL1 Flow control * *&------------------------------------------------------------* * Screen 100 PROCESS BEFORE OUTPUT MODULE INITIALIZE PROCESS AFTER INPUT FIELD SFLIGHT-FLDATE MODULE READ_SFLIGHT MODULE USER_COMMAND_0100 * Screen 200 PROCESS BEFORE OUTPUT PROCESS AFTER INPUT MODULE USER_COMMAND_0100

*&------------------------------------------------------* *& Module pool SAPMTAL1 * *&------------------------------------------------------* PROGRAM SAPMTAL2 MESSAGE-ID AT TABLES SFLIGHT DATA: OKCODE(4) *&------------------------------------------------------* *& Module INITIALIZE OUTPUT * *&------------------------------------------------------* MODULE INITIALIZE OUTPUT CLEAR: SFLIGHT, OKCODE ENDMODULE " INITIALIZE OUTPUT

*&------------------------------------------------------* *& Module READ_SFLIGHT INPUT * *&------------------------------------------------------* MODULE READ_SFLIGHT INPUT SELECT SINGLE * FROM SFLIGHT WHERE CARRID = SFLIGHT-CARRID AND CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE IF SY-SUBRC NE 0 CLEAR OKCODE MESSAGE E007 *E: No table entry for selected key ENDIF ENDMODULE " READ_SFLIGHT INPUT *&---------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT * *&---------------------------------------------------------------* MODULE USER_COMMAND_0100 INPUT CASE SY-DYNNR WHEN 100 IF OKCODE = 'MORE' SET SCREEN 200 ENDIF WHEN 200 IF OKCODE = 'BACK' SET SCREEN 100 ENDIF

ENDCASE LEAVE SCREEN "Optional, because SET SCREEN is the last "statement in PAI ENDMODULE " USER_COMMAND_0100 INPUT

3 Exercise 3 *&-------------------------------------------------------* *& Module pool SAPMTAL1 Flow control * *&-------------------------------------------------------- * Screen 100 PROCESS BEFORE OUTPUT MODULE STATUS_100 MODULE INITIALIZE PROCESS AFTER INPUT FIELD SFLIGHT-FLDATE MODULE READ_SFLIGHT MODULE USER_COMMAND_0100 * Screen 200 PROCESS BEFORE OUTPUT MODULE STATUS_100 PROCESS AFTER INPUT MODULE USER_COMMAND_0100

*&---------------------------------------------------------------* *& Module STATUS_100 OUTPUT * *&---------------------------------------------------------------* MODULE STATUS_100 OUTPUT SET TITLEBAR '100' CASE SY-DYNNR WHEN 100 SET PF-STATUS 'BASE' EXCLUDING 'BACK' WHEN 200 SET PF-STATUS 'BASE' EXCLUDING 'MORE' ENDCASE ENDMODULE " STATUS_100 OUTPUT