先说一下优化过滤的必要性。
CRM物料主数据一百多万。
感谢MDM或者相关的系统,每天通过接口更新的不知道什么东西,每天数百万的物料更新队列进入CRM。
CRM系统被搞死了好几次。
然后各种优化报表,程序。。。
最后有几个链接缓慢的自开发接口,背锅了。。。
好吧,先不管那些了。现在在ERP做一个过滤设置,只有某些修改的物料主数据才允许传到CRM。
1,查看SM30(TBE24找对增强ID,TPS34找到增强函数或自己写)
2,做配置表,表+字段,控制哪些表检查哪些字段
3,增强
"物料数据库同步过滤MARA,MAKT,MARM,MVKE "CRM抽数不需要走此逻辑,否则会堵住队列 IF I_OBJ_NAME = C_MATERIAL AND sy-uname <> 'RFC_CRM'."物料bdoc DATA:GW_MARA TYPE MARA, GW_MAKT TYPE MAKT, GW_MARM TYPE MARM, GW_MLAN TYPE MLAN, GW_MVKE TYPE MVKE, GT_006 TYPE TABLE OF ZCRMT0006, GW_006 LIKE LINE OF GT_006. FIELD-SYMBOLS:<OLD> TYPE ANY, <NEW> TYPE ANY, <MAKT> TYPE MAKT, <MVKE> TYPE MVKE, <MLAN> TYPE MLAN, <MARM> TYPE MARM. E_DO_NOT_SEND = 'X'."清除发送标记 SELECT * INTO TABLE GT_006 FROM ZCRMT0006. LOOP AT T_INT_TABLES INTO LS_INT_TABLES. CHECK E_DO_NOT_SEND IS NOT INITIAL. CASE LS_INT_TABLES-TABNAME. WHEN 'MARA'. ASSIGN LS_INT_TABLES-DATA TO <FS_MARA> CASTING. SELECT SINGLE * INTO GW_MARA FROM MARA WHERE MATNR = <FS_MARA>-MATNR. IF SY-SUBRC = 0. LOOP AT GT_006 INTO GW_006 WHERE TABNAME = LS_INT_TABLES-TABNAME. IF E_DO_NOT_SEND IS NOT INITIAL. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE <FS_MARA> TO <NEW>. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE GW_MARA TO <OLD>. IF <NEW> <> <OLD>. E_DO_NOT_SEND = ''. ENDIF. ENDIF. ENDLOOP. ELSE. E_DO_NOT_SEND = ''. ENDIF. CLEAR:GW_MARA. WHEN 'MARC'. WHEN 'MAKT'. ASSIGN LS_INT_TABLES-DATA TO <MAKT> CASTING. SELECT SINGLE * INTO GW_MAKT FROM MAKT WHERE MATNR = <MAKT>-MATNR AND SPRAS = <MAKT>-SPRAS. IF SY-SUBRC = 0. LOOP AT GT_006 INTO GW_006 WHERE TABNAME = LS_INT_TABLES-TABNAME. IF E_DO_NOT_SEND IS NOT INITIAL. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE <MAKT> TO <NEW>. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE GW_MAKT TO <OLD>. IF <NEW> <> <OLD>. E_DO_NOT_SEND = ''. ENDIF. ENDIF. ENDLOOP. ELSE. E_DO_NOT_SEND = ''. ENDIF. CLEAR:GW_MAKT. WHEN 'MARM'. ASSIGN LS_INT_TABLES-DATA TO <MARM> CASTING. SELECT SINGLE * INTO GW_MARM FROM MARM WHERE MATNR = <MARM>-MATNR AND MEINH = <MARM>-MEINH. IF SY-SUBRC = 0. LOOP AT GT_006 INTO GW_006 WHERE TABNAME = LS_INT_TABLES-TABNAME. IF E_DO_NOT_SEND IS NOT INITIAL. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE <MARM> TO <NEW>. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE GW_MARM TO <OLD>. IF <NEW> <> <OLD>. E_DO_NOT_SEND = ''. ENDIF. ENDIF. ENDLOOP. ELSE. E_DO_NOT_SEND = ''. ENDIF. CLEAR:GW_MARM. WHEN 'MVKE'. ASSIGN LS_INT_TABLES-DATA TO <MVKE> CASTING. SELECT SINGLE * INTO GW_MVKE FROM MVKE WHERE MATNR = <MVKE>-MATNR AND VKORG = <MVKE>-VKORG AND VTWEG = <MVKE>-VTWEG. IF SY-SUBRC = 0. LOOP AT GT_006 INTO GW_006 WHERE TABNAME = LS_INT_TABLES-TABNAME. IF E_DO_NOT_SEND IS NOT INITIAL. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE <MVKE> TO <NEW>. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE GW_MVKE TO <OLD>. IF <NEW> <> <OLD>. E_DO_NOT_SEND = ''. ENDIF. ENDIF. ENDLOOP. ELSE. E_DO_NOT_SEND = ''. ENDIF. CLEAR:GW_MVKE. WHEN 'MLAN'. ASSIGN LS_INT_TABLES-DATA TO <MLAN> CASTING. SELECT SINGLE * INTO GW_MLAN FROM MLAN WHERE MATNR = <MLAN>-MATNR AND ALAND = <MLAN>-ALAND. IF SY-SUBRC = 0. LOOP AT GT_006 INTO GW_006 WHERE TABNAME = LS_INT_TABLES-TABNAME. IF E_DO_NOT_SEND IS NOT INITIAL. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE <MLAN> TO <NEW>. ASSIGN COMPONENT GW_006-FIELDNAME OF STRUCTURE GW_MLAN TO <OLD>. IF <NEW> <> <OLD>. E_DO_NOT_SEND = ''. ENDIF. ENDIF. ENDLOOP. ELSE. E_DO_NOT_SEND = ''. ENDIF. CLEAR:GW_MLAN. WHEN OTHERS. ENDCASE. ENDLOOP. ENDIF.
^_^很多人都把资料锁进了note里,以后还怎么百度呢^_^