【ABAP】常用模板代码一(选择屏幕多页签)

REPORT YH_DEMO1."NO STANDARD PAGE HEADING "LINE-SIZE  80
             "LINE-COUNT 65(0)        "MESSAGE-ID
TABLES:T001.
DATA:OK_CODE TYPE SY-UCOMM,
         GV_CHECK TYPE ABAP_BOOL,
         GV_BEDAT TYPE SY-DATUM,
         GV_EDDAT TYPE SY-DATUM,
         GV_DYNNR TYPE SY-DYNNR.

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
  SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:P_BUKRS1 FOR T001-bukrs NO INTERVALS NO-EXTENSION.
    PARAMETERS:P_RD_1_1 RADIOBUTTON GROUP G1,
                         P_RD_1_5 RADIOBUTTON GROUP G1,
                         P_RD_1_2 RADIOBUTTON GROUP G1,
                         P_RD_1_3 RADIOBUTTON GROUP G1,
                         P_RD_1_4 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
  SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS:P_BUKRS2 FOR T001-bukrs NO INTERVALS NO-EXTENSION.
    PARAMETERS:P_RD_2_1 RADIOBUTTON GROUP G2,
                         P_RD_2_5 RADIOBUTTON GROUP G2,
                         P_RD_2_2 RADIOBUTTON GROUP G2,
                         P_RD_2_3 RADIOBUTTON GROUP G2,
                         P_RD_2_4 RADIOBUTTON GROUP G2.
    SELECTION-SCREEN END OF BLOCK B2.
    SELECTION-SCREEN END OF SCREEN 200.

   SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
     SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-001.
       PARAMETERS:P_BUKRS3 TYPE BUKRS.
        SELECTION-SCREEN END OF BLOCK B3.
    SELECTION-SCREEN END OF SCREEN 300.

    SELECTION-SCREEN BEGIN OF TABBED BLOCK MYTAB FOR 20 LINES.
      SELECTION-SCREEN TAB (20) TEXT_1 USER-COMMAND BUT1.
      SELECTION-SCREEN TAB (20) TEXT_2 USER-COMMAND BUT2.
      SELECTION-SCREEN TAB (20) TEXT_3 USER-COMMAND BUT3.
SELECTION-SCREEN END OF BLOCK MYTAB.

INITIALIZATION.
PERFORM INIT_SCREEN_TAB.

AT SELECTION-SCREEN.
  PERFORM SET_TAB_SUBSCREEN.

  START-OF-SELECTION.
  PERFORM CHECK_INPUT_FIELD.
*&---------------------------------------------------------------------*
*&      Form  INIT_SCREEN_TAB
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM init_screen_tab .
  TEXT_1 = 'TAB1'.
  TEXT_2 = 'TAB2'.
  TEXT_3 = 'TAB3'.

  GET PARAMETER ID 'BES' FIELD GV_DYNNR.
  SET PARAMETER ID 'BUK' FIELD space.

  MYTAB-PROG = SY-repid.

  IF GV_DYNNR = '100' OR GV_DYNNR = '200' OR GV_DYNNR = '300'.
    ELSE.
      GV_DYNNR = '100'.

  ENDIF.

  IF GV_DYNNR = space.
    MYTAB-dynnr = 100.
    MYTAB-ACTIVETAB = 'BUT1'.
    ELSE.
      MYTAB-dynnr = GV_DYNNR.
      IF GV_DYNNR = 200.
            MYTAB-ACTIVETAB = 'BUT2'.
      ENDIF.
      IF GV_DYNNR = 300.
            MYTAB-ACTIVETAB = 'BUT3'.
      ENDIF.
  ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  SET_TAB_SUBSCREEN
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM set_tab_subscreen .
    CASE SY-dynnr.
      WHEN 1000.
        CASE SY-ucomm.
          WHEN 'BUT1'.
            MYTAB-dynnr = 100.
            MYTAB-ACTIVETAB = 'BUT1'.
          WHEN 'BUT2'.
            MYTAB-dynnr = 200.
            MYTAB-ACTIVETAB = 'BUT2'.
          WHEN 'BUT3'.
            MYTAB-dynnr = 300.
            MYTAB-ACTIVETAB = 'BUT3'.
          WHEN OTHERS.
            SET PARAMETER ID 'BES' FIELD MYTAB-dynnr.
        ENDCASE.

    ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  CHECK_INPUT_FIELD
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM check_input_field .

    DATA:BEGIN OF GT_BUKRS OCCURS 0,
      BUKRS TYPE bukrs,
      END OF GT_BUKRS.

      CLEAR:GV_CHECK.

      CASE MYTAB-dynnr.
        WHEN 100.

        WHEN 200.

        WHEN 300.

        WHEN OTHERS.
      ENDCASE.
ENDFORM.

 

给TA买糖
共{{data.count}}人
人已赞赏
ABAPSAP

【ABAP】自定义权限对象

2021-6-29 18:36:04

ABAPSAP

【ABAP】常用模板二

2021-7-14 16:09:07

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索