• 在屏幕上建立ALV


    在屏幕上创建两个文本元素空件、一个推出按钮控件、一个定制控制按钮

    代码所示:

    *&---------------------------------------------------------------------*
    *& Report  YTEST028
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*
    
    REPORT  ytest028.
    
    
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    
    DATA WA_SPFLI TYPE TABLE OF SPFLI ."WITH HEADER LINE.
    
    SELECT * INTO TABLE WA_SPFLI FROM SPFLI.
    
    DATA:WA_CONTAINER TYPE SCRFNAME VALUE 'ALVDATA',
          ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
         WA_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    
    CALL SCREEN 300.
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0300  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    
    MODULE status_0300 OUTPUT.
      SET PF-STATUS 'STATUS1'.
    *  SET TITLEBAR 'xxx'.
    
    
    *如果窗口还没有创建ALV对象则它
    IF WA_CUSTOM_CONTAINER IS INITIAL.
      CREATE OBJECT WA_CUSTOM_CONTAINER
      EXPORTING CONTAINER_NAME = WA_CONTAINER.
      CREATE OBJECT ALV_GRID
      EXPORTING I_PARENT = WA_CUSTOM_CONTAINER.
      CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING I_STRUCTURE_NAME = 'SPFLI'
      CHANGING IT_OUTTAB = WA_SPFLI.
    
    ENDIF.
    
    ENDMODULE.                 " STATUS_0300  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  EXIT  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE exit INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " EXIT  INPUT
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0300  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    module USER_COMMAND_0300 input.
    
    endmodule.                 " USER_COMMAND_0300  INPUT

    运行结果:

  • 相关阅读:
    C语言位操作
    Ribbon负载规则的替换
    Nginx 的配置文件
    Nginx 操作常用的命令
    Nginx 是什么?
    SpringCloud Eureka 新版本依赖
    @Autowired 与@Resource的区别
    spring 注释
    redis 的 rdb 和 aof 持久化的区别
    jdk1.7下HashMap的头插法问题
  • 原文地址:https://www.cnblogs.com/caizjian/p/3357203.html
Copyright © 2020-2023  润新知