(2302) Defining an Offloading Condition Using BAdI

In order to define the offloading condition with custom logic, you need to create a BAdI implementation with your own implementing class. To do so, follow this step list:

  1. Open transaction SE19

  2. In the section Create Implementation:

    1. Fill in Enhancement Spot /DVD/OFF_AWIZ_ENHS_CUS_COND

    2. Click on Create

  3. Fill in the New Enhancement Implementation name and short text (Composite Enhancement Implementation leave blank) and confirm

  4. Select Package and fill in the transport request

  5. Fill in:

    1. New BAdI implementation name

    2. Fill in the Implementation class name

      1. Set BAdI Definition to /DVD/OFF_AWIZ_BADI_CUS_COND

  6. Activate Enhancement Implementation (Ctrl+F3)

  7. Implement method CALCULATE_CONDITION of the implementation class

    1. This method has the following parameters:

      • IV_DP_NAME – importing parameter with the DataProvider name

      • IT_FIELDS – importing parameter with the list of all DataProvider’s fields

      • ET_VALUES – exporting parameter with the custom values

    2. Example of implementation:

      METHOD /dvd/off_awiz_if_cus_cond~calculate_condition. DATA: lt_sales TYPE vbak, ls_value TYPE /dvd/ru_ts_values, ls_selopt TYPE /dvd/ru_ts_selopt. "handling of different DataProviders" CASE iv_dp_name. WHEN 'ZSALES1' "select sales documents older than '20181231'" SELECT DISTINCT vbeln FROM vbak INTO CORRESPONDING FIELDS OF TABLE lt_sales WHERE erdat < '20181231'. IF sy-subrc = 0. READ TABLE it_fields INTO DATA(ls_field) WITH KEY fieldname = 'VBELN'. IF sy-subrc = 0. ls_value-tabname = ls_field-tabname. ls_value-fieldname = ls_field-fieldname. ls_value-rollname = ls_field-rollname. "fill values into standard select option table" LOOP AT lt_data INTO DATA(ls_data). ls_selopt-sign = "I". ls_selopt-option = "EQ". ls_selopt-low = ls_data-vbeln. APPEND ls_selopt TO ls_value-selopt. ENDLOOP. APPEND ls_value TO et_values. ENDIF. ENDIF. ENDCASE. ENDMETHOD.
  8. The BAdI implementation will only be called if the setting CONDITION_USE_BADI is set to 'X' for a specific DataProvider. This setting can be also quickly accessed in the Object Selection step of the DataProvider Wizard.