Enhancement Spot

The enhancement spots are used to manage explicit enhancement options. Enhancement spots carry information about the positions at which enhancement options were created. One enhancement spot can manage several enhancement options of a Repository object. Conversely, several enhancement spots can be assigned to one enhancement option. Use You create an explicit enhancement option when processing a Repository object with the relevant tool by creating an enhancement spot element definition at a point where this is possible. This enhancement option can then be called at different points using enhancement spot element calls. The enhancement spot element definition and the corresponding enhancement spot element calls make up the definition of an enhancement option. For example, when editing an ABAP program with the ABAP Editor, you can define explicit enhancement options in the form of the ENHANCEMENT-POINT statement, which also represents the element definition and element call. Each enhancement spot element definition must be assigned to at least one enhancement spot. For this, an enhancement spot element definition is assigned one or more simple enhancement spots, which in turn are assigned to at least one composite enhancement spot. Simple and composite enhancement spots are Repository objects that form a tree-like structure, where the leaves and branches represent simple and composite enhancement spots respectively. A simple enhancement spot is always assigned to exactly one enhancement technology (ABAP source code enhancement or BAdI). Composite enhancement spots are used for the semantic grouping of simple enhancement spots. A composite enhancement spot contains either one or more simple enhancement spots and/or one or more composite enhancement spots of the relevant type. You can use composite enhancement spots to combine simple enhancement spots into meaningful units.
The statement ENHANCEMENT-POINT can either be entered directly or created by choosing Edit → Enhancement operations → Create enhancement in the Enhancement Builder.

1. I have always used only IMPLICIT enhancement points for my fixes. Is there a specific reason to use EXPLICIT? shoudn't IMPLICIT cover all the scenarios so there is no need to use EXPLICIT ? I have user created an EXPLICIT because it looked quite complicated. 2. when I am creating an IMPLICIT enhancement, i am asked for composite enhancement implementation, although this can be left blank. why is this field not required? and what benefit of creating a composite Enhancement Implementation?

includes and methods or the end of structures & private/protected/public section of a local class. To show implicit enhancements spots: 2. subroutines.Edit -> Enhancement Operations -> Show Implicit Enhancement Options You will usually find these implicit enhancement options at the beginning and end of function modules.Implementing Implicit Enhancement Options: 1.From within the SAP function module of interest. In this example I'm choosing the one at the end of the function module: . click on the swirly icon ("Enhance Source Code" button) between the "Other object" and "Check" buttons: This places you into "change enhancements" mode.

now create an Enhancment: Edit -> Enhancement Operations -> Create Enhancement 4. Furthermore. I think what is going on here is that dynamic enhancement implementations are surrounded by an "IF" statement at runtime.. This is because data declarations are always static even if they are inside a dynamic enhancement option. methods and local classes will not compile within an "IF" statement.With the implicit enhancement option selected.Next you choose whether this is a data declaration (static) enhancement or a coding (dynamic) enhancement. you can't place form routines.Next you select or create your enhancement implementation: . Choose "code" (well maybe not. methods or local classes within a dynamically defined enhancement implementation..) . Hence all of these should be defined as static (Declaration). 5. At SAPTechEd 2009. they recommended that if your code has any data declarations it should be defined static (Declaration) and not dynamic (Code).3. Data declarations are declared regardless of whether an "IF" statement evaluates to true and subroutines.

This will help in the future if SPAU_ENH notes a conflict that must be manually adjusted. Document the INCLUDE with the exact location(s) from where the enhancement code is called. It is probably because an existing implementation does not exist for this repository object (SAPFF011) whereas one did exist for the above function module. Name your enhancement according to our programming standards (Z followed by 2 character application area abbreviation). The first reason is that each enhancement will only be triggered by a single entry point even though the SAP code is called by multiple entry points. (e.g. Called from workflow.g.g.. SAPLF040 & SAPMF05V). this is an indication that there are multiple entry points into the code and you should test all the entry points. start of form). The second reason is that the different entry points might be populating variables with different values. include ZAP_RFP_BLOCK_DELETE_FROM_WF. There are several reasons for this..) This will make future maintenance easier because maintaining INCLUDE is easier and less buggy than maintaining the enhancement. CHECK_DOCUMENT_TYPE. Recommend that the only code in the actual enhancement be an INCLUDE (e. form routine. FBV2 and FV60. INCLUDE you created called by multiple SAP entry points: . The enhancement is in INCLUDE LFBCBFC0.. If SAP indicates the INCLUDE you created is called by more than one SAP program (e.When I created an enhancement implementation from a module pool.

Requires multiple Enhancements: Enhancement called from FBV2 initial screen (SAPMF05V): .

Enhancement called from FBV2 Pick List screen (SAPLF040): .

ASSIGN (l_zmit_belnr_field) TO . in general. ASSIGN (l_zmit_bukrs_field) TO . " SAPMF05V l_zmit_bukrs_field = 'RF05V-BUKRS'. Moreover. ELSE. l_zmit_gjahr_field = 'RF05V-GJAHR'. . we do not guarantee the order in which these implementations are called. Implement Explicit Enhancement Spot (Implementing SAP supplied Explicit ENHANCEMENT-POINT/SECTION NOT Recommened!): As for the usage of explicit enhancement points. if you implement a point already implemented by a SAP IS. customers may use explicit points defined by SAP. ASSIGN (l_zmit_gjahr_field) TO . l_zmit_bukrs_field = 'BUKRS'. l_zmit_gjahr_field = 'GJAHR'.Code that makes this single include work for both enhancments each from a different entry point: * SAPMF05V means it is coming from FBV2 / FBV3 / FBV0 / FBV4 initial screen * RFPUEB00 means it is coming from FBV2 / FBV3 / FBV0 / FBV4 pick list IF sy-cprog = lc_zmit_init_screen. l_zmit_belnr_field = 'RF05V-BELNR'. l_zmit_belnr_field = 'BELNR'. But SAP cannot guarantee the stability of these points. ENDIF.

replace an existing data declaration) or dynamic (for example. You can not trust the sequence of the added code. Dynamic enhancement options/sections do not contain an addition.can either be static (for example. it is necessary to place them into static enhancement options/sections. additional coding).The following enhancement option types are available in a source code: · ENHANCEMENT-POINT – to add code .can either be static (for example. Static enhancement options/sections are marked with STATIC in coding. 1. choose enhancement implementation point/section from the List of Enhancement Options & double click PR: -> Program EX: -> Explicit? FO: -> Form routine SE: -> Section EI -> ? . methods. · ENHANCEMENT-SECTION – to replace code . Note Data declarations are always static. even if they are inside a dynamic enhancement option. Therefore. and local classes cannot be part of dynamic enhancement options/sections. Form routines. additional data declaration) or dynamic (for example.From BAdI Builder (SE18) associated with Enhancement Spot of interest. 2.Display the SAP Enhancement option 3. replace coding).Under the tab Enhancement Options.

Select enhancement name and right click -> Enhancement Implementation -> Create This creates additional enhancement code at this spot.FU: -> Function Module IC: -> Include TY: -> Type? ME: -> Method? 4. Implement Explicit Enhancement Spot that is an Interface (new style BAdI) Keep in mind that implementing the new style BAdIs (GET/CALL) is Ok but implementing an explicit Enhancement-Point/Section supplied by SAP is not recommended: .Turn on enhancements with swirling icon 5.

They are needed for industry solutions and can change. 2.jspa?threadID=872651&messageID=5453372 "We do not recommend to use existing explicit Enhancement-Points/Sections from SAP.com/thread. So this can result to higher conflict resolution efforts. Spot Element Definitions tab select the BAdI definition of interest and click on the people icon above the definition to create BAdI implementation: .https://forums.Under the Enh.sdn.sap." 1.Display the SAP Enhancement option 3.From BAdI Builder (SE18) associated with Enhancement Spot of interest.

" Provide an implementation name Provide implementation short text.Implementation) Enter a pre-existing Classic BAdI definition into the BAdI Name and "Create Impl.Implementing a Classic BAdI (also see Enhancement Implementations & Spots) When possible avoid implementing Classic BAdIs because they are 40 to 600 times slower than the new BAdIs (Explicit BAdI Enhancements). SE19 (Business Add-Ins . .

Go to Interface tab and choose method of interest and double click which will take you to method's code where you can place your code: .

Defining Enhancement Options Generally. and the enhancement spot element call. SAP code that is being replaced. SAP's naming convention is to have the last 3 characters be _01. refers to an enhancement implementation element of a (simple) enhancement implementation. through the modification assistant insert the code for an enhancement section: ENHANCEMENT-SECTION z_name_of_enhancement_section SPOTS zes_name_simple_enh_spot. however. probably because of authorizaitons but didn't seem worth pursuing. z_name_of_enhancement_section is the Enhancement ID (i. (Wasn't able to convert mods that requied explicit enhancement spots.e. Activate: A simple Enhancement Spot for an Enhancement Section was created: .. END-ENHANCEMENT-SECTION. zes_name_simple_enh_spot is the name of the enhancement spot that the ID is assigned to. an enhancement option represents (in an ABAP source code) both the enhancement spot element definition. the name of the Enhancement Option). you will be implementing enhancement options that have been defined by SAP but occassionally there is a need to create one that you will then implement. It must be no longer than 30 characters. A source code plug-in... Call a Simple Enhancement Spot ENHANCEMENT-SECTION (Replace code) If you need to replace SAP code. etc. _02. If mod requires replacing or deleting SAP code or can not be placed in an implicit enhancement location. not worth turning into an explicit enhancement) In the nomenclature of the enhancement concept.

Enhancements -> Change option: It takes you to a popup entitled "Create Enhancement Option" which seems to allow you to either change the Enhancement Spot your option is assigned to or to create additional assignments.e. You can click on the Enhancement ID (e. you can not modify this enhancement option via normal editing in the ABAP editor. this popup indicates a POINT and does not allow you to change this designation.. z_name_of_enhancement_section) and using the context menu select Enhancements -> Undo which will remove the option and any implementation that has been created. So a Simple Enhancement Spot can contain multiple options.After pretty printer. Final picture: . it created a 2nd enhancement option within the same Simple Enhancement Spot.. When I created a 2nd enhancment section and assigned it to the same enhancement spot (i. Notice that even though this particular option is a SECTION and not a POINT. zes_name_simple_enh_spot). When I selected to create the 2nd implementation I was given the opportunity to choose the first implementation or create a new implementation. I chose to create a new one. Follow instructions to implement these Explicit Enhancement options.g.

It looks like there is a swich available on the Spot level and on the implementation level. Neither are modifiable in SF2. Above when I tried to name my simple enhancement spot the ZTESTBADI that I created below via SE80. It is done at the Package Level. Create a composite enhancement spot via the context menu associated with the Package Name. I learned how to use the switching mechanism. I got an error message indicating this enhancement spot was in another object. Start the Object Navigator (SE80) and choose Package and display 2. Ahhh. Development Class) of interest 1. ..What I don't know how to do is use the switching mechanism. I ended up not using either the composite enhancement spot nor the simple enhancement spot that I created below.e.... Create an Enhancment Spot for the Package (i.

Specify a name and short description 5.3. Activate (I've run into authorization issue so stop for now) . A dialog appears . Choose Create -> Enhancement -> Composite Enhancement Spot 4.

Sign up to vote on this title
UsefulNot useful