SAP MDG · REPLICATION OUTBOUND

How do I implement a DRF filter class in SAP MDG to exclude replication objects based on configuration and runtime data?

Use IF_DRF_FILTER~APPLY_FILTER as the single entry point, read filter rules by replication object and business system, optionally enrich with customer/vendor context, then loop through ET_FILTERED_OBJECTS and delete excluded entries when the rule sign is 'E'.

Use IF_DRF_FILTER~APPLY_FILTER as the single entry point, read filter rules by replication object and business system, optionally enrich with customer/vendor context, then loop through ET_FILTERED_OBJECTS and delete excluded entries when the rule sign is 'E'.

A robust SAP MDG DRF filter class is configuration-driven and context-aware. The common pattern is to read the base filter configuration by replication object and business system, optionally enrich it with customer/vendor or account-group context, then loop through `ET_FILTERED_OBJECTS`, compare the first structure component to the effective rule set, and delete excluded rows when `SIGN = 'E'`.

Process flow

  1. Implement `IF_DRF_FILTER~APPLY_FILTER` as the filter entry point.
  2. Read the base filter configuration by replication object and business system.
  3. Optionally derive customer/vendor or account-group context from runtime data or memory.
  4. Merge generic and specialized filter rules.
  5. Loop over `ET_FILTERED_OBJECTS` and extract the key dynamically from component 1.
  6. Delete entries when the matching rule has `SIGN = 'E'`.
  7. Keep a fallback path when context enrichment is not available.

The retrieved knowledge does not provide a standard SAP SPRO path for this custom DRF filter pattern. Use your implementation's existing MDG/DRF customizing and read it by replication object and business system.

Referenced tables

ObjectPurpose
Z_FILTER_CFGExample configuration table used in the canonical pattern to read filter rules by replication object and business system.
ZTT_FILTER_CFGExample rule-table type used in the canonical pattern for effective filter processing.

ILLUSTRATIVE ABAP SAMPLE

Source-supported DRF filter pattern

Template based on the canonical retrieved pattern; adapt the configuration access and context lookup to your implementation.

1METHOD if_drf_filter~apply_filter. 2 " 1) Read main config 3 SELECT * FROM z_filter_cfg INTO TABLE @DATA(lt_main) 4 WHERE fobj = @is_c_fobj-fobj 5 AND business_system = @iv_business_system. 6 7 " 2) Optional context enrichment 8 DATA(lt_specific) = VALUE ztt_filter_cfg( ). 9 IF context_available = abap_true. 10 " read specific cfg by account-group/object type 11 ENDIF. 12 13 " 3) Merge rules 14 DATA(lt_effective) = lt_main. 15 LOOP AT lt_specific INTO DATA(ls_specific). 16 DELETE lt_effective WHERE value = ls_specific-value. 17 ENDLOOP. 18 19 " 4) Apply filter 20 LOOP AT et_filtered_objects ASSIGNING FIELD-SYMBOL(<ls_obj>). 21 DATA(lv_idx) = sy-tabix. 22 ASSIGN COMPONENT 1 OF STRUCTURE <ls_obj> TO FIELD-SYMBOL(<lv_obj_key>). 23 IF <lv_obj_key> IS ASSIGNED. 24 READ TABLE lt_effective INTO DATA(ls_rule) 25 WITH KEY value = <lv_obj_key>. 26 IF sy-subrc = 0 AND ls_rule-sign = 'E'. 27 DELETE et_filtered_objects INDEX lv_idx. 28 ENDIF. 29 ENDIF. 30 ENDLOOP. 31ENDMETHOD.

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • How does an MDG DRF filter class work?
  • How do I remove objects from ET_FILTERED_OBJECTS in IF_DRF_FILTER~APPLY_FILTER?
  • How can I build a configuration-driven SAP MDG replication filter?

Possible questions

  • How do I implement a DRF filter class in SAP MDG to exclude replication objects based on configuration and runtime data?
  • How do I remove objects from ET_FILTERED_OBJECTS in IF_DRF_FILTER~APPLY_FILTER?
  • How can I build a configuration-driven SAP MDG replication filter?
  • What is the pattern for customer/vendor-specific DRF filtering?
  • How do I use account-group context in an MDG filter class?

Keywords

SAP MDGDRFIF_DRF_FILTER~APPLY_FILTERET_FILTERED_OBJECTSconfiguration-driven filteringaccount-group logiccustomer/vendordynamic structure accessruntime payload reduction