‎2022 Feb 09 4:50 AM
Is it really effective to use subroutine /macros or usage of function module and the class method is more effective?
‎2022 Feb 09 7:54 AM
Hello yashnath176
Refer to Obsolete Modularization elements in ABAP 7.54 which is the current version. It states that subroutines are obsolete. However given the heavy usage of subroutines in the SAP standard code, I'd say it's safe to use them if that suites your programming style.
I've not found any info on macros being obsolete. However I'd not use them as they are notoriously hard to debug.
Surely ABAP object oriented programming is in the fashion now. Still I'm hesitant to call it the most modern or appropriate. There are long going discussions in the programming world about object oriented vs procedural programming. In my mind both are tools, slightly different tools, with their own purpose.
Best regards
Dominik Tylczynski
‎2022 Feb 09 7:12 AM
- Macros are pretty much forbidden(no go) nowadays(Netweaver after 7.02+).
- subroutines are not desired or recommended, but sometimes can not be avoided, this can be seen all around in the source code of EWM. Technical reasons can be integration/extension of logical of classical Dynpro Screens, "frameworks" such as the Whse Mon extensions, etc.
- same is also true for function modules and function-oriented ABAP programming, sometimes there is no way around it, ( custom logic in the RF Framework i.e. )
- object oriented programming is seen as the most modern/appropriate approach currently in ABAP
- maybe in the distant future the language development will go in direction functional programming ...
‎2022 Feb 09 7:20 AM
Welcome and Thank you for visiting SAP Community to get answers to your questions. Please add more details to your question, e.g. you can also add a screenshot. With that, you can reach a broader range of experts to get your question answered. I also recommend to do this tutorial https://developers.sap.com/tutorials/community-qa.html
The more details you provide, the more likely it is that members will be able to assist you.
Please also check if you have chosen the correct tags. For this question, I have removed the EWM tag.
Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS. By personalizing your profile with a photo of you, you encourage readers to respond.
Regards, Svea
SAP Community Global Moderator
‎2022 Feb 09 7:54 AM
Hello yashnath176
Refer to Obsolete Modularization elements in ABAP 7.54 which is the current version. It states that subroutines are obsolete. However given the heavy usage of subroutines in the SAP standard code, I'd say it's safe to use them if that suites your programming style.
I've not found any info on macros being obsolete. However I'd not use them as they are notoriously hard to debug.
Surely ABAP object oriented programming is in the fashion now. Still I'm hesitant to call it the most modern or appropriate. There are long going discussions in the programming world about object oriented vs procedural programming. In my mind both are tools, slightly different tools, with their own purpose.
Best regards
Dominik Tylczynski