• SAP 文本框实例


    SAP 文本框 简单实例

    REPORT ZTEST001.
    
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM.
    
    DATA: REF_EDIT_CTN TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          REF_EDIT     TYPE REF TO CL_GUI_TEXTEDIT.
    
    TYPES: OUTTXT(100).
    DATA: GTLINE TYPE STANDARD TABLE OF OUTTXT,
          GWLINE TYPE OUTTXT.
    *----------------------------------------------------------------------*
    * SCREEN                                                               *
    *----------------------------------------------------------------------*
    *PARAMETERS PARA TYPE CHAR10.
    
    *----------------------------------------------------------------------*
    * START-OF-SELECTION.                                                  *
    *----------------------------------------------------------------------*
    START-OF-SELECTION.
    
     CALL SCREEN 100.
    
     CALL METHOD REF_EDIT->GET_TEXT_AS_R3TABLE
    *   EXPORTING
    *     ONLY_WHEN_MODIFIED     = FALSE
       IMPORTING
         TABLE                  = GTLINE
    *     IS_MODIFIED            =
    *   EXCEPTIONS
    *     ERROR_DP               = 1
    *     ERROR_CNTL_CALL_METHOD = 2
    *     ERROR_DP_CREATE        = 3
    *     POTENTIAL_DATA_LOSS    = 4
    *     OTHERS                 = 5
             .
     IF SY-SUBRC <> 0.
    *  Implement suitable error handling here
     ENDIF.
    
     LOOP AT GTLINE INTO GWLINE.
       WRITE:/ GWLINE.
     ENDLOOP.
    
    *----------------------------------------------------------------------*
    *                                                                      *
    *----------------------------------------------------------------------*
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'ZTEST001_GS'.
    *  SET TITLEBAR ''.
    
      CHECK REF_EDIT IS INITIAL.
    
      CREATE OBJECT REF_EDIT_CTN
        EXPORTING
    *      PARENT                      =
          CONTAINER_NAME               = 'C'
    *      STYLE                       =
    *      LIFETIME                    = lifetime_default
    *      REPID                       =
    *      DYNNR                       =
    *      NO_AUTODEF_PROGID_DYNNR     =
    *    EXCEPTIONS
    *      CNTL_ERROR                  = 1
    *      CNTL_SYSTEM_ERROR           = 2
    *      CREATE_ERROR                = 3
    *      LIFETIME_ERROR              = 4
    *      LIFETIME_DYNPRO_DYNPRO_LINK = 5
    *      OTHERS                      = 6
          .
      IF SY-SUBRC <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    
      CREATE OBJECT REF_EDIT
        EXPORTING
    *      MAX_NUMBER_CHARS       =
    *      STYLE                  = 0
          WORDWRAP_MODE          = cl_gui_textedit=>WORDWRAP_AT_FIXED_POSITION
          WORDWRAP_POSITION      = -1
          WORDWRAP_TO_LINEBREAK_MODE = cl_gui_textedit=>true
    *      FILEDROP_MODE          = DROPFILE_EVENT_OFF
          PARENT                 = REF_EDIT_CTN
    *      LIFETIME               =
    *      NAME                   =
    *    EXCEPTIONS
    *      ERROR_CNTL_CREATE      = 1
    *      ERROR_CNTL_INIT        = 2
    *      ERROR_CNTL_LINK        = 3
    *      ERROR_DP_CREATE        = 4
    *      GUI_TYPE_NOT_SUPPORTED = 5
    *      OTHERS                 = 6
          .
      IF SY-SUBRC <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    
    ENDMODULE.
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE USER_COMMAND_0100 INPUT.
    
      SAVE_OK = OK_CODE.
    
      CASE SAVE_OK.
        WHEN 'BACK' OR 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CANC'.
          LEAVE TO SCREEN 0.
        WHEN 'CLR'.
          CLEAR GTLINE[].
    
          CALL METHOD REF_EDIT->SET_TEXT_AS_R3TABLE
            EXPORTING
              TABLE           = GTLINE
            EXCEPTIONS
              ERROR_DP        = 1
              ERROR_DP_CREATE = 2
              OTHERS          = 3
                  .
          IF SY-SUBRC <> 0.
    *       Implement suitable error handling here
          ENDIF.
    
      ENDCASE.
    ENDMODULE.
  • 相关阅读:
    Centos6.5下搭建nagios详解
    Centos6.5下升级Python版本
    Python生成随机密码
    配置apache使用https访问
    Irrlicht 论坛好贴 精选(不断补充中...)
    [原创]一个在Irrlicht中会常用的字符串转换函数
    [转]Scrolling Credits Code
    [原创]Irrlicht中的Texture透明色(colorkey)
    [原创]IrrLicht的GUI使用
    [转](C++) How to animate and move an entity
  • 原文地址:https://www.cnblogs.com/datie/p/11495732.html
Copyright © 2020-2023  润新知