What are the difference between the user exits, customer exits and badi?
and when to use all?
Which one we select when a requirement we get.
I mean on what basis we select(either user exit or customer exit or Badi).
Thanks in advance.
USER-EXITS : User-Exits where primarily made for SD module. They are implemented by SAP as sub-routines. So in standard SAP code you will find the statement PERFORM USEREXIT_XXX… for example in include program MV45AF0B_BELEG_SICHERN on line 652 you will find the statement PERFORM USEREXIT_SAVE_DOCUMENT_PREPARE.. but the corresponding FORM defined in include program MV45AFZZ is empty. so as per your clients requirements you will have to add code to this FORM However since you are adding code into an SAP standard include program this will be considered as a modification not an enhancement.
CUSTOMER-EXITS: These exits are delivered by SAP as Function module calls. So in standard SAP code you will find statements like CALL CUSTOMER-FUNCTION '003' … for example in Include LCATSF0Y on line 21 you will find the statement CALL CUSTOMER-FUNCTION '003' However the corresponding Function Module EXIT_SAPLCATS_003 has an include ZXCATU03 which does not exist. Hence based on your client requirements you will need to add code into this include to enhance the behavior of the standard SAP program. Notice that since here you are not actually changing any of SAP standard code hence this is not considered a modification and you will not have any issues during future upgrades.
BADI: Business Add-Ins are an Object Oriented way of implementing SAP enhancements. The limitation of a custom exit is that it can only have a single include implementation in it. However a BADI can have several implementations ( implemented as Classes as opposed to Include Programs as in the case of Customer Exit) and you can select which implementation should be called based on a Filter value. BADI's are specific to the module and the relevant BADI can be found through the IMG configuration node of that module. Technically SAP Standard code uses the class CL_EXITHANDLER to identify and call the relevant BADI class.