Change the assigned product group

If you like to exclude a material from transfer you have to assign no product group or you have to assign the product group with the value 'NOT_RELEVANT'.
For adapting the assignment of a product group, there is a BAdI /AEB/TA_PROD_GRP_01. The BAdI has one method chg_product_group_for_material.

The following code example shows how to set the product group in case of the material has a deletion indicator.

METHOD /aeb/if_ex_ta_prod_grp_01~chg_product_group_for_material.
		IF im_mara-LVORM = 'X'
  *   NOT_TO_TRANSFER has to be defined as product group
			ch_product_group = 'NOT_RELEVANT'. 
    ENDIF.
  ENDMETHOD.

You see that we only change it in this case, if the material has the deletion indicator. All other situations will be covered by configuration.

If you like to have context data for example of the material (MARA, MARC..) or if you like to have the relevant org. units use the parameter "IM_MATERIAL_CONTEXT". This parameter has some methods for example get_mara with which you can the actual content of the table mara (include the content which is not yet persistent).