Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic abap

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos

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

8 REPLIES 8

ThomasZloch
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

>

>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

former_member229729
Active Participant
0 Kudos

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

MarcinPciak
Active Contributor
0 Kudos

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

0 Kudos

Hi Marcin,

May i get your source code, if possible?

It seems something very useful in some cases.

Thanks.

deniz.

0 Kudos

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

Former Member
0 Kudos

Moved to the security forum...