ABAP:MM01/MM02/MM03物料主数据增强

1.屏幕增强

-在主表中附加结构(判断数据的主表,如MARA,MARC)

增强字段数据元素勾选更改文档以后,会记录字段变更历史

 


-SPRO-->物流-常规-->物料主数据-->配置物料主记录-->创建定制子屏幕的程序

 会生成对应的函数组--里面会包含两个屏幕(0001,0002)

这里的0001屏幕作为了基本数据1视图的增强子屏幕

这里的0003屏幕作为了成本1视图的增强子屏幕

这里的0004屏幕作为了采购视图的增强子屏幕

 


 0001屏幕:

PROCESS BEFORE OUTPUT.

  MODULE MDL_SET_PBO.

PROCESS AFTER INPUT.

  MODULE MDL_SET_PBI.
*----------------------------------------------------------------------*
***INCLUDE LZFG_MM007O01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module MDL_SET_PBO OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE mdl_set_pbo OUTPUT.

  IF sy-tcode <> 'MM01' AND sy-tcode <> 'MM02'.
    LOOP AT SCREEN.
      IF screen-group1 = 'G1'.
        screen-input = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.
  IF sy-mandt = '300'
  OR sy-mandt = '600'
  OR sy-mandt = '800' .
    LOOP AT SCREEN.
      IF screen-group2 = 'GN'.
        screen-active = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  CALL FUNCTION 'MARA_GET_SUB'
    IMPORTING
      wmara = mara
      xmara = *mara
      ymara = lmara.

ENDMODULE.
*----------------------------------------------------------------------*
***INCLUDE LZFG_MM007I01.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  MDL_SET_PBI  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE MDL_SET_PBI INPUT.
  DATA: LS_MARA_CI TYPE ZSMM0009.

  MOVE-CORRESPONDING MARA TO LS_MARA_CI.

  CALL FUNCTION 'MARA_GET_SUB'
    IMPORTING
      WMARA = MARA
      XMARA = *MARA
      YMARA = LMARA.

  MOVE-CORRESPONDING LS_MARA_CI TO MARA.

  CALL FUNCTION 'MARA_SET_SUB'
    EXPORTING
      WMARA = MARA.

ENDMODULE.

003屏幕

PROCESS BEFORE OUTPUT.
  MODULE init_sub.
  MODULE get_daten_sub.
  MODULE feldauswahl.
  MODULE sonderfaus.
  MODULE sonfausw_in_fgruppen.
  MODULE bildstatus.
  MODULE zusref_vorschlagen_b.
  MODULE refdaten_vorschlagen.
  MODULE zusref_vorschlagen_a.
  MODULE set_daten_sub.
  MODULE get_data.
* MODULE STATUS_0003.
*
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0003.

  MODULE get_daten_sub.

  FIELD: zsmm0064-zzcost.
  MODULE assign_data.

  MODULE set_daten_sub.
*----------------------------------------------------------------------*
***INCLUDE LZFG_MM007O02.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module GET_DATA OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE get_data OUTPUT.
  MOVE-CORRESPONDING marc TO zsmm0064.
ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  ASSIGN_DATA  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE assign_data INPUT.
  MOVE-CORRESPONDING zsmm0064 TO marc.
ENDMODULE.

004屏幕

PROCESS BEFORE OUTPUT.
* MODULE STATUS_0004.
  MODULE init_sub.
  MODULE get_daten_sub.
  MODULE feldauswahl.
  MODULE sonderfaus.
  MODULE sonfausw_in_fgruppen.
  MODULE bildstatus.
  MODULE zusref_vorschlagen_b.
  MODULE refdaten_vorschlagen.
  MODULE zusref_vorschlagen_a.
  MODULE set_daten_sub.
  MODULE get_data.

PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0004.
  MODULE get_daten_sub.

  FIELD: zsmm0064-zzloca.
  MODULE assign_data.

  MODULE set_daten_sub.
*----------------------------------------------------------------------*
***INCLUDE LZFG_MM007O02.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module GET_DATA OUTPUT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
MODULE get_data OUTPUT.
  MOVE-CORRESPONDING marc TO zsmm0064.
ENDMODULE.
*&---------------------------------------------------------------------*
*&      Module  ASSIGN_DATA  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE assign_data INPUT.
  MOVE-CORRESPONDING zsmm0064 TO marc.
ENDMODULE.

-SPRO-->物流-常规-->物料主数据-->配置物料主记录-->定义每个屏幕序列的数据屏幕的结构

 选中21,点击数据屏幕

 


0001屏幕配置:选中基本数据1,点击子屏幕

 


003增强子屏幕配置:


004增强子屏幕配置:


效果展示:


 2.保存前增强

参考:ABAP:MM01物料主数据增强 - 阿胖的阿多 - 博客园 (cnblogs.com)

posted @ 2024-02-18 14:36  阿胖的阿多  阅读(1235)  评论(0编辑  收藏  举报