Business add-ins are a new SAP enhancement technique based on ABAP objects. they can be inserted into the SAP system to accommodate user requirements too specific to be encoded in the standard delivery. since specific industries often require special functions, SAP allows you to predefine these points in your software.
SAP predefines some interfaces. You can customize the class that implements the interface by yourself. In standard programs, instances that call the custom class are used, the factory mode is used when obtaining instances. Therefore, the acquisition process is unknown to users. However, Badi also has some limitations, that is, what interfaces are fixed, and sometimes it will find that interfaces cannot be found when the mix custom code is required, when does sap's OO support AOP directly.
How to find Badi from SAP
As the third-generation user exit of SAP, Badi has become more and more widely used. However, it is confusing for many ABAP programmers to find the right Badi. Here I will introduce my personal application experience for your reference.
1. Information of Badi objects is stored in four tables: sxs_inter, sxc_exit, sxc_class, and sxc_attr (see the SECE package );
2. the sap program will call cl_exithandler => get_instance to determine whether an object exists and return an instance. In fact, get_instance is used to view the tables and their views (v_ext_imp and v_ext_act) query and search.
3. Based on this mechanism, I checked and used st05 to monitor a tcode for tracking. Then I chose to find the operations on the tables and views above to obtain the relevant Badi.
4. You can use the se18 lookup interface and se19 interface to enhance user experience.
Example: Use le_shp_delivery_proc to control the cross-month cancel
Method if_ex_le_shp_delivery_proc ~ Change_delivery_header.
Data: thismonth (2) type C.
Data: wa_likp type line of shp_likp_t.
Data: wa_log type line of shp_badi_error_log_t.
Clear ct_log [], thismonth.
Thismonth = sy-datum + 4 (2). "-----> month of this month
Loop at it_xlikp into wa_likp.
Check is_v50agl-warenausg_storno = 'x'. "---> stands for GI cancel
If wa_likp-wadat_ist + 4 (2) <thismonth.
Wa_log-vbeln = cs_likp-vbeln.
Wa_log-msgty = 'E'. "Please keep your breath
Wa_log-msgid = 'zdn _ error'. "This class needs to be built by yourself
Wa_log-msgno = '001 '.
Append wa_log to ct_log. "error log failed
Endif.
Endloop.
Endmethod. "if_ex_le_shp_delivery_proc ~ Change_delivery_header
Tcode:
Se18
Se19