Create a tab on the screen

Source: Internet
Author: User

The tab effect appears in many places and is often used for user operations. SAP also provides the same function, especially during screen development. Take notes here, the entire simple tab.

Syntax:

SELECTION-SCREEN BEGIN OF TABBED BLOCK <b> FOR n LINES.

1. Select a screen. One page has a single sub-screen:

 1 TABLES: sscrfields,mara. 2  3 * sub screen 100. 4 SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. 5 SELECTION-SCREEN BEGIN OF BLOCK 110 WITH FRAME TITLE mytitle2. 6 SELECT-OPTIONS: mat1 FOR mara-matnr NO INTERVALS. 7 SELECTION-SCREEN SKIP 1. 8 SELECTION-SCREEN END OF BLOCK 110. 9 SELECTION-SCREEN END OF SCREEN 100.10 11 * sub screen 200.12 SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.13 SELECT-OPTIONS: mat2 FOR mara-matnr.14 SELECTION-SCREEN END OF SCREEN 200.15 16 * tab17 SELECTION-SCREEN:BEGIN OF TABBED BLOCK mytab FOR 5 LINES,18                  TAB (20) button1 USER-COMMAND push1,19                  TAB (20) button2 USER-COMMAND push2,20 END OF BLOCK mytab.

Two sub-screens are defined: 100,200.

2. assign an initial value in the initialization event:

1 INITIALIZATION.2   mytitle2 = 'Tab Op.'.3   mytab = 'Tab'.4   button1 = 'tab1'.5   button2 = 'tab2'.6   mytab-prog = sy-repid.7   mytab-dynnr = 100. 

3. events triggered when the tab is clicked:

1 AT SELECTION-SCREEN.2   CASE sy-ucomm.3     WHEN 'PUSH1'.4       mytab-dynnr = 100.5       mytab-activetab = 'button1'.6     WHEN 'PUSH2'.7       mytab-dynnr = 200.8       mytab-activetab = 'button2'.9   ENDCASE.

Here, the tab effect is displayed:

Complete code:

 1 *&---------------------------------------------------------------------* 2 *& Report  ZABAPX_SSCR 3 *& 4 *&---------------------------------------------------------------------* 5 *& 6 *& 7 *&---------------------------------------------------------------------* 8  9 REPORT  zabapx_sscr.10 TABLES: sscrfields,mara.11 12 * sub screen 100.13 SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.14 SELECTION-SCREEN BEGIN OF BLOCK 110 WITH FRAME TITLE mytitle2.15 SELECT-OPTIONS: mat1 FOR mara-matnr NO INTERVALS.16 SELECTION-SCREEN SKIP 1.17 SELECTION-SCREEN END OF BLOCK 110.18 SELECTION-SCREEN END OF SCREEN 100.19 20 * sub screen 200.21 SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.22 SELECT-OPTIONS: mat2 FOR mara-matnr.23 SELECTION-SCREEN END OF SCREEN 200.24 25 * tab26 SELECTION-SCREEN:BEGIN OF TABBED BLOCK mytab FOR 5 LINES,27                  TAB (20) button1 USER-COMMAND push1,28                  TAB (20) button2 USER-COMMAND push2,29 END OF BLOCK mytab.30 31 INITIALIZATION.32   mytitle2 = 'Tab Op.'.33   mytab = 'Tab'.34   button1 = 'tab1'.35   button2 = 'tab2'.36 37   mytab-prog = sy-repid.38   mytab-dynnr = 100.39 40 AT SELECTION-SCREEN.41   CASE sy-ucomm.42     WHEN 'PUSH1'.43       mytab-dynnr = 100.44       mytab-activetab = 'button1'.45     WHEN 'PUSH2'.46       mytab-dynnr = 200.47       mytab-activetab = 'button2'.48   ENDCASE.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.