2023 May 29 7:36 AM
Hi,
I want to write a report in which the input parameter is the name of the class. Once the report is executed, a method should be auto generated in the class.
Can someone help me with the report.
Thanks and Regards,
Wajiha Fathima
2023 May 29 9:19 AM
It's certainly possible - I've done it. But it was a while ago and I don't have access to that system. I found it through searching this site.
2023 May 29 10:00 AM
You can certainly trust the way it was done in abapGit (used by many people, code running on many ABAP versions, tool frequently updated, ...)
You didn't say if it was a class pool or a local class.
The difference with what you want to achieve is that the code is oriented to create/recreate the whole objects, so either you don't bother and just reuse the existing tool, or you take just what you need.
Don't forget to give credits to abapGit in your source code.
cc author lars.hvam
2023 May 29 12:26 PM
Hi Sandra Rossi,
Thank you for the solution but, I want to create in a local class using any function module or any class method.
Regards,
Wajiha Fathima
2023 May 29 5:03 PM
In that case, I just mentioned "probably much easier" and you can still look at abapGit how it does it, as I have mentioned.
Whatever solution you use, it will not be supported by SAP and not recommended (the only ABAP code generation supported is GENERATE SUBROUTINE POOL), so if you really want to do it, you may use the sole ABAP statement "INSERT REPORT" to replace the code of one include (in which you have your local class).
You also have lots of questions and answers about ABAP code generation.
NB: please clarify where your local class is (definition, implementation), you still didn't explain. That makes your question more difficult to answer...