06-18-2009 12:35 PM
Hi,
Why may i use dynamic abap? Abap that codes its own code?
For example for what may i need for such a thing?
Hope it is clear what i mean?
Thanks.
deniz.
06-18-2009 3:41 PM
Hi,
Also please refer: [Dynamic manipulation of report programs|http://www.sapdev.co.uk/tips/dynamic/dyn_prog.htm].
Please note however, that dynamic coding (program creation), though poweful is very dangerous and should (as pointed above) be avoided or solved by means of static code.
Anyhow SAP provides such functionality for some reason. Personally I used that once for self creating selection screen (adding new fields) when user triggers some action. This approach let me create flexible program which was user-customized and nice looking.
Regards
Marcin
06-18-2009 12:39 PM
a) your task is so complex that other dynamic programming methods are not sufficient, e.g. program code generated by LSMW, substitutions/validations, formula editors, many more
b) you are a hacker implementing evil code and are trying hard not to leave any traces
Thomas
06-18-2009 1:13 PM
Dynamic code is need to achieve things that are not possible with static code. For example..
- You want to give to user power to tweak the selection screen options in runtime.
- You want to allow to user to choose which fields get displayed in output
- You want to write some application in order to help other developers code easily, like automatically generally skeleton code for alv report based some radio buttons.
- You want to mass download abap reports or function modules, while coding, you wont know which programs user may wish to download
- Changing screen layouts in runtime
So basically it gives you power to be more flexible while programming.
06-18-2009 1:25 PM
>
>Abap that codes its own code?
Is this like "Set a theif to catch a thief" or AI kinda Thing ?
If that happens someday, customers will askfor a single program which gets FS as input and codes the report itself as per the FS requirement and gives back the generated report name and a bunch of documents( TS, UM etc)..
But that will make Abapers life really miserable
Regards
Karthik D
P.S.
AI - Artificial Intelligence..
FS - Functional Specification
TS - Technical Specification
UM - User Manual
06-18-2009 3:25 PM
Hi,
Here is a very good article on Dynamic Subroutine. Please look into this URL:
/people/ravishankar.rajan/blog/2007/03/27/using-subroutine-pools-for-dynamic-programming
Rgds,
Ramani N
06-18-2009 3:41 PM
Hi,
Also please refer: [Dynamic manipulation of report programs|http://www.sapdev.co.uk/tips/dynamic/dyn_prog.htm].
Please note however, that dynamic coding (program creation), though poweful is very dangerous and should (as pointed above) be avoided or solved by means of static code.
Anyhow SAP provides such functionality for some reason. Personally I used that once for self creating selection screen (adding new fields) when user triggers some action. This approach let me create flexible program which was user-customized and nice looking.
Regards
Marcin
06-22-2009 8:08 AM
Hi Marcin,
May i get your source code, if possible?
It seems something very useful in some cases.
Thanks.
deniz.
06-22-2009 8:49 AM
Hi Deniz,
I added my program to wiki, as it might not suit one post. [Direct link|https://wiki.sdn.sap.com/wiki/x/eAHABg].
Please note!
I described its behaviour and orignial purpose. You will have to analyze the code yourself to get the idea. Unfortunatelly its to extended to explain it here. You can also copy paste it and analyze the logic during runtime. It would be even better as you will know then what it really does.
There is one custom FM used which can be substituted with standard fm SO_NEW_DOCUMENT_ATT_SEND_API1 to populate an email, but here it is of no relevance for you, as the key point is to self screen generation. So you can just copy paste the report and comment custom FM.
Hope it will give you a basic idea how it can be performed.
Regards
Marcin
06-18-2009 8:26 PM