on ‎2020 Jan 31 11:54 AM
Hi SAP Gurus,
Recently, i was given a task to enhance a report output by adding a field in it.
There was no BADI or user exit available. I found couple of implicit enhancements through which field could be added.
This is a standard report written plainly in procedural programming.
To write the code we have 2 options.
Option 1. To write all the required code simply in the implicit enhancement. - Now this is what i had done in my earlier days before i started taking OO design principles seriously. It may have advantages or disadvantages.
Advantages ( I may be wrong ) -
1. We are not moving the control from Procedural to OO. So, system does not need to take overhead to create objects( GET BADI and CALL BADI Method ) and passing parameters to other methods.
2. Simple to programmers to know what is happening upfront.
Disadvantages -
1. By directly writing all the code there we are making Procedural report component tightly coupled to enhanced components ( custom fields ).
2. If in future we need to switch off this requirement. then we need to comment out the code and move through the landscape. which may take time and efforts.
3. If in future we have more fields to be added, then code will become more and more longer in the implicit enhancement and each field enhancement will be tightly coupled to another field enhancement and code will be difficult to maintain in the long run.
Option 2. To create an infrastructure to enhance this report by creating a BADI which would call BADI for this required custom field.
So, in implicit enhancement , we only need to call just one method. inside this method we will CALL BADI for this required custom field.
It also has some advantages and disadvantages.
Advantages -
1. If in future we get requirement to add more custom fields, then we will create BADI for each new fields to added and call this BADI from the Main BADI. this way - if in future we need to switch off any field then we can deactivate that particular BADI OR if we need to switch off all the custom fields then we can deactivate the main BADI. So, this way we can create the design which is loosely coupled. each component is looslely coupled to another component and can be deactivated independently without affecting another.
2. Implicit enhancement code won't become too long to maintain. as we are segregating each field so we are reducing the scope of code which may get affected.
Disadvantages -
1. More effort in creating this design - main BADI and separate BADI for each field.
2. Moving from Procedural to OO ( Well, i don't have much wisdom on it , if it affects the time/memory efficiency of the system ).
3. to pass the variables,tables etc to BADI Methods we need to create field symbols, which will take some more memory in runtime.
So, these are my thoughts on it. I don't know if i am wrong or right. Please correct me if i am wrong. I just want to follow to best design and these 2 options i can think of.
If someone can explain with reasons which design to follow , it will be helpful to me.
Thanks,
Rahul
Request clarification before answering.
| User | Count |
|---|---|
| 44 | |
| 29 | |
| 19 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.