• 如何给表维护视图创建选择画面[VIEW_RANGETAB_TO_SELLIST]


    通常SAP系统中的表维护视图(sm30)把所有数据都显示在一个屏幕上,没有筛选,如下,左图是sm30,右图是SE11中的表数据显示。

    abap-selection-screen-tmg-1_thumb

    如何要按条件进行筛选,要用到VIEW_RANGETAB_TO_SELLIST创建筛选条件内表,

    b

    例子程序如下:

    简单介绍:

    1, 先创建一个选择画面包含3个range ,s_id,s_name, s_place,

    2, 调用VIEW_RANGETAB_TO_SELLIST创建sm30的筛选条件内表gt_seltab,三个条件之间是and关系。

    3, 调用VIEW_MAINTENANCE_CALL显示表维护视图

    REPORT ZTEST_SM30.
    TABLES: zemployee.
    CONSTANTS: c_view  TYPE   char30  VALUE 'ZEMPLOYEE',
               c_u     TYPE   char1   VALUE 'U',
               c_and   TYPE   char3   VALUE 'AND'.
    DATA: gt_seltab    TYPE STANDARD TABLE OF vimsellist.
    DATA: g_fieldname  TYPE vimsellist-viewfield.
    DATA: gt_exclude   TYPE TABLE OF vimexclfun,
          gwa_exclude  TYPE vimexclfun.
    
    SELECT-OPTIONS: s_id    FOR zemployee-id,
                    s_name  FOR zemployee-name,
                    s_place FOR zemployee-place.
    
    *Add ID column to selection criteria of Table maintenanace view
    g_fieldname = 'ID'.
    
    CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
      EXPORTING
        fieldname          = g_fieldname
        append_conjunction = c_and
      TABLES
        sellist            = gt_seltab
        rangetab           = s_id.
    
    *Add Name column to selection criteria of Table maintenanace view
    g_fieldname = 'NAME'.
    
    CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
      EXPORTING
        fieldname          = g_fieldname
        append_conjunction = c_and
      TABLES
        sellist            = gt_seltab
        rangetab           = s_name.
    
    *Add Place column to selection criteria of Table maintenanace view
    g_fieldname = 'PLACE'.
    
    CALL FUNCTION 'VIEW_RANGETAB_TO_SELLIST'
      EXPORTING
        fieldname          = g_fieldname
        append_conjunction = c_and
      TABLES
        sellist            = gt_seltab
        rangetab           = s_place.
    
    * Call to the 'VIEW_MAINTENANCE_CALL' function module
    CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
      EXPORTING
        action         = c_u
        view_name      = c_view
      TABLES
        dba_sellist    = gt_seltab.

    运行结果:

    选择画面输入筛选条件LONDON,

    abap-selection-screen-tmg-2_thumb

    表维护视图只显示LONDON的数据。

    abap-selection-screen-tmg-3_thumb

    以上。

  • 相关阅读:
    sprigboot2.0升级修改配置细节记录
    MAC 以太坊环镜安装
    python3 scrapy+Crontab部署过程
    python3 程序问题解决列表
    位运算--通过总值分解出子值(解析子值)
    springboot war包在tomcat中运行
    【解决方法】macOS 安装Resin失败:fatal error: 'openssl/ssl.h' file not found
    MAC+VMware+CentOS 6.5 上网配置
    python报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 0 解决方案
    解决mac+idea+tomcat没有日志输出问题
  • 原文地址:https://www.cnblogs.com/datie/p/11435834.html
Copyright © 2020-2023  润新知