Professional Documents
Culture Documents
Dialog Programs:
A dialog program allows you to work interactively with the system and to change the contents of the database tables. Each dialog program has a certain sequence of screens that are processed by the system one after the other. From the view of a user, a dialog step consists of receiving a screen for entering data, then after the users clicks a button or selects a menu entry, processing is started. From the view of the SAP system, the screen is prepared and sent. After this, the user receives it and fills it out. Then the system analyzes and processes the data contained on the screen after receiving it from the user. A dialog program must offer: o a user-friendly user interface o format and consistency checks for the data entered by the user o easy correction of input errors o access to data by storing it in the database.
ABAP/4 offers a variety of tools and language elements to meet the requirements for creating and running dialog programs.
Screens (dynpros)
Each dialog in an SAP system is controlled by dynpros. A dynpro (DYnamic PROgram) consists of a screen and its flow logic and controls exactly one dialog step. The flow logic determines which processing takes place before displaying the screen (PBO-Process Before Output) and after receiving the entries the user made on the screen (PAI-Process After Input). The screen layout fixed in the Screen Painter determines the positions of input/output fields, text fields, and graphical elements such as radio buttons and checkboxes. In addition, the Menu Painter allows storing menus, icons, pushbuttons, and function keys in one or more GUI statuses. Dynpros and GUI statuses refer to the ABAP/4 program that controls the sequence of the dynpros and GUI statuses at runtime.
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)
Offline method includes creating a program in SE51 (screen painter). Online method includes creating a program in SE80 (Object Navigator).
Here I have created a small and basic program to display NAME and CITY of the customer entered.
Screen painter:
Using screen painter we can create text, fields, checkboxes, radio buttons, buttons, tab strips etc..,
As shown below, Every element on the screen has their own attributes.
We can also insert fields from database and program directly as shown below Click on the button Dictionary/ Program fields
Now click on Get from program to get the fields which are defined in the program
Once a field is used, It cannot be reused, You can see a lock symbol as shown below,
Now choose the place where you want to put the fields and drop the selected fields at you desired location.
Source Code:
*&---------------------------------------------------------------------*
*& Module Pool Z_TEST_KT *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* PROGRAM Z_TEST_KT. DATA cust like kna1-kunnr. DATA: NAME,CITY. DATA W_KNA1 TYPE TABLE OF kna1 WITH HEADER LINE. *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* module STATUS_0100 output. * SET PF-STATUS 'xxxxxxxx'. * SET TITLEBAR 'xxx'. endmodule. " STATUS_0100 OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* module USER_COMMAND_0100 input. CASE SY-UCOMM. WHEN 'DISP'. SELECT NAME1 ORT01 FROM KNA1 INTO CORRESPONDING FIELDS OF W_KNA1 WHERE KUNNR EQ CUST. ENDSELECT. LEAVE TO LIST-PROCESSING. IF NAME = 'X'. WRITE W_KNA1-NAME1. ENDIF. IF CITY = 'X'. WRITE W_KNA1-ORT01. ENDIF. ENDCASE. endmodule. " USER_COMMAND_0100 INPUT
Out Put:
Note: You should have a Transaction defined for the Module program to execute .
This is the output you see after executing the program Enter the customer Number and select NAME or CITY or both and click on DISPLAY.