Entering content frameTabstrip Controls Locate the document in its SAP Library structure

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.

This graphic is explained in the accompanying text

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.

This graphic is explained in the accompanying text

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 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:

  1. Define the tab area on a screen and the tab titles.
  2. Assign a subscreen area to each tab title.
  3. Program the screen flow logic.
  4. 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.

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 Structure link 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>,
                  ...
  ...

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.

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.

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

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:

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.

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.

Examples

Example

Tabstrip control, paging at SAPgui

REPORT DEMO_DYNPRO_TABSTRIP_LOCAL.

CONTROLS MYTABSTRIP TYPE TABSTRIP.

DATA: OK_CODE TYPE SY-UCOMM,
      SAVE_OK TYPE SY-UCOMM.

MYTABSTRIP-ACTIVETAB = 'PUSH2'.

CALL SCREEN 100.

MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE CANCEL INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE USER_COMMAND INPUT.
  SAVE_OK = OK_CODE.
  CLEAR OK_CODE.
  IF SAVE_OK = 'OK'.
    MESSAGE I888(SABAPDOCU) WITH 'MYTABSTRIP-ACTIVETAB ='
                                  MYTABSTRIP-ACTIVETAB.
  ENDIF.
ENDMODULE.

The next screen (statically defined) for screen 100 is itself. It has the following layout:

This graphic is explained in the accompanying text

The screen contains a tabstrip area called MYTABSTRIP with three tab titles PUSH1, PUSH2 and PUSH3. The function codes have the same name, and all have the function type P. One of the subscreen areas SUB1 to SUB3 is assigned to each tab title. The pushbutton has the name BUTTON and the function code ‘OK’.

In the same ABAP program, there are three subscreen screens 110 to 130. Each of these fits the subscreen area exactly. The layout is:

This graphic is explained in the accompanying text

The screen flow logic for screen 100 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  CALL SUBSCREEN: SUB1 INCLUDING SY-REPID '0110',
                  SUB2 INCLUDING SY-REPID '0120',
                  SUB3 INCLUDING SY-REPID '0130'.

PROCESS AFTER INPUT.
  MODULE CANCEL AT EXIT-COMMAND.
  CALL SUBSCREEN: SUB1,
                  SUB2,
                  SUB3.
  MODULE USER_COMMAND.

The screen flow logic of subscreens 110 to 130 does not contain any module calls.

When you run the program, a screen appears on which the second tab page is active, since the program sets the ACTIVETAB component of the structure MYTABSTRIP to PUSH2 before the screen is displayed. The user can page through the tabstrip control without the PAI event being triggered. One of the three subscreens is included on each tab page.

When the user chooses Continue, the PAI event is triggered, and an information message displays the function code of the tab title of the page that is currently active.

Example

Tabstrip control with paging on the application server.

REPORT DEMO_DYNPRO_TABSTRIP_LOCAL.

CONTROLS MYTABSTRIP TYPE TABSTRIP.

DATA: OK_CODE TYPE SY-UCOMM,
      SAVE_OK TYPE SY-UCOMM.

DATA  NUMBER TYPE SY-DYNNR.

MYTABSTRIP-ACTIVETAB = 'PUSH2'.
NUMBER = '0120'.

CALL SCREEN 100.

MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE CANCEL INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE USER_COMMAND INPUT.
  SAVE_OK = OK_CODE.
  CLEAR OK_CODE.
  IF SAVE_OK = 'OK'.
    MESSAGE I888(SABAPDOCU) WITH 'MYTABSTRIP-ACTIVETAB ='
                                  MYTABSTRIP-ACTIVETAB.
  ELSE.
    MYTABSTRIP-ACTIVETAB = SAVE_OK.
    CASE SAVE_OK.
      WHEN 'PUSH1'.
        NUMBER = '0110'.
      WHEN 'PUSH2'.
        NUMBER = '0120'.
      WHEN 'PUSH3'.
        NUMBER = '0130'.
    ENDCASE.
  ENDIF.
ENDMODULE.

The statically-defined next screen for screen 100 is itself, and its layout is the same as in the above example. However, the function codes of the three tab titles have the function type <blank> and they all share a single subscreen area SUB.

The same subscreen screens 110 to 130 are defined as in the last example.

The screen flow logic for screen 100 is as follows:

PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.
  CALL SUBSCREEN SUB INCLUDING SY-REPID NUMBER.

PROCESS AFTER INPUT.
  MODULE CANCEL AT EXIT-COMMAND.
  CALL SUBSCREEN SUB.
  MODULE USER_COMMAND.

In this example, the program includes a subscreen screen in the subscreen area SUB dynamically during the PBO event.

The screen flow logic of subscreens 110 to 130 does not contain any module calls.

This example has the same function as the previous example, but the paging within the tabstrip control is implemented on the application server. Each time the user chooses a tab title, the function code from the OK_CODE field is assigned to the ACTIVETAB component of structure MYTABSTRIP. At the same time, the variable NUMBER is filled with the screen number of the subscreen that has to be displayed in the subscreen area SUB of the tabstrip control.

 

 

 

 

Leaving content frame