ABAP基础三——DIALOG整体详解编程语言

本来想模拟VA01的,后来想想ME21N也很经典,所以就把一些常见的组建都放上面了。

效果图如下:

ABAP基础三——DIALOG整体详解编程语言

1.整体设计就是按  抬头(1) + 项目(N) + 伙伴(N) + 相关数据的tabstrip(N)

2.screen设计如下:

ABAP基础三——DIALOG整体详解编程语言

 3.主界面设计:SCREEN 9000
ABAP基础三——DIALOG整体详解编程语言

主屏幕逻辑流:

ABAP基础三——DIALOG整体详解编程语言

 PBO中针对是否折叠做逻辑控制,显示对应的屏幕:

ABAP基础三——DIALOG整体详解编程语言

PAI处理

 ABAP基础三——DIALOG整体详解编程语言

下面贴全部代码:

主程序:

PROGRAM ZEXP_SCREEN_TEST. 
 
DATA:GT_HEAD  TYPE TABLE OF CRMD_ORDERADM_H, 
     GW_HEAD  LIKE LINE OF GT_HEAD, 
     GT_ITEM  TYPE TABLE OF CRMD_ORDERADM_I, 
     GW_ITEM  LIKE LINE OF GT_ITEM, 
     GT_PART  TYPE TABLE OF CRMD_PARTNER, 
     GW_PART  LIKE LINE OF GT_PART, 
     OK_CODE  TYPE SY-UCOMM, 
     GV_FLAG1 TYPE CHAR01, 
     GV_DEC   TYPE ZDEC, 
     GV_FLAG2 TYPE CHAR01, 
     GV_FLAG3 TYPE CHAR01. 
 
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TC_9001' ITSELF 
CONTROLS: TC_9001 TYPE TABLEVIEW USING SCREEN 9001. 
DATA:TC_9001_SUB1 TYPE SY-DYNNR. 
DATA:TC_9001_SUB2 TYPE SY-DYNNR. 
DATA:TC_9001_SUB3 TYPE SY-DYNNR. 
DATA:TC_9001_HSUB TYPE SY-DYNNR VALUE '9004'. 
 
*&SPWIZARD: LINES OF TABLECONTROL 'TC_9001' 
DATA:     G_TC_9001_LINES  LIKE SY-LOOPC. 
 
 
*&SPWIZARD: FUNCTION CODES FOR TABSTRIP 'TS_ITEM' 
CONSTANTS: BEGIN OF C_TS_ITEM, 
             TAB1 LIKE SY-UCOMM VALUE 'TS_ITEM_FC1', 
             TAB2 LIKE SY-UCOMM VALUE 'TS_ITEM_FC2', 
             TAB3 LIKE SY-UCOMM VALUE 'TS_ITEM_FC3', 
             TAB4 LIKE SY-UCOMM VALUE 'TS_ITEM_FC4', 
             TAB5 LIKE SY-UCOMM VALUE 'TS_ITEM_FC5', 
             TAB6 LIKE SY-UCOMM VALUE 'TS_ITEM_FC6', 
           END OF C_TS_ITEM. 
*&SPWIZARD: DATA FOR TABSTRIP 'TS_ITEM' 
CONTROLS:  TS_ITEM TYPE TABSTRIP. 
DATA:      BEGIN OF G_TS_ITEM, 
             SUBSCREEN   LIKE SY-DYNNR, 
             PROG        LIKE SY-REPID VALUE 'ZEXP_SCREEN_TEST', 
             PRESSED_TAB LIKE SY-UCOMM VALUE C_TS_ITEM-TAB1, 
           END OF G_TS_ITEM. 
 
 
 
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC_9001'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR 
MODULE TC_9001_CHANGE_TC_ATTR OUTPUT. 
  DESCRIBE TABLE GT_ITEM LINES TC_9001-LINES. 
ENDMODULE. 
 
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC_9001'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: GET LINES OF TABLECONTROL 
MODULE TC_9001_GET_LINES OUTPUT. 
  G_TC_9001_LINES = SY-LOOPC. 
  IF GW_ITEM-NUMBER_INT IS NOT INITIAL. 
    LOOP AT SCREEN. 
      IF SCREEN-NAME = 'GW_ITEM-ITM_TYPE'. 
        SCREEN-REQUIRED = 1. 
        MODIFY SCREEN. 
      ENDIF. 
    ENDLOOP. 
  ENDIF. 
ENDMODULE. 
 
*&SPWIZARD: INPUT MODULE FOR TC 'TC_9001'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: MODIFY TABLE 
MODULE TC_9001_MODIFY INPUT. 
  PERFORM FRM_9001_FIELD_MODIFY."PAI中更新某内表行数据 
 
  MODIFY GT_ITEM 
    FROM GW_ITEM 
    INDEX TC_9001-CURRENT_LINE. 
  IF SY-SUBRC <> 0. 
    APPEND GW_ITEM TO GT_ITEM. 
  ENDIF. 
ENDMODULE. 
 
*&SPWIZARD: INPUT MODULE FOR TC 'TC_9001'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: PROCESS USER COMMAND 
MODULE TC_9001_USER_COMMAND INPUT. 
  OK_CODE = SY-UCOMM. 
  PERFORM USER_OK_TC USING    'TC_9001' 
                              'GT_ITEM' 
                              ' ' 
                     CHANGING OK_CODE. 
  SY-UCOMM = OK_CODE. 
ENDMODULE. 
 
*----------------------------------------------------------------------* 
*   INCLUDE TABLECONTROL_FORMS                                         * 
*----------------------------------------------------------------------* 
 
*&---------------------------------------------------------------------* 
*&      Form  USER_OK_TC                                               * 
*&---------------------------------------------------------------------* 
FORM USER_OK_TC USING    P_TC_NAME TYPE DYNFNAM 
                         P_TABLE_NAME 
                         P_MARK_NAME 
                CHANGING P_OK      LIKE SY-UCOMM. 
 
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------* 
  DATA: L_OK     TYPE SY-UCOMM, 
        L_OFFSET TYPE I. 
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* 
 
*&SPWIZARD: Table control specific operations                          * 
*&SPWIZARD: evaluate TC name and operations                            * 
  SEARCH P_OK FOR P_TC_NAME. 
  IF SY-SUBRC <> 0. 
    EXIT. 
  ENDIF. 
  L_OFFSET = STRLEN( P_TC_NAME ) + 1. 
  L_OK = P_OK+L_OFFSET. 
*&SPWIZARD: execute general and TC specific operations                 * 
  CASE L_OK. 
    WHEN 'INSR'.                      "insert row 
      PERFORM FCODE_INSERT_ROW USING    P_TC_NAME 
                                        P_TABLE_NAME. 
      CLEAR P_OK. 
 
    WHEN 'DELE'.                      "delete row 
      PERFORM FCODE_DELETE_ROW USING    P_TC_NAME 
                                        P_TABLE_NAME 
                                        P_MARK_NAME. 
      CLEAR P_OK. 
 
    WHEN 'P--' OR                     "top of list 
         'P-'  OR                     "previous page 
         'P+'  OR                     "next page 
         'P++'.                       "bottom of list 
      PERFORM COMPUTE_SCROLLING_IN_TC USING P_TC_NAME 
                                            L_OK. 
      CLEAR P_OK. 
*     WHEN 'L--'.                       "total left 
*       PERFORM FCODE_TOTAL_LEFT USING P_TC_NAME. 
* 
*     WHEN 'L-'.                        "column left 
*       PERFORM FCODE_COLUMN_LEFT USING P_TC_NAME. 
* 
*     WHEN 'R+'.                        "column right 
*       PERFORM FCODE_COLUMN_RIGHT USING P_TC_NAME. 
* 
*     WHEN 'R++'.                       "total right 
*       PERFORM FCODE_TOTAL_RIGHT USING P_TC_NAME. 
* 
    WHEN 'MARK'.                      "mark all filled lines 
      PERFORM FCODE_TC_MARK_LINES USING P_TC_NAME 
                                        P_TABLE_NAME 
                                        P_MARK_NAME   . 
      CLEAR P_OK. 
 
    WHEN 'DMRK'.                      "demark all filled lines 
      PERFORM FCODE_TC_DEMARK_LINES USING P_TC_NAME 
                                          P_TABLE_NAME 
                                          P_MARK_NAME . 
      CLEAR P_OK. 
 
*     WHEN 'SASCEND'   OR 
*          'SDESCEND'.                  "sort column 
*       PERFORM FCODE_SORT_TC USING P_TC_NAME 
*                                   l_ok. 
 
  ENDCASE. 
 
ENDFORM.                              " USER_OK_TC 
 
*&---------------------------------------------------------------------* 
*&      Form  FCODE_INSERT_ROW                                         * 
*&---------------------------------------------------------------------* 
FORM FCODE_INSERT_ROW 
              USING    P_TC_NAME           TYPE DYNFNAM 
                       P_TABLE_NAME             . 
 
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------* 
  DATA L_LINES_NAME       LIKE FELD-NAME. 
  DATA L_SELLINE          LIKE SY-STEPL. 
  DATA L_LASTLINE         TYPE I. 
  DATA L_LINE             TYPE I. 
  DATA L_TABLE_NAME       LIKE FELD-NAME. 
  FIELD-SYMBOLS <TC>                 TYPE CXTAB_CONTROL. 
  FIELD-SYMBOLS <TABLE>              TYPE STANDARD TABLE. 
  FIELD-SYMBOLS <LINES>              TYPE I. 
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* 
 
  ASSIGN (P_TC_NAME) TO <TC>. 
 
*&SPWIZARD: get the table, which belongs to the tc                     * 
  CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body 
  ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline 
 
*&SPWIZARD: get looplines of TableControl                              * 
  CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_LINES_NAME. 
  ASSIGN (L_LINES_NAME) TO <LINES>. 
 
*&SPWIZARD: get current line                                           * 
  GET CURSOR LINE L_SELLINE. 
  IF SY-SUBRC <> 0.                   " append line to table 
    L_SELLINE = <TC>-LINES + 1. 
*&SPWIZARD: set top line                                               * 
    IF L_SELLINE > <LINES>. 
      <TC>-TOP_LINE = L_SELLINE - <LINES> + 1 . 
    ELSE. 
      <TC>-TOP_LINE = 1. 
    ENDIF. 
  ELSE.                               " insert line into table 
    L_SELLINE = <TC>-TOP_LINE + L_SELLINE - 1. 
    L_LASTLINE = <TC>-TOP_LINE + <LINES> - 1. 
  ENDIF. 
*&SPWIZARD: set new cursor line                                        * 
  L_LINE = L_SELLINE - <TC>-TOP_LINE + 1. 
 
*&SPWIZARD: insert initial line                                        * 
  INSERT INITIAL LINE INTO <TABLE> INDEX L_SELLINE. 
  <TC>-LINES = <TC>-LINES + 1. 
*&SPWIZARD: set cursor                                                 * 
  SET CURSOR LINE L_LINE. 
 
ENDFORM.                              " FCODE_INSERT_ROW 
 
*&---------------------------------------------------------------------* 
*&      Form  FCODE_DELETE_ROW                                         * 
*&---------------------------------------------------------------------* 
FORM FCODE_DELETE_ROW 
              USING    P_TC_NAME           TYPE DYNFNAM 
                       P_TABLE_NAME 
                       P_MARK_NAME   . 
 
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------* 
  DATA L_TABLE_NAME       LIKE FELD-NAME. 
 
  FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL. 
  FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE. 
  FIELD-SYMBOLS <WA>. 
  FIELD-SYMBOLS <MARK_FIELD>. 
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* 
 
  ASSIGN (P_TC_NAME) TO <TC>. 
 
*&SPWIZARD: get the table, which belongs to the tc                     * 
  CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body 
  ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline 
 
*&SPWIZARD: delete marked lines                                        * 
  DESCRIBE TABLE <TABLE> LINES <TC>-LINES. 
 
  LOOP AT <TABLE> ASSIGNING <WA>. 
 
*&SPWIZARD: access to the component 'FLAG' of the table header         * 
    ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>. 
 
    IF <MARK_FIELD> = 'X'. 
      DELETE <TABLE> INDEX SYST-TABIX. 
      IF SY-SUBRC = 0. 
        <TC>-LINES = <TC>-LINES - 1. 
      ENDIF. 
    ENDIF. 
  ENDLOOP. 
 
ENDFORM.                              " FCODE_DELETE_ROW 
 
*&---------------------------------------------------------------------* 
*&      Form  COMPUTE_SCROLLING_IN_TC 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*      -->P_TC_NAME  name of tablecontrol 
*      -->P_OK       ok code 
*----------------------------------------------------------------------* 
FORM COMPUTE_SCROLLING_IN_TC USING    P_TC_NAME 
                                      P_OK. 
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------* 
  DATA L_TC_NEW_TOP_LINE     TYPE I. 
  DATA L_TC_NAME             LIKE FELD-NAME. 
  DATA L_TC_LINES_NAME       LIKE FELD-NAME. 
  DATA L_TC_FIELD_NAME       LIKE FELD-NAME. 
 
  FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL. 
  FIELD-SYMBOLS <LINES>      TYPE I. 
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* 
 
  ASSIGN (P_TC_NAME) TO <TC>. 
*&SPWIZARD: get looplines of TableControl                              * 
  CONCATENATE 'G_' P_TC_NAME '_LINES' INTO L_TC_LINES_NAME. 
  ASSIGN (L_TC_LINES_NAME) TO <LINES>. 
 
 
*&SPWIZARD: is no line filled?                                         * 
  IF <TC>-LINES = 0. 
*&SPWIZARD: yes, ...                                                   * 
    L_TC_NEW_TOP_LINE = 1. 
  ELSE. 
*&SPWIZARD: no, ...                                                    * 
    CALL FUNCTION 'SCROLLING_IN_TABLE' 
      EXPORTING 
        ENTRY_ACT      = <TC>-TOP_LINE 
        ENTRY_FROM     = 1 
        ENTRY_TO       = <TC>-LINES 
        LAST_PAGE_FULL = 'X' 
        LOOPS          = <LINES> 
        OK_CODE        = P_OK 
        OVERLAPPING    = 'X' 
      IMPORTING 
        ENTRY_NEW      = L_TC_NEW_TOP_LINE 
      EXCEPTIONS 
*       NO_ENTRY_OR_PAGE_ACT  = 01 
*       NO_ENTRY_TO    = 02 
*       NO_OK_CODE_OR_PAGE_GO = 03 
        OTHERS         = 0. 
  ENDIF. 
 
*&SPWIZARD: get actual tc and column                                   * 
  GET CURSOR FIELD L_TC_FIELD_NAME 
             AREA  L_TC_NAME. 
 
  IF SYST-SUBRC = 0. 
    IF L_TC_NAME = P_TC_NAME. 
*&SPWIZARD: et actual column                                           * 
      SET CURSOR FIELD L_TC_FIELD_NAME LINE 1. 
    ENDIF. 
  ENDIF. 
 
*&SPWIZARD: set the new top line                                       * 
  <TC>-TOP_LINE = L_TC_NEW_TOP_LINE. 
 
 
ENDFORM.                              " COMPUTE_SCROLLING_IN_TC 
 
*&---------------------------------------------------------------------* 
*&      Form  FCODE_TC_MARK_LINES 
*&---------------------------------------------------------------------* 
*       marks all TableControl lines 
*----------------------------------------------------------------------* 
*      -->P_TC_NAME  name of tablecontrol 
*----------------------------------------------------------------------* 
FORM FCODE_TC_MARK_LINES USING P_TC_NAME 
                               P_TABLE_NAME 
                               P_MARK_NAME. 
*&SPWIZARD: EGIN OF LOCAL DATA-----------------------------------------* 
  DATA L_TABLE_NAME       LIKE FELD-NAME. 
 
  FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL. 
  FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE. 
  FIELD-SYMBOLS <WA>. 
  FIELD-SYMBOLS <MARK_FIELD>. 
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* 
 
  ASSIGN (P_TC_NAME) TO <TC>. 
 
*&SPWIZARD: get the table, which belongs to the tc                     * 
  CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body 
  ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline 
 
*&SPWIZARD: mark all filled lines                                      * 
  LOOP AT <TABLE> ASSIGNING <WA>. 
 
*&SPWIZARD: access to the component 'FLAG' of the table header         * 
    ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>. 
 
    <MARK_FIELD> = 'X'. 
  ENDLOOP. 
ENDFORM.                                          "fcode_tc_mark_lines 
 
*&---------------------------------------------------------------------* 
*&      Form  FCODE_TC_DEMARK_LINES 
*&---------------------------------------------------------------------* 
*       demarks all TableControl lines 
*----------------------------------------------------------------------* 
*      -->P_TC_NAME  name of tablecontrol 
*----------------------------------------------------------------------* 
FORM FCODE_TC_DEMARK_LINES USING P_TC_NAME 
                                 P_TABLE_NAME 
                                 P_MARK_NAME . 
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------* 
  DATA L_TABLE_NAME       LIKE FELD-NAME. 
 
  FIELD-SYMBOLS <TC>         TYPE CXTAB_CONTROL. 
  FIELD-SYMBOLS <TABLE>      TYPE STANDARD TABLE. 
  FIELD-SYMBOLS <WA>. 
  FIELD-SYMBOLS <MARK_FIELD>. 
*&SPWIZARD: END OF LOCAL DATA------------------------------------------* 
 
  ASSIGN (P_TC_NAME) TO <TC>. 
 
*&SPWIZARD: get the table, which belongs to the tc                     * 
  CONCATENATE P_TABLE_NAME '[]' INTO L_TABLE_NAME. "table body 
  ASSIGN (L_TABLE_NAME) TO <TABLE>.                "not headerline 
 
*&SPWIZARD: demark all filled lines                                    * 
  LOOP AT <TABLE> ASSIGNING <WA>. 
 
*&SPWIZARD: access to the component 'FLAG' of the table header         * 
    ASSIGN COMPONENT P_MARK_NAME OF STRUCTURE <WA> TO <MARK_FIELD>. 
 
    <MARK_FIELD> = SPACE. 
  ENDLOOP. 
ENDFORM.                                          "fcode_tc_mark_lines 
 
*&SPWIZARD: DECLARATION OF TABLECONTROL 'TC_9002' ITSELF 
CONTROLS: TC_9002 TYPE TABLEVIEW USING SCREEN 9002. 
 
*&SPWIZARD: LINES OF TABLECONTROL 'TC_9002' 
DATA:     G_TC_9002_LINES  LIKE SY-LOOPC. 
 
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC_9002'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: UPDATE LINES FOR EQUIVALENT SCROLLBAR 
MODULE TC_9002_CHANGE_TC_ATTR OUTPUT. 
  DESCRIBE TABLE GT_PART LINES TC_9002-LINES. 
ENDMODULE. 
 
*&SPWIZARD: OUTPUT MODULE FOR TC 'TC_9002'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: GET LINES OF TABLECONTROL 
MODULE TC_9002_GET_LINES OUTPUT. 
  G_TC_9002_LINES = SY-LOOPC. 
ENDMODULE. 
 
*&SPWIZARD: INPUT MODULE FOR TC 'TC_9002'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: MODIFY TABLE 
MODULE TC_9002_MODIFY INPUT. 
  MODIFY GT_PART 
    FROM GW_PART 
    INDEX TC_9002-CURRENT_LINE. 
  IF SY-SUBRC <> 0. 
    APPEND GW_PART TO GT_PART. 
  ENDIF. 
ENDMODULE. 
 
*&SPWIZARD: INPUT MODULE FOR TC 'TC_9002'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: PROCESS USER COMMAND 
MODULE TC_9002_USER_COMMAND INPUT. 
  OK_CODE = SY-UCOMM. 
  PERFORM USER_OK_TC USING    'TC_9002' 
                              'GT_PART' 
                              ' ' 
                     CHANGING OK_CODE. 
  SY-UCOMM = OK_CODE. 
ENDMODULE. 
*&---------------------------------------------------------------------* 
*&      Module  STATUS_9000  OUTPUT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
MODULE STATUS_9000 OUTPUT. 
  SET PF-STATUS 'ST9000'. 
*  SET TITLEBAR 'xxx'. 
  IF GV_FLAG1 = 'X'. 
    TC_9001_SUB1 = '9101'. 
  ELSE. 
    TC_9001_SUB1 = '9001'. 
  ENDIF. 
  IF GV_FLAG2 = 'X'. 
    TC_9001_SUB2 = '9102'. 
  ELSE. 
    TC_9001_SUB2 = '9002'. 
  ENDIF. 
  IF GV_FLAG3 = 'X'. 
    TC_9001_SUB3 = '9103'. 
  ELSE. 
    TC_9001_SUB3 = '9003'. 
  ENDIF. 
 
  PERFORM FRM_HEADER_FIELD_VISIABLE. 
ENDMODULE. 
*&---------------------------------------------------------------------* 
*&      Module  USER_COMMAND_9000  INPUT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
MODULE USER_COMMAND_9000 INPUT. 
  CASE OK_CODE. 
    WHEN 'BACK'. 
      LEAVE TO SCREEN 0. 
    WHEN 'CANL' OR 'EXIT'. 
      LEAVE PROGRAM. 
    WHEN 'FOLD2'. 
      IF GV_FLAG2 IS INITIAL. 
        GV_FLAG2 = 'X'. 
      ELSE. 
        CLEAR GV_FLAG2. 
      ENDIF. 
    WHEN 'FOLD1'. 
      IF GV_FLAG1 IS INITIAL. 
        GV_FLAG1 = 'X'. 
      ELSE. 
        CLEAR GV_FLAG1. 
      ENDIF. 
    WHEN 'FOLD3'. 
      IF GV_FLAG3 IS INITIAL. 
        GV_FLAG3 = 'X'. 
      ELSE. 
        CLEAR GV_FLAG3. 
      ENDIF. 
    WHEN 'SAVE'. 
      PERFORM FRM_SAVE_CHECK. 
    WHEN OTHERS. 
  ENDCASE. 
ENDMODULE. 
*&---------------------------------------------------------------------* 
*&      Module  FRM_SET_DISABLE  OUTPUT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
MODULE FRM_SET_DISABLE OUTPUT. 
 
ENDMODULE. 
*&---------------------------------------------------------------------* 
*&      Module  STATUS_9001  OUTPUT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
MODULE STATUS_9001 OUTPUT. 
*  SET PF-STATUS 'xxxxxxxx'. 
*  SET TITLEBAR 'xxx'. 
ENDMODULE. 
 
*&SPWIZARD: OUTPUT MODULE FOR TS 'TS_ITEM'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: SETS ACTIVE TAB 
MODULE TS_ITEM_ACTIVE_TAB_SET OUTPUT. 
 
  TS_ITEM-ACTIVETAB = G_TS_ITEM-PRESSED_TAB. 
  CASE G_TS_ITEM-PRESSED_TAB. 
    WHEN C_TS_ITEM-TAB1. 
      G_TS_ITEM-SUBSCREEN = '9031'. 
    WHEN C_TS_ITEM-TAB2. 
      G_TS_ITEM-SUBSCREEN = '9032'. 
    WHEN C_TS_ITEM-TAB3. 
      G_TS_ITEM-SUBSCREEN = '9033'. 
    WHEN C_TS_ITEM-TAB4. 
      G_TS_ITEM-SUBSCREEN = '9034'. 
    WHEN C_TS_ITEM-TAB5. 
      G_TS_ITEM-SUBSCREEN = '9035'. 
    WHEN C_TS_ITEM-TAB6. 
      G_TS_ITEM-SUBSCREEN = '9036'. 
    WHEN OTHERS. 
*&SPWIZARD:      DO NOTHING 
  ENDCASE. 
ENDMODULE. 
 
*&SPWIZARD: INPUT MODULE FOR TS 'TS_ITEM'. DO NOT CHANGE THIS LINE! 
*&SPWIZARD: GETS ACTIVE TAB 
MODULE TS_ITEM_ACTIVE_TAB_GET INPUT. 
  OK_CODE = SY-UCOMM. 
  CASE OK_CODE. 
    WHEN C_TS_ITEM-TAB1. 
      G_TS_ITEM-PRESSED_TAB = C_TS_ITEM-TAB1. 
    WHEN C_TS_ITEM-TAB2. 
      G_TS_ITEM-PRESSED_TAB = C_TS_ITEM-TAB2. 
    WHEN C_TS_ITEM-TAB3. 
      G_TS_ITEM-PRESSED_TAB = C_TS_ITEM-TAB3. 
    WHEN C_TS_ITEM-TAB4. 
      G_TS_ITEM-PRESSED_TAB = C_TS_ITEM-TAB4. 
    WHEN C_TS_ITEM-TAB5. 
      G_TS_ITEM-PRESSED_TAB = C_TS_ITEM-TAB5. 
    WHEN C_TS_ITEM-TAB6. 
      G_TS_ITEM-PRESSED_TAB = C_TS_ITEM-TAB6. 
    WHEN OTHERS. 
*&SPWIZARD:      DO NOTHING 
  ENDCASE. 
ENDMODULE. 
*&---------------------------------------------------------------------* 
*&      Module  MOD_SET_TAB_VISIABLE  OUTPUT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
MODULE MOD_SET_TAB_VISIABLE OUTPUT. 
  IF SY-UNAME = 'LIYUAN'."设置隐藏的TAB页签 
    LOOP AT SCREEN. 
      IF SCREEN-NAME = 'TS_ITEM_TAB5'. 
        SCREEN-INVISIBLE = 'X'. 
        SCREEN-ACTIVE = 0. 
        MODIFY SCREEN. 
      ENDIF. 
    ENDLOOP. 
  ENDIF. 
ENDMODULE. 
*&---------------------------------------------------------------------* 
*&      Form  FRM_HEADER_FIELD_VISIABLE 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM FRM_HEADER_FIELD_VISIABLE . 
  LOOP AT SCREEN."设置屏幕字段的隐藏 
    IF SCREEN-NAME = 'GW_HEAD-OBJECT_ID' OR SCREEN-NAME = 'GW_HEAD-ZZZGROUP'. 
      SCREEN-ACTIVE = 0. 
      MODIFY SCREEN. 
    ENDIF. 
  ENDLOOP. 
ENDFORM. 
*&---------------------------------------------------------------------* 
*&      Form  FRM_9001_FIELD_MODIFY 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM FRM_9001_FIELD_MODIFY . 
  IF GW_ITEM-ITM_TYPE = 'ZSPA'."pai中做字段关联逻辑或,字段默认逻辑 
    GW_ITEM-ZZZBRAND = 'HI'. 
  ENDIF. 
ENDFORM. 
*&---------------------------------------------------------------------* 
*&      Module  FRM_EXIT  INPUT 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
MODULE FRM_EXIT INPUT. 
  LEAVE PROGRAM. 
ENDMODULE. 
*&---------------------------------------------------------------------* 
*&      Form  FRM_SAVE_CHECK 
*&---------------------------------------------------------------------* 
*       text 
*----------------------------------------------------------------------* 
*  -->  p1        text 
*  <--  p2        text 
*----------------------------------------------------------------------* 
FORM FRM_SAVE_CHECK . 
 
ENDFORM.

9000逻辑流:

PROCESS BEFORE OUTPUT. 
  MODULE STATUS_9000. 
  CALL SUBSCREEN HSUB INCLUDING SY-REPID TC_9001_HSUB."'9002'. 
  CALL SUBSCREEN SUB1 INCLUDING SY-REPID TC_9001_SUB1."'9001'. 
  CALL SUBSCREEN SUB2 INCLUDING SY-REPID TC_9001_SUB2."'9002'. 
  CALL SUBSCREEN SUB3 INCLUDING SY-REPID TC_9001_SUB3."'9002'. 
 
*  MODULE FRM_SET_DISABLE. 
* 
PROCESS AFTER INPUT. 
 MODULE FRM_EXIT AT EXIT-COMMAND. 
  CALL SUBSCREEN  HSUB. 
  CALL SUBSCREEN SUB1. 
  CALL SUBSCREEN  SUB2. 
  CALL SUBSCREEN  SUB3. 
 
  MODULE USER_COMMAND_9000.

9001TC逻辑流

PROCESS BEFORE OUTPUT. 
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC_9001' 
  MODULE TC_9001_CHANGE_TC_ATTR. 
*&SPWIZARD: MODULE TC_9001_CHANGE_COL_ATTR. 
  LOOP AT   GT_ITEM 
       INTO GW_ITEM 
       WITH CONTROL TC_9001 
       CURSOR TC_9001-CURRENT_LINE. 
    MODULE TC_9001_GET_LINES. 
*&SPWIZARD:   MODULE TC_9001_CHANGE_FIELD_ATTR 
  ENDLOOP. 
 
  MODULE STATUS_9001. 
* 
PROCESS AFTER INPUT. 
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC_9001' 
  LOOP AT GT_ITEM. 
    CHAIN. 
      FIELD GW_ITEM-NUMBER_INT. 
      FIELD GW_ITEM-ITM_TYPE. 
      FIELD GW_ITEM-ZZZBRAND. 
      FIELD GW_ITEM-ZZZMODENO. 
      FIELD GW_ITEM-ZZZSERIALNO. 
      FIELD GW_ITEM-ZZPLANT. 
      FIELD GW_ITEM-ZZLGORT. 
      FIELD GW_ITEM-ZZSYMP_GROU. 
      FIELD GW_ITEM-ZZSYMP_CODE. 
      MODULE TC_9001_MODIFY ON CHAIN-REQUEST. 
    ENDCHAIN. 
  ENDLOOP. 
  MODULE TC_9001_USER_COMMAND. 
*&SPWIZARD: MODULE TC_9001_CHANGE_TC_ATTR. 
*&SPWIZARD: MODULE TC_9001_CHANGE_COL_ATTR. 
 
* MODULE USER_COMMAND_9001.

9002TC逻辑流:

PROCESS BEFORE OUTPUT. 
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TC_9002' 
  MODULE TC_9002_CHANGE_TC_ATTR. 
*&SPWIZARD: MODULE TC_9002_CHANGE_COL_ATTR. 
  LOOP AT   GT_PART 
       INTO GW_PART 
       WITH CONTROL TC_9002 
       CURSOR TC_9002-CURRENT_LINE. 
    MODULE TC_9002_GET_LINES. 
*&SPWIZARD:   MODULE TC_9002_CHANGE_FIELD_ATTR 
  ENDLOOP. 
 
* MODULE STATUS_9002. 
* 
PROCESS AFTER INPUT. 
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TC_9002' 
  LOOP AT GT_PART. 
    CHAIN. 
      FIELD GW_PART-PARTNER_FCT. 
      FIELD GW_PART-PARTNER_NO. 
      FIELD GW_PART-DISPLAY_TYPE. 
      FIELD GW_PART-NO_TYPE. 
      FIELD GW_PART-ADDR_NP. 
      MODULE TC_9002_MODIFY ON CHAIN-REQUEST. 
    endchain. 
  ENDLOOP. 
  MODULE TC_9002_USER_COMMAND. 
*&SPWIZARD: MODULE TC_9002_CHANGE_TC_ATTR. 
*&SPWIZARD: MODULE TC_9002_CHANGE_COL_ATTR. 
 
* MODULE USER_COMMAND_9002.

TAB STRIP逻辑流:

PROCESS BEFORE OUTPUT. 
*&SPWIZARD: PBO FLOW LOGIC FOR TABSTRIP 'TS_ITEM' 
  MODULE TS_ITEM_ACTIVE_TAB_SET. 
  CALL SUBSCREEN: 
       9031_SCA INCLUDING G_TS_ITEM-PROG '9031', 
       9032_SCA INCLUDING G_TS_ITEM-PROG '9032', 
       9033_SCA INCLUDING G_TS_ITEM-PROG '9033', 
       9034_SCA INCLUDING G_TS_ITEM-PROG '9034', 
       9035_SCA INCLUDING G_TS_ITEM-PROG '9035', 
       9036_SCA INCLUDING G_TS_ITEM-PROG '9036'. 
  MODULE MOD_SET_TAB_VISIABLE. 
* MODULE STATUS_9003. 
* 
PROCESS AFTER INPUT. 
*&SPWIZARD: PAI FLOW LOGIC FOR TABSTRIP 'TS_ITEM' 
  CALL SUBSCREEN: 
       9031_SCA, 
       9032_SCA, 
       9033_SCA, 
       9034_SCA, 
       9035_SCA, 
       9036_SCA. 
  MODULE TS_ITEM_ACTIVE_TAB_GET. 
* MODULE USER_COMMAND_9003.

不管是主屏幕还是子屏幕,逻辑流处理顺序都是自上而下,从左到右。所以在一些关联控制的时候,需要做好屏幕和处理逻辑的顺序。

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/18660.html

(0)
上一篇 2021年7月19日 21:21
下一篇 2021年7月19日 21:21

相关推荐

发表回复

登录后才能评论