如何这样的话 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'EXPORTINGID = LV_IDIMPORTINGE_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'EXPORTINGAUFSW = 'X'CAPID = 'PP01'DATUV = SY-DATUMMEHRS = 'X'
* MDMPS = P_MDMPSEMENG = 1POSTP = 'L'MTNRV = LS_DELTA_MASTB-MATNRWERKS = LS_DELTA_MASTB-WERKS
* IMPORTING
* TOPMAT = T_TOPMAT
* DSTST = IDSTSTTABLESSTB = T_STB
* MATCAT = T_MATCATEXCEPTIONSALT_NOT_FOUND = 1CALL_INVALID = 2MATERIAL_NOT_FOUND = 3MISSING_AUTHORIZATION = 4NO_BOM_FOUND = 5NO_PLANT_DATA = 6NO_SUITABLE_BOM_FOUND = 7CONVERSION_ERROR = 8OTHERS = 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