In your SAP Consultant life, you will probably have a lot of situations when your SAP extractor will be not exactly matching your needs. In this situation (missing trigger could be a NO-GO) you can always enhance your structure and fill your field by using the RSU5_SAPI_BADI.
First of all, let me explain my example. Assume that we have a 0BPARTNER_ATTR extractor which by default don’t have field 'BUSINESS_STATUS’ which we want to have. This field is available in our but000:
Our BUSINESS_STATUS field is filled in BDT, and can contain few different values, if we look at content of but000 then we see one entry:
Lets check rsa3:
We have luck, because the field in this extractor has been filled by default, and we don’t need any additional steps to get this working. Let’s assume that in the case of '1′ our client needs an 'A’ value in the BW system. Let’s go to se18, and create a new implementation in RSU5_SAPI_BADI.
Let’s open our new class ZCL_IM_0BPARTNER_ATTR_BS and implement some code now:
class zcl_im_0bpartner_attr_bs definition
create public .
interfaces if_ex_rsu5_sapi_badi .
class zcl_im_0bpartner_attr_bs implementation.
check i_datasource = '0BPARTNER_ATTR'.
data: lt_tab type standard table of bus000_bw.
lt_tab = corresponding #( c_t_data ).
"Of course you can do this in more fancy ways than loop, this is just a explanation
loop at lt_tab reference into data(lr_tab).
if lr_tab->business_status = 1.
lr_tab->business_status = 'A'.
c_t_data = lt_tab.
Now save and activate Badi and code. Go to rsa3 and check result:
Tadaaaa, everything is working as expected 🙂 I hope you get some value from this