Screen 20painter

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

Kavitha.A.

DAY-4 CONTENTS

SCREEN PAINTER

¾ Introduction to Dialog Programming

¾ Transactions

• Screens (dynpros)
• ABAP/4 module pool
• Transferring Field Data
• Field Attributes
• Error Dialogs
• Data Consistency
• Dynpro
• Layout

¾ Exercise

TABLE CONTROL

¾ Functional scope

¾ Programming

¾ Attributes

¾ EXERCISE

TABSTRIP CONTROLS

¾ Defining the Tabstrip Control Area and Tab Titles

¾ Assigning a Subscreen Area to a Tab Title

¾ Paging in the SAPgui

¾ Programming the Flow Logic

¾ EXERCISE
Kavitha.A.S

SCREEN WITH FIELDS

Introduction to Dialog Programming


Transactions
A transaction is a program that conducts a dialog with the user. In a typical dialog, the
system displays a screen on which the user can enter or request information. As a reaction on
the the user input or request, the program executes the appropriate actions: it branches to the
next screen, displays an output, or changes the database.

Example
A travel agent wants to book a flight. The agent enters the corresponding data on the
screen. The system either confirms the desired request, that is, the agent can book the flight
and the customer travels on the desired day on the reserved seat to the chosen destination,
or the system displays the information that the flight is already booked up.

To fulfil such requirements, a dialog program must offer:


a user-friendly user interface
format and consistency checks for the data entered by the user
easy correction of input errors
access to data by storing it in the database.

ABAP/4 offers a variety of tools and language elements to meet the requirements stated
above in the dialog programs.

Structure of a Dialog Program

A dialog program consists of the following basic components:


Kavitha.A.S

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 to store menus, icons, pushbuttons, and function keys in one or more GUI
statuses. Dynpros and GUI statuses refer to the ABAP/4 program that control the sequence of the
dynpros and GUI statuses at runtime.

ABAP/4 module pool


Each dynpro refers to exactly one ABAP/4 dialog program. Such a dialog program is also
called a module pool, since it consists of interactive modules. The flow logic of a dynpro contains
calls of modules from the corresponding module pool. Interactive modules called at the PBO
event are used to prepare the screen template in accordance to the context, for example by setting
field contents or by suppressing fields from the display that are not needed. Interactive modules
called at the PAI event are used to check the user input and to trigger appropriate dialog steps,
such as the update task.
All dynpros to be called from within one transaction refer to a common module pool. The
dynpros of a module pool are numbered. By default, the system stores for each dynpro the dynpro
to be displayed next. This dynpro sequence or chain can be linear as well as cyclic. From within a
dynpro chain, you can even call another dynpro chain and, after processing it, return to the
original chain.

Transferring Field Data


How do I display fields known in an ABAP/4 module on the screen? How do I transfer
user entries on the screen to the module? In contrast to report programming, you cannot write
field data to the screen using the WRITE statement. The system instead transfers data by
comparing screen field names with ABAP/4 variable names. If both names are the same, it
transfers screen field values to ABAP/4 program fields and vice versa. This happens immediately
before and immediately after displaying the screen.

Field Attributes
For all screen fields of a dynpro, field attributes are defined in the Screen Painter. If a
field name in the screen corresponds to the name of an ABAP/4 Dictionary field, the system
automatically establishes a reference between these two fields. Thus, a large number of field
attributes in the dynpro is automatically copied from the ABAP/4 Dictionary. The field attributes
together with data element and domain of the assigned Dictionary field form the basis for the
standard functions the dynpro executes in a dialog (automatic format check for screen fields,
automatic value range check, online help, and so on).

Error Dialogs
Another task of the dynpro processor is to conduct error dialogs. Checking the input data
is carried out either automatically using check tables of the ABAP/4 Dictionary or by the
ABAP/4 program itself. The dynpro processor includes the error message into the received screen
and returns the screen to the user. The message may be context-sensitive, that is, the system
replaces placeholders in the message text with current field contents. In addition, only fields
whose contents is related to the error and for which a correction may solve the error can accept
input.
Kavitha.A.S

Data Consistency
To keep data consistent within complex applications, ABAP/4 offers techniques for
optimizing database updates that operate independent of the underlying database and correspond
to the special requests of dialog programming. For more information on database updates, see
Programming Database Updates.

Dynpro
Each screen contains fields used to display or request information. Fields can be text strings,
input or output fields, radio buttons, checkboxes, or pushbuttons. The screen of Transaction TZ10
contains only texts and input/output fields.

An SAP dynpro consists of several components:


• Flow logic: Calls of the ABAP/4 modules for a screen.
• Screen layout: Positions of the texts, fields, pushbuttons, and so on for a screen.
• Screen attributes: Number of the screen, number of the subsequent screen, and others.

• Field attributes: Definition of the attributes of the individual fields on a screen.

SCREEN PAINTER

You create and edit all components of a dynpro in the Screen Painter. To call the Screen
Painter, create a dynpro in the Object Browser or double-click on an existing dynpro. The Object
Browser then calls the Screen Painter. There, you can enter the flow logic of the new dynpro. By
pressing the corresponding pushbutton you can maintain the Screen attributes, branch to the Full
Screen-Editor or you choose the pushbutton Field list and change the attributes of fields.

Screen Attributes
From the user’s point of view, a transaction is a sequence of screens, displayed one after
another. How do I determine this sequence? The transactions’s attributes determine the first
screen to be displayed. The attributes of the individual dynpros determine which screen to display
Kavitha.A.S

after the current screen. You can also set the number of the subsequent screen dynamically from
within the ABAP/4 program.

Layout
Choose Fullscreen to go to the screen editor. Here you can determine the layout of the
screen. For Transaction TZ10, the desired fields can be copied from Table SPFLI of the
ABAP/4 Dictionary.

Field Attributes
To display and modify the attributes of the individual fields (input/output fields, input
required, possible entries button, invisible, and so on), use the Field list.The fields Company
(SPFLI-CARRID) and Flight number (SPFLI-CONNID) are defined as input/output fields. All
other fields are used only for outputting the flight data.

Flow Logic
The flow control code of a dynpro consists of a few statements that syntactically
ressemble ABAP/4 statements. However, you cannot use flow contol keywords in ABAP/4 and
vice versa. You enter the flow control code in the Screen Painter as one component of the dynpro.
The flow control for the dynpro of Transaction TZ10 looks like this:

PROCESS BEFORE OUTPUT.


MODULE SET_STATUS_0100.
*
PROCESS AFTER INPUT
MODULE USER_COMMAND_0100.

The PROCESS statement names the event type for the dynpro and the MODULE
statement tells the system which ABAP/4 routine to call for this event. In this example, there is
only one MODULE for each event PBO and PAI. However, an event can contain several
statements with several keywords. (The flow control language contains only few statement types.
The most important are MODULE, FIELD, CHAIN, LOOP, CALL SUBSCREEN.) To display
information on the statement syntax in the flow logic, choose Utilities Help on... in the flow logic
editor. In the subsequent dialog window, mark Flow logickeyword, enter the name of the desired
keyword, and press ENTER.

ABAP/4 Module Pool


In the Object Browser, the module pool code belongs to one of the following categories:
• Global fields: data declarations that can be used by all modules in the module pool
• PBO modules: modules that are called before displaying the screen
• PAI modules: modules that are called in response to the user input
• Subroutines: subroutines that can be called from any position within the module pool.

You use the ABAP/4 Dictionary to store frequently used data declarations centrally. Objects
defined in the Dictionary are known throughout the system. Active Dictionary definitions can be
accessed by any application. Data defined in the Dictionary can be included in a screen or used by
an ABAP/4 program. You declare global data in the TOP module of the transaction, using the
TABLES, STRUCTURE, LIKE statements and others. Transaction TZ10 accesses the Dictionary
definition of Table SPFLI to provide the desired flight data display. If the TOP include contains
the TABLES: SPFLI declaration, all modules in the module pool can access the table fields of
Kavitha.A.S

Table SPFLI. The PAI module USER_COMMAND_0100 checks which pushbutton the user
activated (CASE OK_CODE). The Display pushbutton in Transaction TZ10 has the function code
‘SHOW’. (For more information on handling function codes, see Processing User Requests). The
program then tries to select those records in the SPFLI database that correspond to the data the
user entered. The WHERE condition determines matching records by comparing the fields
SPFLI-CARRID and SPFLI-CONNID with the database key fields CARRID and CONNID. As
soon as a matching record is found, the database transfers all accompanying SPFLI fields to the
program table.
When the screen is displayed again, the complete information appears in the output fields
of the screen. The system automatically displays these fields, since the ABAP/4 field names
SPFLI-CARRID and SPFLI-CONNID are the same as the screen field names.

In the PBO module STATUS_0100 of Transaction TZ10, the screen 100 receives a GUI status
(using SET PF-STATUS) and a GUI title (using SET TITLEBAR):

SET PF-STATUS ‘TZ0100’.


SET TITLEBAR ‘100’.

A GUI status is a subset of the interface elements used for a certain screen. The status
Comprise those elements that are currently needed by the transaction. The GUI status for a
transaction may be composed of the following elements:

The GUI title is the screen title displayed in the title bar of the window. In contrast to the
GUI status that can be used for several screens, a GUI title belongs to one screen.To create and
edit GUI status and GUI title, you use the Menu Painter. To start the Menu Painter, create a GUI
status or GUI title in an object list in the Object Browser (or double-click on an existing status or
title).

Interaction between Dynpro and ABAP/4 Module Pool


In its most simple form, a transaction is a collection of screens and ABAP/4 routines, controlled
and executed by a dialog processor. The dialog processor processes screen after screen, thereby
triggering the appropriate ABAP/4 processing for each screen. For each screen, the system
executes the flow logic that contains the corresponding ABAP/4 processing. The control passes
from screen flow logic to ABAP/4 code and back.
The sequence of events for Transaction TZ10, for example, looks like this:
Kavitha.A.S

1. In the PBO event, the statement MODULE STATUS_0100 passes control to the corresponding
ABAP/4 module.In the ABAP/4 module pool, the screen to be displayed receives a menu
interface.

2. After processing the module STATUS_0100, control returns to the flow logic.For the PBO
event, no further processing is required. The system display the screen and receives entries
from the user. The entries are:
– the values for the fields Company and Flight number.
– the four-character function code that tells which pushbutton the user activated.

3. The user input triggers the PAI event. The first PAI statement passes control to the ABAP/4
module USER_COMMAND_0100.Module USER_COMMAND_0100 processes the
requests of the user.

4. After processing MODULE USER_COMMAND_0100, control returns to PAI. This terminates


the dialog.
Kavitha.A.S

EXERCISE

Goto to ABAP editor, and enter the program name ZKA_SCREEN.

Declare the tables and call the screen.

In order to create the object, double click on the screen no, you will automatically guided
to the screen painter SE51.
Kavitha.A.S

Enter the short description and click on the FLOW LOGIC tab.

Uncomment the flow logic, both PAI and PBO.


Kavitha.A.S

Now click on the LAYOUT button.

Click on the DICTIONARY/PROGRAM FIELDS WINDOW F6 button. Type in the table


name and click on GET FROM DIC button and select the fields required for the screen
and click on the COPY button.
Kavitha.A.S

Now drag and place the INPUT/OUTPUT fields box on the screen.

Now click on the TEXT FIELD button and place in the screen and stretch the
box for the size required. Now double click on the box, U will get the attributes screen.
Enter the name and Text for the field.
Kavitha.A.S

Now we need to place the bush buttons. So Click on the push button on the left
side and place it on the screen. Double click on it, u will get the attributes screen. Enter
the name, text and the icon required and mainly the FCTCODE. It is the one which links
the screen painter with the code.

Once everything is set up, SAVE, CHECK and ACTIVATE the screen.
Kavitha.A.S

Click on the BACK button. U will be guided to the FLOW LOGIC screen.

Double click on PAI, Because for the screen painter with the fields, Process After the
Input is done and so u will guided to the Editor screen.
Kavitha.A.S

Now we need to set the System-Uses commands which links the code to the Editor.
So the conditions would be:

IF SY-UCOMM = 'DISPLAY'.
SELECT SINGLE * FROM ZKA_CENTER WHERE CENTERNO = ZKA_CENTER-CENTERNO.
ELSEIF SY-UCOMM ='SAVE'.
INSERT ZKA_CENTER.
ELSEIF SY-UCOMM = 'REFRESH'.
CLEAR ZKA_CENTER.
ELSEIF SY-UCOMM = 'GOTO'.
LEAVE TO SCREEN '0002'.
ELSEIF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.

If u create many screens and need links between the screens then u can use ‘GOTO’ to
guide to the other screen.

SAVE, CHECK and ACTIVATE and click on TEST.


Kavitha.A.S

Now click on the DISPLAY button.

Also verify with SAVE, REFRESH and EXIT buttons. Thus the screen painter.
Kavitha.A.S

TABLE CONTROL
Basic form
CONTROLS ctrl TYPE TABLEVIEW USING SCREEN scr.
Effect
Creates a table control ctrl of the type TABLEVIEW . The reference screen for the initialization
is the screen scr .

Area of use

The table control (referred to here as TC ) facilitates the display and entry of one-line, tabular
data in dialog transactions. The functional scope has been defined so that you can implement
many typical set operations usually handled by an elementary STEP-LOOP with the standard
methods of a TC .

Functional scope

• Resizeable table grid for displaying and editing data.


• Column width and column position modifiable by user and by program.
• Storing and loading of user-specific column layout.
• Selection column for line selection with color selection display.
• Variable column headers as pushbuttons for column selection.
• Simple selection, multiple selection, Select/deselect all.
• Scrolling functions (horizontal and vertical) via scroll bar.
• Fixing of any number of key columns.
• Setting attributes for each cell at runtime.

Programming

The data exchange between the application and the SAPgui is achieved with a STEP-LOOP , i.e.
an ABAP/4 module is called to transfer data for each page.
Example
Processing without an internal table

PROCESS BEFORE OUTPUT.


LOOP WITH CONTROL ctrl.
MODULE ctrl_pbo.
ENDLOOP.

PROCESS AFTER INPUT.


LOOP WITH CONTROL ctrl.
MODULE ctrl_pai.
ENDLOOP.

In this case, the module ctrl_pbo OUTPUT is called once for each output line before the screen is
displayed, in order to fill the output fields. After the user has entered data on the screen, the
module ctrl_pai INPUT is executed to check the input and copy the new contents.
Example
Processing with an internal table
Kavitha.A.S

PROCESS BEFORE OUTPUT.


LOOP AT itab WITH CONTROL ctrl CURSOR ctrl-CURRENT_LINE.
ENDLOOP.

PROCESS AFTER INPUT.


LOOP AT itab WITH CONTROL ctrl.
MODULE ctrl_pai.
ENDLOOP.

Here, the system fills the output fields before displaying the screen by reading the internal table
itab. When the user has entered data, the module ctrl_pai INPUT must be executed to check the
input and to refresh the contents of the internal table. Vertical scrolling with the scroll bar is
followed by the event PAI for the displayed page. Then, cntl-TOP_LINE is increased and PBO is
processed for the next page. Program-driven scrolling and the most of the functionality described
above is achieved by manipulating the control attributes.

Attributes

The CONTROLS statement creates a complex data object of the type CXTAB_CONTROL with
the name of the control.

You maintain the initial values in the Screen Painter and assign the screen with the initial values
for a control using the addition USING SCREEN .

Initialization is achieved automatically in the "1st access to the control" (setting or reading
values).

You can use the customizing button (in the top right corner) to save the current setting (column
widths and column positions) and use it as the initial value for the next call.

All the initial values can be overwritten by the program using the MOVE ... TO TC attributes
statement.

EXERCISE

Enter the Editor with SE38.

Declare the Tables and an internal table.

Then use the CONTROLS statement to have the controls for the Table control.
Kavitha.A.S

CONTROLS: <var> TYPE TABLEVIEW USING SCREEN '<screenno>'.

Now call the screen with the CALL SCREEN statement. Click on the screen to draw the table.
Fill in the attributes screen with the short description and click on the LAYOUT button.

Now click on the TABLE CONTROL button and draw the table to the size required. Double
click on the table and enter the Attributes giving the Table-control name.

And select the check boxes for the vertical & horizontal resizing and separators.

Click on the DICTIONARY/PROGRAM FIELDS WINDOW F6 button. Type in the table


name and click on GET FROM PROGRAM button and select the fields required for the
screen and click on the COPY button.
Kavitha.A.S

Enter the header with the TEXT FIELDS button by double clicking on the TEXT
FIELD and fill in the ATTRIBUTES button with the name and text.
Kavitha.A.S

SAVE, CHECK & ACTIVATE.

Click the BACK button and go the FLOW LOGIC screen.


Kavitha.A.S

REPORT ZKA_TC .

TABLES: ZKA_EMP.

DATA: ITAB LIKE ZKA_EMP OCCURS 0 WITH HEADER LINE.

CONTROLS: TC TYPE TABLEVIEW USING SCREEN '0001'.

CALL SCREEN '0001'.


*&---------------------------------------------------------------------*
*& Module STATUS_0001 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0001 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

SELECT * FROM ZKA_EMP INTO TABLE ITAB.

ENDMODULE. " STATUS_0001 OUTPUT


*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0001 INPUT
Kavitha.A.S

*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0001 INPUT.

IF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.

ENDMODULE. " USER_COMMAND_0001 INPUT


Kavitha.A.S

TABSTRIP CONTROLS

A tabstrip control is a screen object consisting of two or more pages. Each tab
page consists of a tab title and a page area. If the area occupied by the tabstrip control is
too narrow to display all of the tab titles, a scrollbar appears, allowing you to reach the
titles that are not displayed. There is also a pushbutton that allows you to display a list of
all tab titles.

Tabstrip controls allow you to place a series of screens belonging to an application on a


single screen, and to navigate between them easily. The recommended uses and
ergonomic considerations for tabstrip controls are described in the Tabstrip Control
section of the SAP Style Guide.
From a technical point of view, a tab page is a subscreen with a pushbutton assigned to it,
which is displayed as the tab title.

The tabstrip control is the set of all the tab pages. Tabstrip controls are therefore subject
to the same restrictions as subscreens. In particular, you cannot change the GUI status
Kavitha.A.S

when you switch between pages in the tabstrip control. However, they are fully integrated
into the screen environment, so present no problems with batch input.
To use a tabstrip control on a screen, you must be using a SAPgui with Release
4.0 or higher, and its operating system must be Motif, Windows 95, MacOS, or Windows
NT with version 3.51 or higher.

When you create a tabstrip control, you must:


• Define the tab area on a screen and the tab titles.
• Assign a subscreen area to each tab title.
• Program the screen flow logic.
• Program the ABAP processing logic.

You must then decide whether you want to page through the tabstrip control at the
SAPgui or on the application server. In the first case, each tab page has its own
subscreen. In the second, there is a single subscreen area that is shared by all tab pages.

Defining the Tabstrip Control Area and Tab Titles

You define both the tabstrip area and the tab titles in the screen layout. The
tabstrip area has a unique name and a position, length, and height. You can also specify
whether the tabstrip area can be resized vertically or horizontally when the user resizes
the window. If the area supports resizing, you can specify a minimum size for it.

When you define a tabstrip area, it already has two tab titles. Tab titles are
technically exactly the same as pushbuttons. To create additional tab titles, simple create
pushbuttons in the row containing the tab titles. Tab titles have the same attributes as
pushbuttons, that is, each has a name, a text, and a function code. You can also use icons
and dynamic texts with tab titles.

Assigning a Subscreen Area to a Tab Title


You must assign a subscreen area to each tab title. There are two ways of doing this:

Paging in the SAPgui

You need to assign a separate subscreen area to each tab title, and define the
function codes of the tab titles with type P (local GUI function). In the screen flow logic,
you call all the subscreens in the PBO event. This means that all of the tab pages reside
locally on the SAPgui.
When the user chooses a tab title, paging takes place within the SAPgui. In this
respect, the tabstrip control behaves like a single screen. In particular, the PAI event is
not triggered when the user chooses a tab title, and no data is transported. While this
improves the performance of your tabstrip control, it also has the negative effect that
when the user does trigger the PAI event, all of the input checks for all of the subscreens
are performed. This means that when the user is working on one tab page, the input
checks may jump to an unfilled mandatory field on another page.
Kavitha.A.S

Local paging at the SAPgui is therefore most appropriate for screens that display data rather than
for input screens.

Paging on the Application Server

One subscreen area is shared by all tab titles and called in the PBO event. You
define the function codes of the individual tab titles without a special function type.
When the user chooses a tab page, the PAI event is triggered, and you must include a
module in your flow logic that activates the appropriate tab page and assigns the correct
subscreen to the subscreen area.
Since the PAI event is triggered each time the user chooses a tab title, this method
is less economical for the application server, but the input checks that are performed only
affect the current tab page.

Procedure in Either Case

You create the subscreen areas within the tabstrip area. You assign the subscreen
areas to one or more tab titles in the Screen Painter by selecting one or more titles. You
can also assign a subscreen area to a tab title in the tab title attributes by entering the
name of the subscreen area in the Reference field attribute.

The procedure for the alphanumeric Screen Painter is described under Creating
Tabstrip Controls.

If you are paging at the SAPgui, create a subscreen area for each tab title. If you
are paging at the application server, select all tab titles and create a single subscreen area.
The subscreen areas may not cover the top line of the tab area. However, within a tab
area, more than one subscreen area can overlap.

Programming the Flow Logic

In the flow logic, all you have to do by hand is include the correct subscreens. The
screen flow and data transport to the ABAP program is the same as for normal
subscreens. There are two ways of programming the screen flow logic, depending on how
you have decided to page through the tabstrip control.

Paging in the SAPgui

When you page in the SAPgui, you must include a subscreen for each subscreen area:

PROCESS BEFORE OUTPUT.


...
CALL SUBSCREEN: <area1> INCLUDING [<prog 1>] <dynp 1>,
<area2> INCLUDING [<prog 2>] <dynp 2>,
<area3> INCLUDING [<prog 3>] <dynp 3>,
...
...
Kavitha.A.S

PROCESS AFTER INPUT.


...
CALL SUBSCREEN: <area1>,
<area2>,
<area3>,
...
...

Paging on the Application Server

When you page on the application server, you only have to include a subscreen for the one
subscreen area:

PROCESS BEFORE OUTPUT.


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

PROCESS AFTER INPUT.


...
CALL SUBSCREEN <area>.
...

Handling in the ABAP Program

Before you can use a tabstrip control in your ABAP program, you must create a
control for each control in the declaration part of your program using the following
statement:

CONTROLS <ctrl> TYPE TABSTRIP.


where <ctrl> is the name of the tabstrip area on a screen in the ABAP program.
The control allows the ABAP program to work with the tabstrip control. The statement
declares a structure with the name <ctrl> . The only component of this structure that you
need in your program is called ACTIVETAB.

Use in the PBO event

Before the screen is displayed, you use the control to set the tab page that is
currently active. To do this, assign the function code of the corresponding tab title to the
component ACTIVETAB:

<ctrl>-ACTIVETAB = <fcode>.

When you page at the SAPgui, you only need to do this once before the screen is
displayed. This initializes the tabstrip control. The default active tab page is the first
page. After this, the page activated when the user chooses a tab title is set within SAPgui.
When you page on the application server, you must assign the active page both before the
screen is displayed for the first time, and each time the user pages. At the same time,
you must set the required subscreen screen.
Kavitha.A.S

You can suppress a tab page dynamically by setting the ACTIVE field of table
SCREEN to 0 for the corresponding tab title.

Use in the PAI event

In the PAI event, ACTIVETAB contains the function code of the last active tab
title on the screen. When you page in the SAPgui, this allows you to find out the page
that the user can currently see. When you page at the application server, the active tab
page is controlled by the ABAP program anyway. The OK_CODE field behaves
differently according to the paging method:
Paging in the SAPgui
When you page in the SAPgui, the PAI event is not triggered when the user
chooses a tab title, and the OK_CODE field is not filled. The OK_CODE field is only
filled by user actions in the GUI status or when the user chooses a pushbutton either
outside the tabstrip control or on one of the subscreens.

Paging on the application server


If you are paging at the application server, the PAI event is triggered when the
user chooses a tab title, and the OK_CODE field is filled with the corresponding function
code. To page through the tabstrip control, you must assign the function code to the
ACTIVETAB component of the control:

<ctrl>-ACTIVETAB = <ok_code>.

This statement overwrites the function code of the last active tab page with that of
the new tab title. At the same time, you must ensure that the correct subscreen is inserted
in the subscreen area. Otherwise, tabstrip controls are handled like normal subscrens in
ABAP programs, that is, the ABAP program of a subscreen screen must contain the
dialog modules called from the flow logic of the subscreen.
Kavitha.A.S

EXERCISE
Goto SE38. Enter the tabstrip program name Eg: ZKA_TABSTRIP and click on the
create button.

First we need to declare the tables.

Then use the controls for the tabstrip.

Syntax: <ctrl-name> TYPE TASTRIP.

Now call the screen. Using CALL SCREEN statement.

Double click on the screen no to draw the screen for tabstrip control.

Now uncomment the FLOW LOGIC and click on the LAYOUT.


Kavitha.A.S

The flow logic for the tabstrip would be as follows.

PBO:
The PBO is initiated so that the subscreen for the corresponding tab can be maintained.

Syntax:
CALL SUBSCREEEN <sub-screen name> INCLUDING SY-REPID <screen-var>.

PAI:
When the tab is clicked, the corresponding subscren should open

Syntax:
CALL SUBSCREEN <subscreen>.
Kavitha.A.S

DRAWING THE TABSTRIP CONTROL:

Click on the TABSTRIP button and place it on the screen for the required size.

Double click on the control and give the name for the tabstrip control in the
ATTRIBUTES screen.

Now double click on the tab and fill in the attributes screen for the name and the text.

Also draw the subscreen in one of the tab and refer the same subscreen in the rest of the
tabs.
Kavitha.A.S

Now in the sub-screens, we need to get the screen for the tabs.

So call an other screen and draw with fields and pushbuttons to perform actions very
similar like SCREEN WITH FIELDS (refer screen painter).

Enter the short description and click on the FLOW LOGIC tab.
Kavitha.A.S

Uncomment the flow logic, both PAI and PBO.

Now click on the LAYOUT button.


Kavitha.A.S

Click on the DICTIONARY/PROGRAM FIELDS WINDOW F6 button. Type in the table


name and click on GET FROM DIC button and select the fields required for the screen
and click on the COPY button.

Now drag and place the INPUT/OUTPUT fields box on the screen.
Kavitha.A.S

Now click on the TEXT FIELD button and place in the screen and stretch the
box for the size required. Now double click on the box, U will get the attributes screen.
Enter the name and Text for the field.

Now we need to place the bush buttons. So Click on the push button on the left
side and place it on the screen. Double click on it, u will get the attributes screen. Enter
the name, text and the icon required and mainly the FCTCODE. It is the one which links
the screen painter with the code.
Kavitha.A.S

Once everything is set up, SAVE, CHECK and ACTIVATE the screen.
Kavitha.A.S

Click on the BACK button. U will be guided to the FLOW LOGIC screen.

Double click on PAI, Because for the screen painter with the fields, Process After the
Input is done and so u will guided to the Editor screen.
Kavitha.A.S

Now we need to set the System-Uses commands which links the code to the Editor.
So the conditions would be:

IF SY-UCOMM = 'DISPLAY'.
SELECT SINGLE * FROM ZKA_CENTER WHERE CENTERNO = ZKA_CENTER-CENTERNO.
ELSEIF SY-UCOMM ='SAVE'.
INSERT ZKA_CENTER.
ELSEIF SY-UCOMM = 'REFRESH'.
CLEAR ZKA_CENTER.
ELSEIF SY-UCOMM = 'GOTO'.
LEAVE TO SCREEN '0002'.
ELSEIF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.

The same procedure for the company table as well will lead the screen in the below
manner.
Kavitha.A.S

Summary:

REPORT ZKA_TABSTRIP .

TABLES: ZKA_EMP,ZKA_COM.

CONTROLS: TS TYPE TABSTRIP..


DATA: SCREENNO(4) TYPE N.

CALL SCREEN '0003'.


*&---------------------------------------------------------------------*
*& Module STATUS_0001 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0001 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.

IF SCREENNO IS INITIAL.
TS-ACTIVETAB = 'EMP'.
SCREENNO = '0002'.
ENDIF.

ENDMODULE. " STATUS_0001 OUTPUT


*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0001 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0001 INPUT.

IF SY-UCOMM = 'EMP'.
TS-ACTIVETAB = 'EMP'.
SCREENNO = '0002'.
ELSEIF SY-UCOMM = 'COM'.
TS-ACTIVETAB = 'COM'.
SCREENNO = '0003'.
ENDIF.

ENDMODULE. " USER_COMMAND_0001 INPUT


*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0002 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0002 INPUT.

IF SY-UCOMM = 'DISPLAY'.
SELECT SINGLE * FROM ZKA_EMP WHERE EMPNO = ZKA_EMP-EMPNO.
ELSEIF SY-UCOMM = 'SAVE'.
INSERT ZKA_EMP.
ELSEIF SY-UCOMM = 'REFRESH'.
CLEAR ZKA_EMP.
ELSEIF SY-UCOMM = 'EXIT'.
LEAVE PROGRAM.
ENDIF.
Kavitha.A.S

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy