SAP PP 死循环bom,递归BOM的问题 ,再bom保存时校验
如何这样的话 CS_BOM_EXPL_MAT_V2 跑多层就陷入死循环了
实际校验的 在cs01/cs02的对应的增强里面
METHOD IF_EX_BOM_UPDATE~CHANGE_BEFORE_UPDATE.
DATA:
LV_ID TYPE ZTEXIT-ID, "增强序列号
LV_STATUS TYPE CHAR1. "增强状态
DATA :LS_DELTA_MASTB TYPE MASTB.
DATA :LS_DELTA_STPOB TYPE STPOB.
DATA: T_STB TYPE TABLE OF STPOX.
LV_ID = 'ZMM130'."循环bom的校验
CALL FUNCTION 'ZABAP_CHECK_EXIT'
EXPORTING
ID = LV_ID
IMPORTING
E_STATUS = LV_STATUS.
IF LV_STATUS = 'S'.
LOOP AT DELTA_MASTB INTO LS_DELTA_MASTB.
LOOP AT DELTA_STPOB INTO LS_DELTA_STPOB WHERE STLNR = LS_DELTA_MASTB-STLNR.
CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
EXPORTING
AUFSW = 'X'
CAPID = 'PP01'
DATUV = SY-DATUM
MEHRS = 'X'
* MDMPS = P_MDMPS
EMENG = 1
POSTP = 'L'
MTNRV = LS_DELTA_MASTB-MATNR
WERKS = LS_DELTA_MASTB-WERKS
* IMPORTING
* TOPMAT = T_TOPMAT
* DSTST = IDSTST
TABLES
STB = T_STB
* MATCAT = T_MATCAT
EXCEPTIONS
ALT_NOT_FOUND = 1
CALL_INVALID = 2
MATERIAL_NOT_FOUND = 3
MISSING_AUTHORIZATION = 4
NO_BOM_FOUND = 5
NO_PLANT_DATA = 6
NO_SUITABLE_BOM_FOUND = 7
CONVERSION_ERROR = 8
OTHERS = 9.
IF SY-SUBRC = 0.
DELETE ADJACENT DUPLICATES FROM T_STB COMPARING WERKS IDNRK.
LOOP AT T_STB INTO DATA(LSTP).
IF LSTP-IDNRK = LS_DELTA_MASTB-MATNR.
MESSAGE E001(00) WITH '循环BOM,不能保存!'.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDMETHOD.
效果
写于 浙江 台州 20241218