ABAP中分页控件的定义

 在SAP系统的开发中我们经常用到tab控件的使用,本文介绍了如何使用selection-screen来定义tab控件,每一个tab控件页内置一个子屏幕(subscreen),所以要先定义一个子屏幕。

代码如下:

REPORT  zrr_selectionscreen                     .

CALL SCREEN 100.

DATA c1(8) TYPE c.

"define a subscreen-100 placed in the first tab

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.

SELECT-OPTIONS:type1 FOR c1.

SELECTION-SCREEN END OF BLOCK a1.

SELECTION-SCREEN END OF SCREEN 100.

"define a subscreen-200 placed in the second tab

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.

PARAMETERS typ2(20) TYPE c.

SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN BEGIN OF TABBED BLOCK mytab FOR 6 LINES.

SELECTION-SCREEN TAB (20) button1 USER-COMMAND push1 DEFAULT SCREEN 100.

SELECTION-SCREEN TAB (20) button2 USER-COMMAND push2 DEFAULT SCREEN 200.

SELECTION-SCREEN  END OF BLOCK mytab.

INITIALIZATION.

  button1 = text-001.

  button2 = text-002.

  mytab-dynnr = 100.

AT SELECTION-SCREEN.

  CASE sy-ucomm.

    WHEN 'push1'.

      mytab-dynnr = 100.

      mytab-activetab = 'BUTTON1'.

    WHEN 'push2'.

      mytab-dynnr = 200.

      mytab-activetab = 'BUTTON2'.

  ENDCASE.

你可能感兴趣的:(职场,abap,休闲,分页控件,tab标签)