赞
踩
维护bom的人员,可能把bom里面的 项目删除了,但是留着空bom,会导致后续的一些业务问题,搞一个报表,把空bom的清单给出来,这样就很好处理了。
重点上代码
- *&---------------------------------------------------------------------*
- *& REPORT ZRPT_MM_BOM_NULL_GET
- *&
- *&---------------------------------------------------------------------*
- *& author 8256
- *& date 20210118
- *& from
- *& Tcode
- *&---------------------------------------------------------------------*
- REPORT ZRPT_MM_BOM_NULL_GET.
-
- TABLES: MAST,mara.
-
- SELECTION-SCREEN BEGIN OF BLOCK 001 WITH FRAME TITLE TEXT-001.
- SELECT-OPTIONS S_MATNR FOR MAST-MATNR. "物料编号
- SELECT-OPTIONS S_WERKS FOR MAST-WERKS. "工厂
- SELECT-OPTIONS S_STLAN FOR MAST-STLAN. "物料清单用途
- SELECT-OPTIONS S_STLNR FOR MAST-STLNR. "物料单
- SELECT-OPTIONS S_STLAL FOR MAST-STLAL. "可选的 BOM
- PARAMETERS:pLVORM like mara-LVORM."删除标记
- SELECTION-SCREEN END OF BLOCK 001.
-
- TYPES:
- BEGIN OF TYP_DATA,
- MATNR TYPE MAST-MATNR, "物料编号
- WERKS TYPE MAST-WERKS, "工厂
- STLAN TYPE MAST-STLAN, "物料清单用途
- STLNR TYPE MAST-STLNR, "物料单
- STLAL TYPE MAST-STLAL, "可选的 BOM
- LOSVN TYPE MAST-LOSVN, "从批量
- LOSBS TYPE MAST-LOSBS, "到批量
- ANDAT TYPE MAST-ANDAT, "日期记录创建于
- ANNAM TYPE MAST-ANNAM, "创建记录的用户
- AEDAT TYPE MAST-AEDAT, "更改日期
- AENAM TYPE MAST-AENAM, "对象更改人员的名称
- CSLTY TYPE MAST-CSLTY, "标志: 配置物料(物料变式)
- LVORM TYPE MARA-LVORM, "删除标记
- END OF TYP_DATA.
- DATA:
- STDATUM LIKE SY-DATUM,
- STUZEIT LIKE SY-UZEIT,
- GT_DATA TYPE TABLE OF TYP_DATA,
- GS_DATA TYPE TYP_DATA,
- GT_FIELDCAT TYPE LVC_T_FCAT,
- GS_FIELDCAT TYPE LVC_S_FCAT,
- GS_LAYOUT TYPE LVC_S_LAYO.
- INITIALIZATION.
- %_S_MATNR_%_APP_%-TEXT = '物料编号'.
- %_S_WERKS_%_APP_%-TEXT = '工厂'.
- %_S_STLAN_%_APP_%-TEXT = '物料清单用途'.
- %_S_STLNR_%_APP_%-TEXT = '物料单'.
- %_S_STLAL_%_APP_%-TEXT = '可选的 BOM'.
- %_PLVORM_%_APP_%-TEXT = '删除'.
- START-OF-SELECTION.
- STDATUM = SY-DATUM.
- STUZEIT = SY-UZEIT.
- PERFORM GET_DATA.
- PERFORM PROCESS_DATA.
- PERform WRITERPTRUNRECORD.
- PERFORM DISPLAY_DATA.
- *&---------------------------------------------------------------------*
- *& FORM GET_DATA
- *&---------------------------------------------------------------------*
- * 获取数据
- *----------------------------------------------------------------------*
- FORM GET_DATA.
- SELECT
- MAST~MATNR "物料编号
- MAST~WERKS "工厂
- MAST~STLAN "物料清单用途
- MAST~STLNR "物料单
- MAST~STLAL "可选的 BOM
- MAST~LOSVN "从批量
- MAST~LOSBS "到批量
- MAST~ANDAT "日期记录创建于
- MAST~ANNAM "创建记录的用户
- MAST~AEDAT "更改日期
- MAST~AENAM "对象更改人员的名称
- MAST~CSLTY "标志: 配置物料(物料变式)
- MARA~LVORM
- INTO TABLE GT_DATA
- FROM MAST
- JOIN MARA ON MARA~MATNR = MAST~MATNR
- WHERE MAST~MATNR IN S_MATNR
- AND MARA~LVORM = PLVORM
- AND MAST~WERKS IN S_WERKS
- AND MAST~STLAN IN S_STLAN
- AND MAST~STLNR IN S_STLNR
- AND MAST~STLAL IN S_STLAL and
- MAST~STLNR not in ( select STLNR from STPO ) and
- MAST~STLNR not in ( select STLNR from STAS )."永久bom
- ENDFORM. "GET_DATA
- *&---------------------------------------------------------------------*
- *& FORM WRITERPTRUNRECORD
- *&---------------------------------------------------------------------*
- * 获取数据
- *----------------------------------------------------------------------*
- FORM WRITERPTRUNRECORD.
- GET TIME.
- CALL FUNCTION 'ZSYS_RPT_RUNRECORD'
- EXPORTING
- TCODE = SY-TCODE
- PROGRAMM = SY-CPROG
- * bukrs = GS_BW-BUKRS
- * werks = GS_BW-werks
- DATUMRST = STDATUM
- UZEITRST = STUZEIT
- BATCH = SY-BATCH
- DATUMREND = SY-datum
- UZEITREND = sy-UZEIT
- DATUMC = '20210118'
- RUNNER = SY-UNAME
- RPTSRC = 'BOM维护' .
- ENDFORM. "WRITERPTRUNRECORD
- *&---------------------------------------------------------------------*
- *& FORM PROCESS_DATA
- *&---------------------------------------------------------------------*
- * 处理数据
- *----------------------------------------------------------------------*
- FORM PROCESS_DATA.
-
- ENDFORM. "PROCESS_DATA
- *&---------------------------------------------------------------------*
- *& Form BUILD_FIELDCAT
- *&---------------------------------------------------------------------*
- * TEXT
- *----------------------------------------------------------------------*
- FORM BUILD_FIELDCAT USING P_FIELDNAME TYPE FIELDNAME
- P_QFIELDNAME TYPE LVC_QFNAME
- P_CFIELDNAME TYPE LVC_CFNAME
- P_REF_TABLE TYPE LVC_RTNAME
- P_REF_FIELD TYPE LVC_RFNAME
- P_CONVEXIT TYPE CONVEXIT
- P_EMPHASIZE TYPE LVC_EMPHSZ
- P_SCRTEXT_L TYPE SCRTEXT_L
- P_NO_ZERO TYPE XFLAG.
- GS_FIELDCAT-FIELDNAME = P_FIELDNAME.
- GS_FIELDCAT-QFIELDNAME = P_QFIELDNAME.
- GS_FIELDCAT-CFIELDNAME = P_CFIELDNAME.
- GS_FIELDCAT-REF_TABLE = P_REF_TABLE.
- GS_FIELDCAT-REF_FIELD = P_REF_FIELD.
- GS_FIELDCAT-CONVEXIT = P_CONVEXIT.
- GS_FIELDCAT-EMPHASIZE = P_EMPHASIZE.
- GS_FIELDCAT-SCRTEXT_L = P_SCRTEXT_L.
- GS_FIELDCAT-NO_ZERO = P_NO_ZERO.
- GS_FIELDCAT-COLDDICTXT = 'L'.
- APPEND GS_FIELDCAT TO GT_FIELDCAT.
- CLEAR: GS_FIELDCAT.
- ENDFORM. "BUILD_FIELDCAT
- *&---------------------------------------------------------------------*
- *& FORM DISPLAY_DATA
- *&---------------------------------------------------------------------*
- * 显示数据
- *----------------------------------------------------------------------*
- FORM DISPLAY_DATA.
- PERFORM BUILD_FIELDCAT USING 'MATNR' '' '' 'MAST' 'MATNR' '' '' '物料编号' 'X'.
- PERFORM BUILD_FIELDCAT USING 'WERKS' '' '' 'MAST' 'WERKS' '' '' '工厂' ''.
- PERFORM BUILD_FIELDCAT USING 'STLAN' '' '' 'MAST' 'STLAN' '' '' '物料清单用途' ''.
- PERFORM BUILD_FIELDCAT USING 'STLNR' '' '' 'MAST' 'STLNR' '' '' '物料单' ''.
- PERFORM BUILD_FIELDCAT USING 'STLAL' '' '' 'MAST' 'STLAL' '' '' '可选的 BOM' ''.
- PERFORM BUILD_FIELDCAT USING 'LOSVN' '' '' 'MAST' 'LOSVN' '' '' '从批量' ''.
- PERFORM BUILD_FIELDCAT USING 'LOSBS' '' '' 'MAST' 'LOSBS' '' '' '到批量' ''.
- PERFORM BUILD_FIELDCAT USING 'ANDAT' '' '' 'MAST' 'ANDAT' '' '' '日期记录创建于' ''.
- PERFORM BUILD_FIELDCAT USING 'ANNAM' '' '' 'MAST' 'ANNAM' '' '' '创建记录的用户' ''.
- PERFORM BUILD_FIELDCAT USING 'AEDAT' '' '' 'MAST' 'AEDAT' '' '' '更改日期' ''.
- PERFORM BUILD_FIELDCAT USING 'AENAM' '' '' 'MAST' 'AENAM' '' '' '对象更改人员的名称' ''.
- PERFORM BUILD_FIELDCAT USING 'CSLTY' '' '' 'MAST' 'CSLTY' '' '' '标志: 配置物料(物料变式)' ''.
- PERFORM BUILD_FIELDCAT USING 'LVORM' '' '' 'MARA' 'LVORM' '' '' '集团级的删除' ''.
-
- gs_layout-cwidth_opt = 'X'.
- gs_layout-zebra = 'X'.
-
- CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
- EXPORTING
- I_CALLBACK_PROGRAM = SY-REPID
- " I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_ALV'
- I_CALLBACK_USER_COMMAND = 'USER_COMMAND_ALV'
- IT_FIELDCAT_LVC = GT_FIELDCAT
- IS_LAYOUT_LVC = GS_LAYOUT
- I_DEFAULT = 'X'
- I_SAVE = 'A'
- TABLES
- T_OUTTAB = GT_DATA
- EXCEPTIONS
- OTHERS = 1.
- ENDFORM. "DISPLAY_DATA
- **&---------------------------------------------------------------------*
- **& FORM PF_STATUS_ALV
- **&---------------------------------------------------------------------*
- ** TEXT
- **----------------------------------------------------------------------*
- *FORM PF_STATUS_ALV USING RT_EXTAB TYPE SLIS_T_EXTAB .
- * SET PF-STATUS 'STATUS_ALV' EXCLUDING RT_EXTAB.
- *ENDFORM. "PF_STATUS_ALV
- *&---------------------------------------------------------------------*
- *& FORM USER_COMMAND_ALV
- *&---------------------------------------------------------------------*
- * TEXT
- *----------------------------------------------------------------------*
- FORM USER_COMMAND_ALV USING R_UCOMM LIKE SY-UCOMM
- RS_SELFIELD TYPE SLIS_SELFIELD.
- CASE R_UCOMM.
- WHEN '&IC1'.
- CASE RS_SELFIELD-FIELDNAME.
- WHEN ''.
- * CHECK RS_SELFIELD-VALUE IS NOT INITIAL.
- * SET PARAMETER ID 'MBN' FIELD RS_SELFIELD-VALUE.
- * CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN.
- ENDCASE.
- ENDCASE.
- ENDFORM. "USER_COMMAND_ALV
空bom的删除处理
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。