Poll Wrap-up for the Poll – Your Preferred Option for Code Modularization
Few weeks back, I have asked question in the poll:
Your Preferred Option for Code Modularization
Results
Majority of readers has voted for the option Methods in a Class about 53%. I like that many & many developers want to go towards the OO ABAP. Keep it up!
Subroutines got about 28% votes – Second favorite option. With Function Module got about 11% as the third option. If you have voted for either of these options – Subroutines or Function Modules, just word of caution, that they are getting obsolete from ABAP release 731. Rule in Function Modules and Subroutines on ABAP Help suggests like this:
Only use function modules and subroutines if they are necessary from a technical viewpoint. In these cases, do not implement the required function. Instead, call the relevant (local) methods.
Include (6%) and Macros (2%) are also preferred options for few fellow developers. Personally I prefer include to segregate by modules, like Include for a local class definition, include for a local class implementation, etc. I don’t suggest you to use Macros as at all as it makes very hard to debug.
On Graph
Results on graph:
Next Poll – Commenting Your Code
New Poll Commenting Your Code is now available in the sidebar.
OOPS (Object Oriented Programming Syntax) is now the go-forward for ABAP? Did I understand that said use function modules for RFC(BAPI), but use OO inside? We have a few upgrades to go since we are still on SAP_BASIS 702. But that is very good to know.
Hello Steve,
The reason would be – ABAP Objects has a stricter syntax. E.g. You can’t declare a table with header line in ABAP Objects but you can still do it in Programs / FMs / Includes.
When you can’t avoid using FM or Subroutines e.g. VOFM routines, Update Task FMs, RFC FMs, SAP suggested to wrap the core logic in at a local class. I would suggest to go for global class.
Thanks,
Naimesh Patel
Hi Naimesh,
I think that people who read your blog are more likely to be interested in learning and improving their ABAP skills and so these results might be a little skewed as compared to the whole population of developers. Hopefully one day OOABAP will just be ABAP and not knowing object oriented will just mean that you don’t have a job.
Do you know what will happen in 731 when developers use subroutines and function modules? Will there be a warning in the compiler? Even in 702, the keyword documentation says “Obsolete Syntax” for FORM, but there’s no warning or anything.
I think on newly written programs the compiler should make the developer explain the technical reason for using obsolete syntax.
-Brian
Hello Brain,
Yes you are right that the results might not reflect the entire community. Majority of readers are OO enthusiastic so they would be biased to select Methods. I wish I would have more votes to give me better visibility, but not all readers tend to vote 🙁
731 would have ATC – ABAP Test Cockpit which should have this check. So far I have noticed only the rules from Extended Program check and Code inspector are in the ATC. But haven’t tried to run it for an Obsolete syntax. I would give a shot.
I wish for the same feature – Lets see what SAP would come up in upcoming releases.
Thanks,
Naimesh Patel