Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Screen painter and dialog programming

Former Member
0 Likes
3,274

Hi,

I need some really good documents ( PDF's ) on screen programming and dialog programming, somebody please help me on that.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,111

DIALOG PROGRAMMING

IN

ABAP

Introduction:

Advanced Business Application Programming is a fourth generation language, developed by SAP in which SAP R/3 applications are written. There are two programming techniques - list or report programming and dialog or dynamic programming.

Prerequisites:

The user should be familiar with data dictionary and language constructs.

Dialog programming:

Programs that are partially or wholly user dialog-driven are referred to as dialog programs. They cannot be executed in the background.

Purpose:

Now-a-days most of the business applications require manual input of data. In such cases the application has to be interactive and dialog programming solves this purpose.

Differences between Report & Dialog Programming:

• Report program is executable, whereas dialog program is a module pool program. It has to be executed via a transaction only.

• Report program is used to analyze the data in the database, while a dialog program is used to interact with the R/3 screen and make changes in the database. In other words, dialog programming is just like a front end to the database, used for the customization of screens.

Components of a dialog programming:

A dialog-driven program consists of the following basic components:

 Transaction code

 Screens

 GUI status

 ABAP program

Transaction code:

• A transaction code starts a screen sequence.

• The transaction code is linked to an ABAP program and an initial screen.

• We can create the transaction codes in the Repository Browser in the ABAP Workbench or using the Transaction SE93.

Screen:

• A dialog program has one or more screens.

• Screens can be created using the Screen Painter in the ABAP Workbench.

• A screen consists of a screen mask and its flow logic. Since the flow logic influences the program flow, screens are also referred to as "dynamic programs".

• The screen layout determines the positions of input/output fields and other graphical elements such as checkboxes, radio buttons and push buttons.

• The screen flow logic serves as a container for the screen processing blocks. There are four events associated with the processing blocks and they are triggered by the run time environment. They are

 PROCESS BEFORE OUTPUT (PBO): This event defines the processing that takes place before the screen is displayed.

 PROCESS AFTER INPUT (PAI): This event defines the processing that takes place after the user has chosen a function on the screen.

 PROCESS ON HELP-REQUEST (POH): This event is fired when the user presses F1 key. It displays help on a particular field.

 PROCESS ON VALUE REQUEST (POV): This event is triggered when the user presses F4 key. It displays all the possible values for that selection in a window.

• All the screens that we call within an ABAP program must belong to that program.

• The screens belonging to a program are numbered.

• For each screen, the system stores the screen number which is normally displayed next. We can create any number of complex screen sequences from the screens in a single program. For example, we can navigate from one screen to any other screen in the same program, or repeat part of a sequence any number of times.

The screen sequences generally used are:

 CALL SCREEN scr.

Calls the screen scr, scr is the number of a screen on the main program.

 SET SCREEN scr.

The system processes the screen scr immediately after the current screen.

 LEAVE SCREEN.

Leaves the current screen and processes the next screen.

 LEAVE TO SCREEN scr.

Leaves the current screen and processes the screen scr.

GUI status:

• GUI status is an independent component of an ABAP program.

• Each screen has a GUI status.

• We can create them in the ABAP Workbench using the Menu Painter.

• It includes the menu bars, standard toolbar, and application toolbar, with which the user can choose functions in the application.

ABAP program:

• Each screen and GUI status in the R/3 System belongs to one ABAP program.

• ABAP programs are responsible for data processing within the individual dialog steps of an application program. This means that the program cannot be constructed as a single sequential unit, but must be divided into sections that can be assigned to the individual dialog steps. To meet this requirement, ABAP

• Programs have a modular structure. Each module is called a processing block. A processing block consists of a set of ABAP statements. When we run a program, we effectively call a series of processing blocks.

The following diagram shows the structure of an ABAP program:

An ABAP program consists of two parts:

1. Declaration part for global data, classes & selection screens

2. Container for processing blocks.

The declaration part consists of:

 all the declaration statements for global data. Global data is visible in all internal processing blocks.

 all selection screen definitions.

 all local class definitions. Declaration statements which occur in procedures (methods, subroutines, function modules) form the declaration part for local data in those processing blocks. This data is visible only within the procedure in which it is declared.

The ABAP program contains the following types of processing blocks.

 Dialog modules (no local data area)

 Event blocks (no local data area)

 Procedures (methods, subroutines and function modules with their own local data area)

Among these, dialog modules and procedures are enclosed in the ABAP keywords which define them, event blocks are introduced with event keywords and concluded implicitly by the beginning of the next processing block.

Creating a dialog program:

• Dialog programs are created with type ‘M’ – Module Pool. So they are also referred to as Module Pool programs.

• A Dialog program can be created through transaction SE38 or SE80 (object Repository Browser).

<<Note: In this BOK, I would have used some screen shots from a dialog program, named ZSAMPLE123 >>

To create a dialog program, we have to be familiar with sub-screens, screen painter, menu painter, includes, messages, step-loops and table controls.

Sub-screens:

• Sub-screens allow us to embed one screen within another at runtime.

• The term “sub-screen” refers to both the screen that is embedded and the area on the main screen on which it is placed.

• When a sub-screen is used, the flow logic of the embedded screen is also embedded in the flow logic of the main screen.

• Sub-screens can be created using transaction SE51 like the ordinary screens.

• To use a sub-screen, we must

&#61664; Define the sub-screen areas on the screen.

&#61664; Define suitable sub-screen areas.

&#61664; Include the sub-screen screen in the sub-screen area.

&#61664; Use unique names for the sub-screens.

Syntax for the flow logic of main screen:

The flow logic should be called both in the PBO and PAI of the main screen.

PROCESS BEFORE OUPTPUT.

CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>.

PROCESS AFTER INPUT.

CALL SUBSCREEN <area>.

Screen painter:

• Screen painter is a special tool provided by ABAP/4 development workbench which allows the user to create and maintain the GUI screens.

• SE51 is the transaction code to use the screen painter.

• Screen painter is available in two modes – Graphical & Alphanumeric mode.

• A screen is made up of different elements like text fields, input/output fields, checkboxes, pushbuttons, radio buttons, table controls, OK_CODE field etc.

<Note: OK_CODE is a 20 char field. A name has to be assigned to this field to use it for a particular screen>

• Each of these elements are associated with:

Attributes: They describe a screen and determine its behavior during run time. E.g., program, screen number, screen type, next screen, cursor position etc.

Field attributes: Describes an element.

Layout: It refers to the arrangement of the elements on the screen.

Flow logic: It is a series of instructions. It describes the relationship between a screen element and its application.

Menu painter:

• Menu painter is used to design the interface components.

• It can be accessed by double clicking the command in PBO module.

The menu painter contains the following components:

Status: Defines the combination of menu bars, menu lists, F-key settings and functions available to an interface.

Menu bars: Defines the functions available to the user.

Menu list: Lists the items in a specific menu. E.g., an edit menu may contain items like cut, copy and replace.

F-key settings: Defines keyboard keys associated with a particular interface function.

Functions: Defines individual functions such as cut, copy and replace.

Titles: Defines the window titles for an interface.

Includes:

In contrast to all other program types, include programs do not represent stand-alone compilation units with a memory area of their own. Include programs cannot be executed. They are used exclusively for modularizing ABAP source code and are included in other programs.

Includes contain PBO, PAI, Global data, Forms, etc.

Standard includes found in the module pool of any program are

• XXXXXF01 – contains the forms

• XXXXXI01 – contains the PAI

• XXXXXO01 – contains the PBO

• XXXXXTOP – contains the global data

Here XXXXX is the name of the dialog program.

Messages:

Messages are mostly used for error handling during processing of other user dialogs.

• Messages can be maintained in Transaction SE91. They are stored in the table T100.

• T100 has language key, twenty-character member class, message number and message text.

&#61664; Language key is supplied by the system according to the language environment of the system.

&#61664; Message classes assign messages to an application.

&#61664; Message numbers are used to identify the messages in the message class.

&#61664; When we call a message in ABAP, we need to specify the message class and the number.

• The processing of messages depends upon the message type and the program context in which it occurs.

• Prefix of the message specifies the message type e.g., I for information message.

• The different types of messages are:

&#61664; A: Termination – Terminates the program and displays the message on the screen.

&#61664; E: Error – Depending on the program context, an error dialog appears or the program terminates.

&#61664; I: Information – Displays a message on the screen. When the user confirms the message, the program continues immediately after the message statement.

&#61664; S: Status – It is same as the information message but displays the message on the next screen.

&#61664; W: Warning – Depending on the program context, an error dialog appears or the program terminates.

&#61664; X: Exit – No message is displayed. The program terminates with a short dump. This allows us to force the program termination.

• A message can be defined as

MESSAGE ixxx(abc).

Here xxx is the message number

abc is the message class.

Step loops:

• Step loops are screen elements which displays table-type data on a screen.

• They are repeated sequence of blocks of screen element. In a step loop, a number of screen elements are combined together to form a loop block.

• They do not have individual names.

• There are two types of step loops – Fixed size and Variable size.

• In the fixed size, the number of loop blocks is fixed whereas in the variable size the number of loop blocks will change dynamically as per the size of the screen.

• Step loops can be programmed using LOOP………….ENDLOOP.

Step loop creation:

Step loops can be created in the screen painter (SE51) as follows:

&#61664; Define the screen elements that will be part of the step loop. They may extend to more than one line.

&#61664; Select all the elements as one group.

&#61664; Go to edit menu and select Grouping &#61664; Step Loop &#61664; Define

&#61664; Define the step loop as variable or fixed by selecting

Edit &#61664; Grouping &#61664; Step Loops &#61664; Fix or Variable

&#61664; Then create the step loop program using LOOP……....ENDLOOP in both PBO and PAI, so that transfer of data can take place between screen and ABAP program.

Step loop program – Types:

1. LOOP

MODULE fill_data

ENDLOOP.

In this case, in PBO, a module should be called that will transfer the data to the screen fields. In PAI, the module call is not required. An empty LOOP…...ENDLOOP will be enough or we can call a module to write the data to an internal table. In this method there is no automatic scrolling, we have to program it in ABAP.

2. LOOP AT int_table[INTO wa][CURSOR line_number][FROM n1 to n2].

ENDLOOP.

In this case, in PBO, a module call is not required to fill the step loop screen fields since the data is copied to the work area wa and from there to screen fields in the step loop automatically. INTO wa is not required if we use the int_table declared with a header line. In PAI, the addition AT int_table is also required for automatic scrolling.

The parameter CURSOR line_number which is of TYPE I is used to specify the line number from which the data has to be displayed. FROM n1 TO n2 is used to restrict the starting line and ending line of the internal table.

Table controls:

Table controls and step loops are almost identical. In terms of usability by the end user, table controls are an improvement of step loops. Usage of table controls offers many added features compared to step loops like

&#61664; Scroll within a field

&#61664; Scroll through the table horizontally and vertically

&#61664; Select table rows or columns

&#61664; Make selective columns editable

Table control creation:

Table control is created in the screen painter (SE51) and a control variable of TYPE TABLEVIEW using CONTROLS statement is declared in the ABAP program. We have to use LOOP…...ENDLOOP statement in both PBO and PAI, with or without AT int_table parameter. If AT int_table parameter is not used then we have to place a MODULE call between the LOOP…...ENDLOOP statement to fill the screen table rows from the ABAP program in PBO and program our own scrolling functions using OK_CODE field.

ABAP declaration:

CONTROLS: tab_control TYPE TABLEVIEW USING SCREEN xxxx.

Here tab_control is the name of the table control used in the screen.

xxxx refers to the screen number.

This statement will declare a control variable that will be used to access the table control.

PBO processing:

In PBO, we have to use LOOP.....ENDLOOP statement, with or without internal table.

LOOP WITH CONTROL tab_control.

MODULE fill_tab_control.

ENDLOOP.

Here a module should be called between the loop…..endloop statement to transfer the data from the ABAP program to the screen table through a structure. This module should use the CURRENT_LINE attribute of the table control variable to get the current screen table record index to read the data from the internal table into a work area.

E.g., READ TABLE int_table INDEX tab_control-CURRENT_LINE.

The record read will be placed in the header line of the internal table and will be available to the similarly named screen fields or if these are different it can be written explicitly.

E.g., screen_field_name = int_table-field_name.

LOOP AT int_table INTO wa WITH CONTROL tab_control CURSOR line_number FROM n1 TO n2.

ENDLOOP.

Here the module call is not required to fill the screen table. The parameter CURSOR line_number is an integer of type I indicating which line in the internal table should be displayed first on the table control .FROM n1 TO n2 can be used to restrict the starting line and ending line number of the internal table.

PAI Processing:

To transfer the data from the table control to the ABAP program, we have to use LOOP……ENDLOOP.

If we have to do some changes to the data we should call a module between the LOOP…….... ENDLOOP. The MODULE call to process user commands (SY-UCOM) should be called after the ENDLOOP statement.

Procedure for creating a dialog program using SE80:

...

1. Start the objector navigator using the transaction code SE80.

2. In the navigation area, choose the object type Program and enter the name of the program in the input field below. Confirm with Enter. If the program does not exist, the system displays a dialog that allows us to create a program.

3. A Create Program dialog box appears, which asks for the creation of a top include. Say continue.

4. A dialog box appears in which we should enter a name for the TOP include.

5. Choose Enter to continue.

6. A dialog box appears in which we can set other program attributes.

7. Enter the program attributes and choose Save. The system displays the Create Object Catalog Entry dialog box.

8. Assign a package to the program.

9. Choose Save to confirm the entries.

The program is added to the object list of the assigned package and is displayed under the Programs object node. The system starts the ABAP Editor and the program is displayed in change mode.

<< Note: We can also create a program from the initial screen of the ABAP Editor (Transaction SE38) >>

10. Right click on the program name and create the PBO, PAI and form objects.

11. Right click on the program name, say create &#61664; screen. A dialog box appears. Enter the screen number and say continue.

12. Click on layout. Design the layout of the screen with the required elements and define its attributes.

13. Create the GUI status and GUI title for the screen created by right clicking on the program name and say create &#61664; GUI status and create &#61664; GUI title respectively.

14. Click on the flow logic tab in the screen and define the flow logic for the screen created.

15. Repeat the steps from 11 - 14 to create other required screens.

16. Create the transaction codes by clicking on the program name and say create &#61664; transaction.

17. Say Enter.

18. Then Create Dialog transaction screen appears. In that specify the program name and the initial screen number.

19. Say Save.

20. Activate the entire program.

Now the dialog program can be executed using the transaction code.

Summary:

In this document, we have focused on the concept of dialog programming, its purpose, components and the step-by-step creation of the same in detail with suitable examples.

3 REPLIES 3
Read only

Former Member
Read only

Former Member
0 Likes
2,112

DIALOG PROGRAMMING

IN

ABAP

Introduction:

Advanced Business Application Programming is a fourth generation language, developed by SAP in which SAP R/3 applications are written. There are two programming techniques - list or report programming and dialog or dynamic programming.

Prerequisites:

The user should be familiar with data dictionary and language constructs.

Dialog programming:

Programs that are partially or wholly user dialog-driven are referred to as dialog programs. They cannot be executed in the background.

Purpose:

Now-a-days most of the business applications require manual input of data. In such cases the application has to be interactive and dialog programming solves this purpose.

Differences between Report & Dialog Programming:

• Report program is executable, whereas dialog program is a module pool program. It has to be executed via a transaction only.

• Report program is used to analyze the data in the database, while a dialog program is used to interact with the R/3 screen and make changes in the database. In other words, dialog programming is just like a front end to the database, used for the customization of screens.

Components of a dialog programming:

A dialog-driven program consists of the following basic components:

&#61664; Transaction code

&#61664; Screens

&#61664; GUI status

&#61664; ABAP program

Transaction code:

• A transaction code starts a screen sequence.

• The transaction code is linked to an ABAP program and an initial screen.

• We can create the transaction codes in the Repository Browser in the ABAP Workbench or using the Transaction SE93.

Screen:

• A dialog program has one or more screens.

• Screens can be created using the Screen Painter in the ABAP Workbench.

• A screen consists of a screen mask and its flow logic. Since the flow logic influences the program flow, screens are also referred to as "dynamic programs".

• The screen layout determines the positions of input/output fields and other graphical elements such as checkboxes, radio buttons and push buttons.

• The screen flow logic serves as a container for the screen processing blocks. There are four events associated with the processing blocks and they are triggered by the run time environment. They are

&#61664; PROCESS BEFORE OUTPUT (PBO): This event defines the processing that takes place before the screen is displayed.

&#61664; PROCESS AFTER INPUT (PAI): This event defines the processing that takes place after the user has chosen a function on the screen.

&#61664; PROCESS ON HELP-REQUEST (POH): This event is fired when the user presses F1 key. It displays help on a particular field.

&#61664; PROCESS ON VALUE REQUEST (POV): This event is triggered when the user presses F4 key. It displays all the possible values for that selection in a window.

• All the screens that we call within an ABAP program must belong to that program.

• The screens belonging to a program are numbered.

• For each screen, the system stores the screen number which is normally displayed next. We can create any number of complex screen sequences from the screens in a single program. For example, we can navigate from one screen to any other screen in the same program, or repeat part of a sequence any number of times.

The screen sequences generally used are:

&#61664; CALL SCREEN scr.

Calls the screen scr, scr is the number of a screen on the main program.

&#61664; SET SCREEN scr.

The system processes the screen scr immediately after the current screen.

&#61664; LEAVE SCREEN.

Leaves the current screen and processes the next screen.

&#61664; LEAVE TO SCREEN scr.

Leaves the current screen and processes the screen scr.

GUI status:

• GUI status is an independent component of an ABAP program.

• Each screen has a GUI status.

• We can create them in the ABAP Workbench using the Menu Painter.

• It includes the menu bars, standard toolbar, and application toolbar, with which the user can choose functions in the application.

ABAP program:

• Each screen and GUI status in the R/3 System belongs to one ABAP program.

• ABAP programs are responsible for data processing within the individual dialog steps of an application program. This means that the program cannot be constructed as a single sequential unit, but must be divided into sections that can be assigned to the individual dialog steps. To meet this requirement, ABAP

• Programs have a modular structure. Each module is called a processing block. A processing block consists of a set of ABAP statements. When we run a program, we effectively call a series of processing blocks.

The following diagram shows the structure of an ABAP program:

An ABAP program consists of two parts:

1. Declaration part for global data, classes & selection screens

2. Container for processing blocks.

The declaration part consists of:

&#61664; all the declaration statements for global data. Global data is visible in all internal processing blocks.

&#61664; all selection screen definitions.

&#61664; all local class definitions. Declaration statements which occur in procedures (methods, subroutines, function modules) form the declaration part for local data in those processing blocks. This data is visible only within the procedure in which it is declared.

The ABAP program contains the following types of processing blocks.

&#61664; Dialog modules (no local data area)

&#61664; Event blocks (no local data area)

&#61664; Procedures (methods, subroutines and function modules with their own local data area)

Among these, dialog modules and procedures are enclosed in the ABAP keywords which define them, event blocks are introduced with event keywords and concluded implicitly by the beginning of the next processing block.

Creating a dialog program:

• Dialog programs are created with type ‘M’ – Module Pool. So they are also referred to as Module Pool programs.

• A Dialog program can be created through transaction SE38 or SE80 (object Repository Browser).

<<Note: In this BOK, I would have used some screen shots from a dialog program, named ZSAMPLE123 >>

To create a dialog program, we have to be familiar with sub-screens, screen painter, menu painter, includes, messages, step-loops and table controls.

Sub-screens:

• Sub-screens allow us to embed one screen within another at runtime.

• The term “sub-screen” refers to both the screen that is embedded and the area on the main screen on which it is placed.

• When a sub-screen is used, the flow logic of the embedded screen is also embedded in the flow logic of the main screen.

• Sub-screens can be created using transaction SE51 like the ordinary screens.

• To use a sub-screen, we must

&#61664; Define the sub-screen areas on the screen.

&#61664; Define suitable sub-screen areas.

&#61664; Include the sub-screen screen in the sub-screen area.

&#61664; Use unique names for the sub-screens.

Syntax for the flow logic of main screen:

The flow logic should be called both in the PBO and PAI of the main screen.

PROCESS BEFORE OUPTPUT.

CALL SUBSCREEN <area> INCLUDING [<prog>] <dynp>.

PROCESS AFTER INPUT.

CALL SUBSCREEN <area>.

Screen painter:

• Screen painter is a special tool provided by ABAP/4 development workbench which allows the user to create and maintain the GUI screens.

• SE51 is the transaction code to use the screen painter.

• Screen painter is available in two modes – Graphical & Alphanumeric mode.

• A screen is made up of different elements like text fields, input/output fields, checkboxes, pushbuttons, radio buttons, table controls, OK_CODE field etc.

<Note: OK_CODE is a 20 char field. A name has to be assigned to this field to use it for a particular screen>

• Each of these elements are associated with:

Attributes: They describe a screen and determine its behavior during run time. E.g., program, screen number, screen type, next screen, cursor position etc.

Field attributes: Describes an element.

Layout: It refers to the arrangement of the elements on the screen.

Flow logic: It is a series of instructions. It describes the relationship between a screen element and its application.

Menu painter:

• Menu painter is used to design the interface components.

• It can be accessed by double clicking the command in PBO module.

The menu painter contains the following components:

Status: Defines the combination of menu bars, menu lists, F-key settings and functions available to an interface.

Menu bars: Defines the functions available to the user.

Menu list: Lists the items in a specific menu. E.g., an edit menu may contain items like cut, copy and replace.

F-key settings: Defines keyboard keys associated with a particular interface function.

Functions: Defines individual functions such as cut, copy and replace.

Titles: Defines the window titles for an interface.

Includes:

In contrast to all other program types, include programs do not represent stand-alone compilation units with a memory area of their own. Include programs cannot be executed. They are used exclusively for modularizing ABAP source code and are included in other programs.

Includes contain PBO, PAI, Global data, Forms, etc.

Standard includes found in the module pool of any program are

• XXXXXF01 – contains the forms

• XXXXXI01 – contains the PAI

• XXXXXO01 – contains the PBO

• XXXXXTOP – contains the global data

Here XXXXX is the name of the dialog program.

Messages:

Messages are mostly used for error handling during processing of other user dialogs.

• Messages can be maintained in Transaction SE91. They are stored in the table T100.

• T100 has language key, twenty-character member class, message number and message text.

&#61664; Language key is supplied by the system according to the language environment of the system.

&#61664; Message classes assign messages to an application.

&#61664; Message numbers are used to identify the messages in the message class.

&#61664; When we call a message in ABAP, we need to specify the message class and the number.

• The processing of messages depends upon the message type and the program context in which it occurs.

• Prefix of the message specifies the message type e.g., I for information message.

• The different types of messages are:

&#61664; A: Termination – Terminates the program and displays the message on the screen.

&#61664; E: Error – Depending on the program context, an error dialog appears or the program terminates.

&#61664; I: Information – Displays a message on the screen. When the user confirms the message, the program continues immediately after the message statement.

&#61664; S: Status – It is same as the information message but displays the message on the next screen.

&#61664; W: Warning – Depending on the program context, an error dialog appears or the program terminates.

&#61664; X: Exit – No message is displayed. The program terminates with a short dump. This allows us to force the program termination.

• A message can be defined as

MESSAGE ixxx(abc).

Here xxx is the message number

abc is the message class.

Step loops:

• Step loops are screen elements which displays table-type data on a screen.

• They are repeated sequence of blocks of screen element. In a step loop, a number of screen elements are combined together to form a loop block.

• They do not have individual names.

• There are two types of step loops – Fixed size and Variable size.

• In the fixed size, the number of loop blocks is fixed whereas in the variable size the number of loop blocks will change dynamically as per the size of the screen.

• Step loops can be programmed using LOOP………….ENDLOOP.

Step loop creation:

Step loops can be created in the screen painter (SE51) as follows:

&#61664; Define the screen elements that will be part of the step loop. They may extend to more than one line.

&#61664; Select all the elements as one group.

&#61664; Go to edit menu and select Grouping &#61664; Step Loop &#61664; Define

&#61664; Define the step loop as variable or fixed by selecting

Edit &#61664; Grouping &#61664; Step Loops &#61664; Fix or Variable

&#61664; Then create the step loop program using LOOP……....ENDLOOP in both PBO and PAI, so that transfer of data can take place between screen and ABAP program.

Step loop program – Types:

1. LOOP

MODULE fill_data

ENDLOOP.

In this case, in PBO, a module should be called that will transfer the data to the screen fields. In PAI, the module call is not required. An empty LOOP…...ENDLOOP will be enough or we can call a module to write the data to an internal table. In this method there is no automatic scrolling, we have to program it in ABAP.

2. LOOP AT int_table[INTO wa][CURSOR line_number][FROM n1 to n2].

ENDLOOP.

In this case, in PBO, a module call is not required to fill the step loop screen fields since the data is copied to the work area wa and from there to screen fields in the step loop automatically. INTO wa is not required if we use the int_table declared with a header line. In PAI, the addition AT int_table is also required for automatic scrolling.

The parameter CURSOR line_number which is of TYPE I is used to specify the line number from which the data has to be displayed. FROM n1 TO n2 is used to restrict the starting line and ending line of the internal table.

Table controls:

Table controls and step loops are almost identical. In terms of usability by the end user, table controls are an improvement of step loops. Usage of table controls offers many added features compared to step loops like

&#61664; Scroll within a field

&#61664; Scroll through the table horizontally and vertically

&#61664; Select table rows or columns

&#61664; Make selective columns editable

Table control creation:

Table control is created in the screen painter (SE51) and a control variable of TYPE TABLEVIEW using CONTROLS statement is declared in the ABAP program. We have to use LOOP…...ENDLOOP statement in both PBO and PAI, with or without AT int_table parameter. If AT int_table parameter is not used then we have to place a MODULE call between the LOOP…...ENDLOOP statement to fill the screen table rows from the ABAP program in PBO and program our own scrolling functions using OK_CODE field.

ABAP declaration:

CONTROLS: tab_control TYPE TABLEVIEW USING SCREEN xxxx.

Here tab_control is the name of the table control used in the screen.

xxxx refers to the screen number.

This statement will declare a control variable that will be used to access the table control.

PBO processing:

In PBO, we have to use LOOP.....ENDLOOP statement, with or without internal table.

LOOP WITH CONTROL tab_control.

MODULE fill_tab_control.

ENDLOOP.

Here a module should be called between the loop…..endloop statement to transfer the data from the ABAP program to the screen table through a structure. This module should use the CURRENT_LINE attribute of the table control variable to get the current screen table record index to read the data from the internal table into a work area.

E.g., READ TABLE int_table INDEX tab_control-CURRENT_LINE.

The record read will be placed in the header line of the internal table and will be available to the similarly named screen fields or if these are different it can be written explicitly.

E.g., screen_field_name = int_table-field_name.

LOOP AT int_table INTO wa WITH CONTROL tab_control CURSOR line_number FROM n1 TO n2.

ENDLOOP.

Here the module call is not required to fill the screen table. The parameter CURSOR line_number is an integer of type I indicating which line in the internal table should be displayed first on the table control .FROM n1 TO n2 can be used to restrict the starting line and ending line number of the internal table.

PAI Processing:

To transfer the data from the table control to the ABAP program, we have to use LOOP……ENDLOOP.

If we have to do some changes to the data we should call a module between the LOOP…….... ENDLOOP. The MODULE call to process user commands (SY-UCOM) should be called after the ENDLOOP statement.

Procedure for creating a dialog program using SE80:

...

1. Start the objector navigator using the transaction code SE80.

2. In the navigation area, choose the object type Program and enter the name of the program in the input field below. Confirm with Enter. If the program does not exist, the system displays a dialog that allows us to create a program.

3. A Create Program dialog box appears, which asks for the creation of a top include. Say continue.

4. A dialog box appears in which we should enter a name for the TOP include.

5. Choose Enter to continue.

6. A dialog box appears in which we can set other program attributes.

7. Enter the program attributes and choose Save. The system displays the Create Object Catalog Entry dialog box.

8. Assign a package to the program.

9. Choose Save to confirm the entries.

The program is added to the object list of the assigned package and is displayed under the Programs object node. The system starts the ABAP Editor and the program is displayed in change mode.

<< Note: We can also create a program from the initial screen of the ABAP Editor (Transaction SE38) >>

10. Right click on the program name and create the PBO, PAI and form objects.

11. Right click on the program name, say create &#61664; screen. A dialog box appears. Enter the screen number and say continue.

12. Click on layout. Design the layout of the screen with the required elements and define its attributes.

13. Create the GUI status and GUI title for the screen created by right clicking on the program name and say create &#61664; GUI status and create &#61664; GUI title respectively.

14. Click on the flow logic tab in the screen and define the flow logic for the screen created.

15. Repeat the steps from 11 - 14 to create other required screens.

16. Create the transaction codes by clicking on the program name and say create &#61664; transaction.

17. Say Enter.

18. Then Create Dialog transaction screen appears. In that specify the program name and the initial screen number.

19. Say Save.

20. Activate the entire program.

Now the dialog program can be executed using the transaction code.

Summary:

In this document, we have focused on the concept of dialog programming, its purpose, components and the step-by-step creation of the same in detail with suitable examples.