当前位置:   article > 正文

SAP PP 空bom 清单及处理_sap系统维护过bom,但是bom显示不算

sap系统维护过bom,但是bom显示不算

 维护bom的人员,可能把bom里面的 项目删除了,但是留着空bom,会导致后续的一些业务问题,搞一个报表,把空bom的清单给出来,这样就很好处理了。

 

 

重点上代码

  1. *&---------------------------------------------------------------------*
  2. *& REPORT ZRPT_MM_BOM_NULL_GET
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *& author 8256
  6. *& date 20210118
  7. *& from
  8. *& Tcode
  9. *&---------------------------------------------------------------------*
  10. REPORT ZRPT_MM_BOM_NULL_GET.
  11. TABLES: MAST,mara.
  12. SELECTION-SCREEN BEGIN OF BLOCK 001 WITH FRAME TITLE TEXT-001.
  13. SELECT-OPTIONS S_MATNR FOR MAST-MATNR. "物料编号
  14. SELECT-OPTIONS S_WERKS FOR MAST-WERKS. "工厂
  15. SELECT-OPTIONS S_STLAN FOR MAST-STLAN. "物料清单用途
  16. SELECT-OPTIONS S_STLNR FOR MAST-STLNR. "物料单
  17. SELECT-OPTIONS S_STLAL FOR MAST-STLAL. "可选的 BOM
  18. PARAMETERS:pLVORM like mara-LVORM."删除标记
  19. SELECTION-SCREEN END OF BLOCK 001.
  20. TYPES:
  21. BEGIN OF TYP_DATA,
  22. MATNR TYPE MAST-MATNR, "物料编号
  23. WERKS TYPE MAST-WERKS, "工厂
  24. STLAN TYPE MAST-STLAN, "物料清单用途
  25. STLNR TYPE MAST-STLNR, "物料单
  26. STLAL TYPE MAST-STLAL, "可选的 BOM
  27. LOSVN TYPE MAST-LOSVN, "从批量
  28. LOSBS TYPE MAST-LOSBS, "到批量
  29. ANDAT TYPE MAST-ANDAT, "日期记录创建于
  30. ANNAM TYPE MAST-ANNAM, "创建记录的用户
  31. AEDAT TYPE MAST-AEDAT, "更改日期
  32. AENAM TYPE MAST-AENAM, "对象更改人员的名称
  33. CSLTY TYPE MAST-CSLTY, "标志: 配置物料(物料变式)
  34. LVORM TYPE MARA-LVORM, "删除标记
  35. END OF TYP_DATA.
  36. DATA:
  37. STDATUM LIKE SY-DATUM,
  38. STUZEIT LIKE SY-UZEIT,
  39. GT_DATA TYPE TABLE OF TYP_DATA,
  40. GS_DATA TYPE TYP_DATA,
  41. GT_FIELDCAT TYPE LVC_T_FCAT,
  42. GS_FIELDCAT TYPE LVC_S_FCAT,
  43. GS_LAYOUT TYPE LVC_S_LAYO.
  44. INITIALIZATION.
  45. %_S_MATNR_%_APP_%-TEXT = '物料编号'.
  46. %_S_WERKS_%_APP_%-TEXT = '工厂'.
  47. %_S_STLAN_%_APP_%-TEXT = '物料清单用途'.
  48. %_S_STLNR_%_APP_%-TEXT = '物料单'.
  49. %_S_STLAL_%_APP_%-TEXT = '可选的 BOM'.
  50. %_PLVORM_%_APP_%-TEXT = '删除'.
  51. START-OF-SELECTION.
  52. STDATUM = SY-DATUM.
  53. STUZEIT = SY-UZEIT.
  54. PERFORM GET_DATA.
  55. PERFORM PROCESS_DATA.
  56. PERform WRITERPTRUNRECORD.
  57. PERFORM DISPLAY_DATA.
  58. *&---------------------------------------------------------------------*
  59. *& FORM GET_DATA
  60. *&---------------------------------------------------------------------*
  61. * 获取数据
  62. *----------------------------------------------------------------------*
  63. FORM GET_DATA.
  64. SELECT
  65. MAST~MATNR "物料编号
  66. MAST~WERKS "工厂
  67. MAST~STLAN "物料清单用途
  68. MAST~STLNR "物料单
  69. MAST~STLAL "可选的 BOM
  70. MAST~LOSVN "从批量
  71. MAST~LOSBS "到批量
  72. MAST~ANDAT "日期记录创建于
  73. MAST~ANNAM "创建记录的用户
  74. MAST~AEDAT "更改日期
  75. MAST~AENAM "对象更改人员的名称
  76. MAST~CSLTY "标志: 配置物料(物料变式)
  77. MARA~LVORM
  78. INTO TABLE GT_DATA
  79. FROM MAST
  80. JOIN MARA ON MARA~MATNR = MAST~MATNR
  81. WHERE MAST~MATNR IN S_MATNR
  82. AND MARA~LVORM = PLVORM
  83. AND MAST~WERKS IN S_WERKS
  84. AND MAST~STLAN IN S_STLAN
  85. AND MAST~STLNR IN S_STLNR
  86. AND MAST~STLAL IN S_STLAL and
  87. MAST~STLNR not in ( select STLNR from STPO ) and
  88. MAST~STLNR not in ( select STLNR from STAS )."永久bom
  89. ENDFORM. "GET_DATA
  90. *&---------------------------------------------------------------------*
  91. *& FORM WRITERPTRUNRECORD
  92. *&---------------------------------------------------------------------*
  93. * 获取数据
  94. *----------------------------------------------------------------------*
  95. FORM WRITERPTRUNRECORD.
  96. GET TIME.
  97. CALL FUNCTION 'ZSYS_RPT_RUNRECORD'
  98. EXPORTING
  99. TCODE = SY-TCODE
  100. PROGRAMM = SY-CPROG
  101. * bukrs = GS_BW-BUKRS
  102. * werks = GS_BW-werks
  103. DATUMRST = STDATUM
  104. UZEITRST = STUZEIT
  105. BATCH = SY-BATCH
  106. DATUMREND = SY-datum
  107. UZEITREND = sy-UZEIT
  108. DATUMC = '20210118'
  109. RUNNER = SY-UNAME
  110. RPTSRC = 'BOM维护' .
  111. ENDFORM. "WRITERPTRUNRECORD
  112. *&---------------------------------------------------------------------*
  113. *& FORM PROCESS_DATA
  114. *&---------------------------------------------------------------------*
  115. * 处理数据
  116. *----------------------------------------------------------------------*
  117. FORM PROCESS_DATA.
  118. ENDFORM. "PROCESS_DATA
  119. *&---------------------------------------------------------------------*
  120. *& Form BUILD_FIELDCAT
  121. *&---------------------------------------------------------------------*
  122. * TEXT
  123. *----------------------------------------------------------------------*
  124. FORM BUILD_FIELDCAT USING P_FIELDNAME TYPE FIELDNAME
  125. P_QFIELDNAME TYPE LVC_QFNAME
  126. P_CFIELDNAME TYPE LVC_CFNAME
  127. P_REF_TABLE TYPE LVC_RTNAME
  128. P_REF_FIELD TYPE LVC_RFNAME
  129. P_CONVEXIT TYPE CONVEXIT
  130. P_EMPHASIZE TYPE LVC_EMPHSZ
  131. P_SCRTEXT_L TYPE SCRTEXT_L
  132. P_NO_ZERO TYPE XFLAG.
  133. GS_FIELDCAT-FIELDNAME = P_FIELDNAME.
  134. GS_FIELDCAT-QFIELDNAME = P_QFIELDNAME.
  135. GS_FIELDCAT-CFIELDNAME = P_CFIELDNAME.
  136. GS_FIELDCAT-REF_TABLE = P_REF_TABLE.
  137. GS_FIELDCAT-REF_FIELD = P_REF_FIELD.
  138. GS_FIELDCAT-CONVEXIT = P_CONVEXIT.
  139. GS_FIELDCAT-EMPHASIZE = P_EMPHASIZE.
  140. GS_FIELDCAT-SCRTEXT_L = P_SCRTEXT_L.
  141. GS_FIELDCAT-NO_ZERO = P_NO_ZERO.
  142. GS_FIELDCAT-COLDDICTXT = 'L'.
  143. APPEND GS_FIELDCAT TO GT_FIELDCAT.
  144. CLEAR: GS_FIELDCAT.
  145. ENDFORM. "BUILD_FIELDCAT
  146. *&---------------------------------------------------------------------*
  147. *& FORM DISPLAY_DATA
  148. *&---------------------------------------------------------------------*
  149. * 显示数据
  150. *----------------------------------------------------------------------*
  151. FORM DISPLAY_DATA.
  152. PERFORM BUILD_FIELDCAT USING 'MATNR' '' '' 'MAST' 'MATNR' '' '' '物料编号' 'X'.
  153. PERFORM BUILD_FIELDCAT USING 'WERKS' '' '' 'MAST' 'WERKS' '' '' '工厂' ''.
  154. PERFORM BUILD_FIELDCAT USING 'STLAN' '' '' 'MAST' 'STLAN' '' '' '物料清单用途' ''.
  155. PERFORM BUILD_FIELDCAT USING 'STLNR' '' '' 'MAST' 'STLNR' '' '' '物料单' ''.
  156. PERFORM BUILD_FIELDCAT USING 'STLAL' '' '' 'MAST' 'STLAL' '' '' '可选的 BOM' ''.
  157. PERFORM BUILD_FIELDCAT USING 'LOSVN' '' '' 'MAST' 'LOSVN' '' '' '从批量' ''.
  158. PERFORM BUILD_FIELDCAT USING 'LOSBS' '' '' 'MAST' 'LOSBS' '' '' '到批量' ''.
  159. PERFORM BUILD_FIELDCAT USING 'ANDAT' '' '' 'MAST' 'ANDAT' '' '' '日期记录创建于' ''.
  160. PERFORM BUILD_FIELDCAT USING 'ANNAM' '' '' 'MAST' 'ANNAM' '' '' '创建记录的用户' ''.
  161. PERFORM BUILD_FIELDCAT USING 'AEDAT' '' '' 'MAST' 'AEDAT' '' '' '更改日期' ''.
  162. PERFORM BUILD_FIELDCAT USING 'AENAM' '' '' 'MAST' 'AENAM' '' '' '对象更改人员的名称' ''.
  163. PERFORM BUILD_FIELDCAT USING 'CSLTY' '' '' 'MAST' 'CSLTY' '' '' '标志: 配置物料(物料变式)' ''.
  164. PERFORM BUILD_FIELDCAT USING 'LVORM' '' '' 'MARA' 'LVORM' '' '' '集团级的删除' ''.
  165. gs_layout-cwidth_opt = 'X'.
  166. gs_layout-zebra = 'X'.
  167. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
  168. EXPORTING
  169. I_CALLBACK_PROGRAM = SY-REPID
  170. " I_CALLBACK_PF_STATUS_SET = 'PF_STATUS_ALV'
  171. I_CALLBACK_USER_COMMAND = 'USER_COMMAND_ALV'
  172. IT_FIELDCAT_LVC = GT_FIELDCAT
  173. IS_LAYOUT_LVC = GS_LAYOUT
  174. I_DEFAULT = 'X'
  175. I_SAVE = 'A'
  176. TABLES
  177. T_OUTTAB = GT_DATA
  178. EXCEPTIONS
  179. OTHERS = 1.
  180. ENDFORM. "DISPLAY_DATA
  181. **&---------------------------------------------------------------------*
  182. **& FORM PF_STATUS_ALV
  183. **&---------------------------------------------------------------------*
  184. ** TEXT
  185. **----------------------------------------------------------------------*
  186. *FORM PF_STATUS_ALV USING RT_EXTAB TYPE SLIS_T_EXTAB .
  187. * SET PF-STATUS 'STATUS_ALV' EXCLUDING RT_EXTAB.
  188. *ENDFORM. "PF_STATUS_ALV
  189. *&---------------------------------------------------------------------*
  190. *& FORM USER_COMMAND_ALV
  191. *&---------------------------------------------------------------------*
  192. * TEXT
  193. *----------------------------------------------------------------------*
  194. FORM USER_COMMAND_ALV USING R_UCOMM LIKE SY-UCOMM
  195. RS_SELFIELD TYPE SLIS_SELFIELD.
  196. CASE R_UCOMM.
  197. WHEN '&IC1'.
  198. CASE RS_SELFIELD-FIELDNAME.
  199. WHEN ''.
  200. * CHECK RS_SELFIELD-VALUE IS NOT INITIAL.
  201. * SET PARAMETER ID 'MBN' FIELD RS_SELFIELD-VALUE.
  202. * CALL TRANSACTION 'MB03' AND SKIP FIRST SCREEN.
  203. ENDCASE.
  204. ENDCASE.
  205. ENDFORM. "USER_COMMAND_ALV

空bom的删除处理

 

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号