‎2022 Feb 11 3:53 PM
Hi Community,
I am using subroutine defined in two different programs. I've been asked to define the tables in form - endform program and then acess them in another program having the perform statement. Can you please help me how i can do that.
Thankyou
‎2022 Feb 11 3:53 PM
Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with: https://community.sap.com/resources/questions-and-answers, as it provides tips for preparing questions that draw responses from our members.
For example, you can:
- outline what steps you took to find answers (and why they weren't helpful)
- share screenshots of what you've seen/done
- make sure you've applied the appropriate tags
- use a more descriptive subject line
The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html
Should you wish, you can revise your question by selecting Actions, then Edit.
By adding a picture to your profile you encourage readers to respond: https://www.youtube.com/watch?v=46bt1juWUUM
‎2022 Feb 11 5:29 PM
Hi abhig29,
I would consider using ABAP classes. However, you can still put the table definition and the form in an include and import this include into both programs.
Regards
Thorsten
‎2022 Feb 14 5:59 PM
Using includes as a way of sharing code and modularising is not good practice. Includes should only ever be a way of organising code and frankly aren't needed any more, outside of a few exits and the like.
‎2022 Feb 11 8:38 PM
Subroutines are obsolete. You should use methods.
If for some reason you want to continue with subroutines, PERFORM ... IN PROGRAM ... But it's wrong design (you should use methods from class pools).
Shared includes are also no more recommended. You should use methods from class pools.
‎2022 Feb 14 5:58 PM
Use of PERFORM ... IN PROGRAM ... is actively discouraged - as are shared includes. It's not just wrong design, it's bad design.