Application Development and Automation 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: 
Read only

Enhancements: Declaration vs. Code (static vs. dynamic Enhancement Points)

michael_umlauff
Product and Topic Expert
Product and Topic Expert
9,300

Hello all,

when I implement an implicit enhancement point, a popup with the buttons "Declaration" and "Code" appears.

In the enhancement implementation I see later on that a "static enhancement point" (for declaration) or. a "dynamic enhancement point" (for Code) has been created. What's the difference?

If I choose "Declaration", I still can insert non-declarative statements like WRITE into the enhancement code, and these code parts are processed as well as the enhancements declared as "Code".

So what's the sense of this distinction?

Thank you very much

Michael Umlauff

1 ACCEPTED SOLUTION
Read only

michael_umlauff
Product and Topic Expert
Product and Topic Expert
0 Likes
4,036

Hi Vikas,

thanks for your answer.

I have found an explanation like your answer in online help, but when I examine it I observe that the static enhancements aren't processed too if the switch is off.

Just a little example: I have a very small report that outputs just one line by a form:

[code]REPORT zmu_enhance_test.

FORM output.

WRITE: / 'This is Standard'.

ENDFORM.

START-OF-SELECTION.

PERFORM output.[/code]

I enter Enhancement mode and show the implicit enhancements. I find two in the form, one at the beginning and one at the end. I enhance the first by a static and the second dynamic enhancement. I put both enhancements into a package that is switched by my switch <i>zmu_enhance</i>, that is switched <i>off</i> at now.

[code]REPORT zmu_enhance_test.

FORM output.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

$$-Start: (1 )----


$$

ENHANCEMENT 2 ZMU_ENH_IMPL_REPORT_DECL. "active version

write: / 'This is an implicit declaration enhancement'.

ENDENHANCEMENT.

$$-End: (1 )----


$$

WRITE: / 'This is Standard'.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""

$$-Start: (2 )----


$$

ENHANCEMENT 1 ZMU_ENH_IMPL_REPORT_CODE. "active version

write: / 'This is an implicit code enhancement'.

ENDENHANCEMENT.

$$-End: (2 )----


$$

ENDFORM.

START-OF-SELECTION.

PERFORM output.[/code]

When I run my program, it seems to be unchanged. Nor the static neither the dynamic enhancement is processed. But when I

switch <i>zmu_enhance</i> <i>on</i> by a business function in SFW5, both enhancements are processed.

So the question is still what is the difference between static(declaration) and dynamic(code) enhancement point?

Best regards

Michael[code][/code][code][/code]

6 REPLIES 6
Read only

Former Member
0 Likes
4,036

Hi,

Refer below blog

/people/thomas.weiss/blog/2006/01/24/what-the-new-enhancement-framework-is-for-150-its-basic-structure-and-elements-for-beginners

Regards

Read only

0 Likes
4,036

Hi Kiran,

I have carefully read all the five blogs of Thomas Weiss to the Enhancement Framework, but I didn't find any portion of text concerning the static vs. dynamic Enhancement-Points, or what is about the distinction between declaration and code. Could you please cite the paragraph you mean?

Thank you very much

Michael Umlauff

Read only

0 Likes
4,036

Hi Michael,

You surely can write such statements in static enhancement-implementation, however the difference lies between being a conditional call and an unconditional call of implemnetations.

Incase the enhancement is not specified as static then it is supposed to be a dynamic implemenattion, which is called only if the status of its switch is ON, i.e a dynamic call at runtime. Whereas if it is a static implementation then the switch will not effect and the implemenattion is callled irrelevant to switch status.

See abap help for Enahncement-point for more clarification and revert if any doubts.

Hope this answers your query.

regards,

Vikas

<b>Encourage by rewarding points if useful.</b>

Read only

michael_umlauff
Product and Topic Expert
Product and Topic Expert
0 Likes
4,037

Hi Vikas,

thanks for your answer.

I have found an explanation like your answer in online help, but when I examine it I observe that the static enhancements aren't processed too if the switch is off.

Just a little example: I have a very small report that outputs just one line by a form:

[code]REPORT zmu_enhance_test.

FORM output.

WRITE: / 'This is Standard'.

ENDFORM.

START-OF-SELECTION.

PERFORM output.[/code]

I enter Enhancement mode and show the implicit enhancements. I find two in the form, one at the beginning and one at the end. I enhance the first by a static and the second dynamic enhancement. I put both enhancements into a package that is switched by my switch <i>zmu_enhance</i>, that is switched <i>off</i> at now.

[code]REPORT zmu_enhance_test.

FORM output.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

$$-Start: (1 )----


$$

ENHANCEMENT 2 ZMU_ENH_IMPL_REPORT_DECL. "active version

write: / 'This is an implicit declaration enhancement'.

ENDENHANCEMENT.

$$-End: (1 )----


$$

WRITE: / 'This is Standard'.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""

$$-Start: (2 )----


$$

ENHANCEMENT 1 ZMU_ENH_IMPL_REPORT_CODE. "active version

write: / 'This is an implicit code enhancement'.

ENDENHANCEMENT.

$$-End: (2 )----


$$

ENDFORM.

START-OF-SELECTION.

PERFORM output.[/code]

When I run my program, it seems to be unchanged. Nor the static neither the dynamic enhancement is processed. But when I

switch <i>zmu_enhance</i> <i>on</i> by a business function in SFW5, both enhancements are processed.

So the question is still what is the difference between static(declaration) and dynamic(code) enhancement point?

Best regards

Michael[code][/code][code][/code]

Read only

0 Likes
4,036

Hi Michael,

I tried simulating the scenario you mentioned and its works the same way as you mentioned, however when i read the ABAPHELP documentation for switch under Enhancement-point this is what it says.

Addition 1

... STATIC

Effect

: The addition STATIC is used to define a static source code enhancement. In a static source code enhancement, all incorporated source code plug-ins are taken into account when the program is executed, including those whose switch is in the status stand-by.

So I believe that the status off will put the Enhancement implementation in OFF mode but the difference lies between the status mode Stand-by.

Incase of stand-by mode only static implementations are called and not the dynamic ones.

Thus this is what i hope is an acceptable explanation to your question.

regards,

Vikas

Read only

michael_umlauff
Product and Topic Expert
Product and Topic Expert
0 Likes
4,036

Hi Vikas,

you are probably right: 10pt

I found another piece of documentation which fortifies your opinion. help.sap.com -> Switch Framework explains on page <a href="http://help.sap.com/saphelp_nw70/helpdata/en/4e/708441fd86030de10000000a1550b0/content.htm">Switch States</a>

for STAND BY:

<i>Switches on all declarative Repository objects, that is, all switchable objects of the ABAP Dictionary and all static source code enhancements.</i>

Many thanks

Michael