zoukankan      html  css  js  c++  java
  • MB52增强

    一、在MB52报表中新增字段

    实现如图效果

    二、增强实现

    MB52程序为RM07MLBS,在程序中找到定义的内表结构bestand,在最后创建隐式增强,加入增强字段,该内表为将来展示的ALV数据

    设置ALV列,在子例程最后创建隐式增强,加入列字段,在子例程fieldcatalog和f0300_fieldcat_flat中都添加

    "-----------------------------fieldcatalog-------------------------------
    ENHANCEMENT 2  ZMB52.    "active version
      CLEAR fieldcat.
      fieldcat-fieldname     = 'ZKHMC'.
      fieldcat-seltext_l = fieldcat-seltext_s     =  fieldcat-seltext_m     = '客户名称'.
      APPEND fieldcat.
    
        CLEAR fieldcat.
      fieldcat-fieldname     = 'POST1'.
      fieldcat-seltext_l = fieldcat-seltext_s     =  fieldcat-seltext_m     = 'WBS名称'.
      APPEND fieldcat.
    
        CLEAR fieldcat.
      fieldcat-fieldname     = 'PSPHI'.
      fieldcat-seltext_l = fieldcat-seltext_s     =  fieldcat-seltext_m     = '项目号'.
      APPEND fieldcat.
    
        CLEAR fieldcat.
      fieldcat-fieldname     = 'ZXMMC'.
      fieldcat-seltext_l = fieldcat-seltext_s     =  fieldcat-seltext_m     = '项目名称'.
      APPEND fieldcat.
    
    ENDENHANCEMENT.
    
    "-----------------------------f0300_fieldcat_flat-----------------------
    fieldcat-seltext_l     = '客户名称'.
            macro_fill_fieldcat 'ZKHMC'  ''   c_out.
            fieldcat-seltext_l     = 'WBS名称'.
            macro_fill_fieldcat 'POST1'  ''   c_out.
            fieldcat-seltext_l     = '项目号'.
            macro_fill_fieldcat 'PSPHI'  ''   c_out.
            fieldcat-seltext_l     = '项目名称'.
            macro_fill_fieldcat 'ZXMMC'  ''   c_out.

    获取数据,在子例程list_output中加入隐式增强,查询字段的数据

    FORM list_output.
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$SE:(3) Form LIST_OUTPUT, Anfang                                                                                                                          A
    *$*$-Start: (3)---------------------------------------------------------------------------------$*$*
    ENHANCEMENT 3  ZMB52.    "active version
      data:l_index type i.
      DATA:LT_CHAR TYPE TABLE OF BAPI1003_ALLOC_VALUES_CHAR WITH HEADER LINE.
      IF bestand[] IS NOT INITIAL.
        SELECT
          KUNNR,
          NAME1
        FROM KNA1
        INTO TABLE @DATA(LT_KNA1)
        FOR ALL ENTRIES IN @bestand
        WHERE KUNNR = @bestand-KUNNR.
    
        SELECT
          PRPS~PSPNR,
          PRPS~POST1,"WBS名称
          PRPS~PSPHI,"项目号
          PROJ~POST1 AS ZXMMC"项目名称
        FROM PRPS
        INNER JOIN PROJ ON PRPS~PSPHI = PROJ~PSPNR
        INTO TABLE @DATA(LT_PRPS)
        FOR ALL ENTRIES IN @bestand
        WHERE PRPS~PSPNR = @bestand-PSPNR.
      ENDIF.
    
      LOOP AT bestand  .
        l_index = sy-tabix.
        
        "客户名称
        READ TABLE lt_kna1 INTO DATA(ls_kna1) WITH KEY kunnr = bestand-kunnr.
        IF sy-subrc EQ 0.
          bestand-zkhmc = ls_kna1-name1.
        ENDIF.
    
        READ TABLE LT_PRPS INTO DATA(LS_PRPS) WITH KEY PSPNR = bestand-PSPNR.
        IF SY-SUBRC EQ 0.
          bestand-POST1 = LS_PRPS-POST1.
          bestand-PSPHI = LS_PRPS-PSPHI.
          bestand-ZXMMC = LS_PRPS-ZXMMC.
        ENDIF.
    
        MODIFY bestand INDEX l_index.
      ENDLOOP.
    ENDENHANCEMENT.
  • 相关阅读:
    微信小程序(三)-事件绑定
    微信小程序(二)-语法学习
    微信小程序(一)-工具创建和结构配置说明 Stable Build
    ============================================ 微信小程序开发学习
    Vue学习笔记-Vue.js-2.X 学习(七)===>脚手架Vue-CLI(路由Router)
    Vue学习笔记-Vue.js-2.X 学习(六)===>脚手架Vue-CLI(项目说明-Babel)
    Vue学习笔记-Vue.js-2.X 学习(五)===>脚手架Vue-CLI(PyCharm)
    linux打包压缩命令汇总
    js中函数之函数名带括号与不带括号的区别
    $_FILES error(笔记)
  • 原文地址:https://www.cnblogs.com/BinGeneral/p/15459189.html
Copyright © 2011-2022 走看看