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

How to handle tabstrip control ?

Former Member
0 Kudos

How to handle tabstrip control in screen programming?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

1.First create a screen (2000) in module pool program.

2.in layout option select tabstrip and give a name.

3.select the subscreen and paste it in any one tab for dynamic call , name the subscreen.

4.now create two screens(2100 ,2200) , with screen type as subscreen.

5. in 2100 layout and 2200 layout place ur requirements and continue

Example code.

in PBO of 2000 write this code.

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_2000.

CALL SUBSCREEN SUB INCLUDING SY-REPID DNR.

*

PROCESS AFTER INPUT.

CALL SUBSCREEN SUB.

MODULE USER_COMMAND_2000.

main prgram

ROGRAM ZSCREENSAMPLE .

CONTROLS MYTAB TYPE TABSTRIP. "tabstrip name

DATA : EXIT1, EXIT2.

DATA : DNR TYPE SY-DYNNR.

MYTAB-ACTIVETAB = 'TAB1'.

DNR = '2100'.

CALL SCREEN 2000.

MODULE USER_COMMAND_2000 INPUT.

CASE SY-UCOMM.

WHEN 'TAB1'.

MYTAB-ACTIVETAB = 'TAB1'.

DNR = '2100'.

WHEN 'TAB2'.

MYTAB-ACTIVETAB = 'TAB2'.

DNR = '2200'.

ENDCASE.

ENDMODULE.

&----


*& Module USER_COMMAND_2100 INPUT

&----


  • text

----


MODULE USER_COMMAND_2100 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT1'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_2100 INPUT

&----


*& Module USER_COMMAND_2200 INPUT

&----


  • text

----


MODULE USER_COMMAND_2200 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT2'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_2200 INPUT

6 REPLIES 6

Former Member
0 Kudos

navigations to create MPP with table control:

1). create MPP and create a screen 100.

2). Using tool box add a tabstrip control into screen. name the tabstrip control as 'tbstr'. set number of tab titles as ur requirement ( default is 2).

3). add subscreen area from the tool box into the tabstrip control.

Set all the properties for each push buttons for tabstrip control.i.e, name, lable fct code and referance field( name of the sub screen area).

subscreen area -> sub1.

tab1 -> tab1, tab1, tab1, tab1.

tab2 -> tab2, tab2, tab2, tab2.

tab3 -> tab3, tab3, tab3, tab3.

savve.

create a subscreen for each tab like 10, 20 and 30. Add required fields in the each sub screen.

Open top include file and declare all the variables including tabstrip .

tabstrip control shuld declare like:

controls: tbstr type tabstrip.

activate.

PBO:

call subscreen sub1 including <prgname> dynnr.

PAI:

case sy-ucomm.

when 'tab1'.

tbstr-activetab = 'tab1'.

dynnr = '10'.

when 'tab2'.

tbstr-activetab = 'tab2'.

dynnr = '20'.

when 'tab3'.

tbstr-activetab = 'tab3'.

dynnr = '30'.

endcase.

save and activate.

create a tcode. and execute.

Hope it helps.

Cheers.

Former Member
0 Kudos

1.First create a screen (2000) in module pool program.

2.in layout option select tabstrip and give a name.

3.select the subscreen and paste it in any one tab for dynamic call , name the subscreen.

4.now create two screens(2100 ,2200) , with screen type as subscreen.

5. in 2100 layout and 2200 layout place ur requirements and continue

Example code.

in PBO of 2000 write this code.

PROCESS BEFORE OUTPUT.

  • MODULE STATUS_2000.

CALL SUBSCREEN SUB INCLUDING SY-REPID DNR.

*

PROCESS AFTER INPUT.

CALL SUBSCREEN SUB.

MODULE USER_COMMAND_2000.

main prgram

ROGRAM ZSCREENSAMPLE .

CONTROLS MYTAB TYPE TABSTRIP. "tabstrip name

DATA : EXIT1, EXIT2.

DATA : DNR TYPE SY-DYNNR.

MYTAB-ACTIVETAB = 'TAB1'.

DNR = '2100'.

CALL SCREEN 2000.

MODULE USER_COMMAND_2000 INPUT.

CASE SY-UCOMM.

WHEN 'TAB1'.

MYTAB-ACTIVETAB = 'TAB1'.

DNR = '2100'.

WHEN 'TAB2'.

MYTAB-ACTIVETAB = 'TAB2'.

DNR = '2200'.

ENDCASE.

ENDMODULE.

&----


*& Module USER_COMMAND_2100 INPUT

&----


  • text

----


MODULE USER_COMMAND_2100 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT1'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_2100 INPUT

&----


*& Module USER_COMMAND_2200 INPUT

&----


  • text

----


MODULE USER_COMMAND_2200 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT2'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_2200 INPUT

Former Member
0 Kudos

HI,

Check the below programs.

DEMO_DYNPRO_TABSTRIP_SERVER

DEMO_DYNPRO_TABSTRIP_LOCAL

For more information click the link below

http://help.sap.com/saphelp_47x200/helpdata/en/17/5bf1b52ba211d2954f0000e8353423/content.htm

Regards,

Vara

Former Member
0 Kudos

Hi,

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

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

...

...

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.

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.

Examples

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:

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:

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.

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.

Pls. reward points for helpful answers.

gopi_narendra
Active Contributor
0 Kudos

see the basic programs in ABAPDOCU transactions

demo_dynpro_tabstrip_local

demo_dynpro_tabstrip_server

Regards

- Gopi

Former Member
0 Kudos

Hi,

1. Create program in SE38 type module pool

2. Go to SE51 give the program name and screen number (100) then Layout Editor in drag the tab strip with Wizard and drop into form.

3. Start the Wizard click the Continue > Give the Tab strip name (tab)>click the continue>Give the Tab text like tab1,tab2,tab3(Should be give two tab text)>click the continue-->Automatically sub screen number came(101,102,103) > continue>continue>Click the Completed>Save-->Activated.

4. Automatically code is generated.

5. Design the Sub screens (tab1, tab2, tab3).Go back gives the Tab1 screen number (101) and design the layout.