All right, today's colleague let's make a BOM component material repeat check
There are many examples on the web that were checked at the time of the preservation, using badi:bom_update
I also tried, trouble .... Very troublesome ... Especially when repeating a check:
METHODIf_ex_bom_update~change_at_save. DATA: Z_stpobTYPE Line ofCs01_stpob_tab, Z_stpob1TYPE Line ofCs01_stpob_tab, G_tab_bstpobTYPE TABLE ofStpob, G_tab_astpobTYPE TABLE ofStpob, Z_msgTYPE string, Count1TYPEI, Count2TYPEi.DATA: Lv_timeTYPEi. Count1=lines (DELTA_STASB). Count2=lines (DELTA_STPOB).*IF count2 > Count1. LOOP atDelta_stpob intoZ_stpob. APPENDZ_stpob toG_tab_bstpob. IFSy-tabix <=Count1. ELSE. APPENDZ_stpob toG_tab_astpob. ENDIF. Endloop. LOOP atG_tab_astpob intoZ_stpob. CLEAR: Lv_time. LOOP atG_tab_bstpob intoZ_stpob1WHEREIDNRK = z_stpob-IDNRK. Lv_time= Lv_time +1. Endloop. IFLv_time >1. concatenateZ_msg'Project'Z_stpob-posnr'Component Duplication/' intoz_msg. ENDIF. Endloop. MESSAGEZ_msgTYPE 'E'. RETURN.*EXIT. EndMethod.
Later, the debug standard program, found a very suitable place:
Function: Cs_bt_stpob_update
Add segment check logic at the beginning of the program
OK, check it out ... Each input line component, will check ... Perfect
BOM Component Item Repeat check