Sunday, 8 April 2012

Tabstrips & Subscreens In Selection Screen

SAP ABAP - Sample Program To Demonstrate Tabstrips & Subscreens In Selection Screen.

This sample report program explains the use of tabstrips and subscreen in main selection screen.

*& Use of TabStrip and SubScreen explained
*& ---- The report shows the material on one tab
*& and plant on one tab.Pressing the execute button will show
*& the description of the material or plant as the case is.
*& TEXT-002 = Material Number
*& TEXT-003 = Plant Number.


REPORT zjal_tabstrip_selscr NO STANDARD PAGE HEADING LINE-SIZE 80 LINE-COUNT 60.
TABLES : sscrfields.
DATA activetab(6) TYPE c .
DATA: mat_des TYPE makt-maktx,
pl_des TYPE t001w-name1 .

SELECTION-SCREEN BEGIN OF SCREEN 001 AS SUBSCREEN NO INTERVALS.

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-002 NO INTERVALS.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 14(18) text-002 FOR FIELD matnr.
PARAMETERS matnr TYPE mara-matnr.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN END OF SCREEN 001.

SELECTION-SCREEN BEGIN OF SCREEN 002 AS SUBSCREEN NO INTERVALS.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-003 NO INTERVALS.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 14(18) text-003 FOR FIELD matnr.
PARAMETERS werks TYPE t001w-werks.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK block2.
SELECTION-SCREEN END OF SCREEN 002.

SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 5 LINES NO INTERVALS.

SELECTION-SCREEN TAB (15) tabs1 USER-COMMAND ucomm1
DEFAULT SCREEN 001.
SELECTION-SCREEN TAB (15) tabs2 USER-COMMAND ucomm2.

SELECTION-SCREEN END OF BLOCK tabb1.

INITIALIZATION.
tabs1 = text-002.
tabs2 = text-003.
activetab = 'TABS1'.

AT SELECTION-SCREEN .

CASE sscrfields-ucomm.

WHEN 'UCOMM1'.
tabb1-prog = sy-repid.
tabb1-dynnr = 001.
tabb1-activetab = 'TABS1'.
activetab = 'TABS1' .

WHEN 'UCOMM2'.
tabb1-prog = sy-repid.
tabb1-dynnr = 002.
tabb1-activetab = 'TABS2'.
activetab = 'TABS2'.

ENDCASE.

START-OF-SELECTION.

CASE activetab.

WHEN 'TABS1'.
SELECT SINGLE maktx
FROM makt
INTO mat_des
WHERE matnr = matnr.

WRITE: 'Material ' , matnr , mat_des .

WHEN 'TABS2'.
SELECT SINGLE name1
FROM t001w
INTO pl_des
WHERE werks = werks.

WRITE: 'Plant ' , werks ,pl_des.
ENDCASE.


OUTPUT SCREEN: