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: 

Determine the active tab in a selection screen

Former Member
0 Kudos

Hello,

is it possible to determine which tab is currently activated in a selection screen with several tabs?

I will include different code in different tabs. When pressing the "execute" button the program should return the active tab (as a value).

Thanks

Florian Schwaiger

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

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:

<Tabstripctrl>-ACTIVETAB = <fcode>.

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.

Thanks,

Ruthra

2 REPLIES 2

Former Member
0 Kudos

Hi,

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:

<Tabstripctrl>-ACTIVETAB = <fcode>.

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.

Thanks,

Ruthra

Former Member
0 Kudos

Hi florain,

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.

thanks

nagendra