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

In Pre-Exit, prevent method from being called

Former Member
0 Likes
4,754

I have created an enhancment for a webdynpro component. Then, I have defined a pre-exit for a method in the component controller. Inside the pre-exit, I do a couple of checks, and depending on them, I would like to skip the processing of the method for which I have define the pre-exit. Is this possible?

I thought of the RETURN statement, but this won't help. RETURN will jump out of the pre-exit, but not out of the method.

my-pre-exit-of-method-SET_MY_VALUE.

IF some_condition = some_value.

"prevent the method SET_MY_VALUE from being called. but how??

ENDIF.

end-of-pre-exit.

I have created an enhancment for a webdynpro component. Then, I have defined a pre-exit for a method in the component controller. Inside the pre-exit, I do a couple of checks, and depending on them, I would like to skip the processing of the method for which I have define the pre-exit. Is this possible?

I thought of the RETURN statement, but this won't help. RETURN will jump out of the pre-exit, but not out of the method.

my-pre-exit-of-method-SET_MY_VALUE.

IF some_condition = some_value.

"prevent the method SET_MY_VALUE from being called. but how??

ENDIF.

end-of-pre-exit.

14 REPLIES 14
Read only

Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert
0 Likes
3,060

Well, this may sound like an awkward way, but if there is no provided exit / enhancement etc., perhaps you could store a flag in memory using EXPORT TO MEMORY in my-pre-exit-of-method-SET_MY_VALUE.

Then use an implicit enhancement point at the beginning of the method SET_MY_VALUE to IMPORT the same flag, and use RETURN or EXIT if the flag is set.

Just be certain that jumping out of the method will not cause some inconsistency in the program.

Read only

Former Member
0 Likes
3,060

We know it will work if we modify the standard SAP method with some code but the defeats the purpose of a pre/post exit. The powers to be here don't allow sap mods unless it's a last resort and an act of god happens. It seems silly that there wouldn't be a way to skip the method in the pre-exit though. So far we've had no luck trsting everything we know that might do that.

Read only

Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert
0 Likes
3,060

What I suggested is not a core mod but utilization of an implicit enhancement point.

Read only

Former Member
0 Likes
3,060

Over-ride exit on that method?

Read only

Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert
0 Likes
3,060

I'm not sure what do you mean by 'over-ride exit', but if you go to that method and click on the swirly 'Enhance' button in the toolbar, then Edit -> Enhancement operations -> Show implicit enhancement options, then you'll see the implicit enhancement at the very beginning of the method. You can create an implementation by right clicking that, and selecting Enhancement implementation -> Create.

This doesn't require a key and is not a modification... but inserts your code at that location.

Read only

Former Member
0 Likes
3,060

Don't see anything like that in SE80 in web dynpro FITE_VC_RECTIPTS view RECIPTS_VIEW method ONACTIONNEW.

Read only

0 Likes
3,060

When you are inside the method which you want skip. Click on spiral and then go to edit click on enhancement operations choose show implicit. You will get line at beginning and end of the method. right click on the line at beginning and create implicit enhacement and code as desired.

The idea is to set a flag in pre exit export it to memory id and in the implenetation you import it and based on the value skip your processing.

Nabheet

Read only

Former Member
0 Likes
3,060

The issue is after you click the enhance button there is no implicit stuff anywhere. Not on the right click menu, edit menu, nothing! I can follow this advise on a custom method and get implicit so I see it but I just can't get to it the same way in the SAP standard method.

Read only

0 Likes
3,060

What do you see in enhancement operations?

Nabehet

Read only

Former Member
0 Likes
3,060

Tcode: SE80

web dynpro: FITE_VC_RECTIPTS

view: RECIPTS_VIEW

method: ONACTIONNEW

We have the enhancement icon or you can right click 'enhance'. You pick/create an enhancement then proceed. That's it after that. You get pre-exit and post-exit buttons in the 'methods' tab but nothing else we can find.

Read only

Former Member
0 Likes
3,060

I think after some more research this might be a version issue. We're on ECC 6.0 EH3 and I'm seeing we need EH4 to use overwrite exits. Anyone confirm this? That would be why we don't see the oeverwrite exit.

Read only

Former Member
0 Likes
3,060

Hi David,

I know this is pretty old thread, but i am stuck at a similar situation where i need to bypass main method owing to some condition in pre-exit method.

If you have come up with the solution to this situation, kindly reply. It would be really helpful.

Thanks in advance.

Ankit.

Read only

0 Likes
3,060

I just find out how to circumvent this...

The trick is to use "Overwrite exit".  Add your own codes.  Depending on your conditions, you can call back the original method.  But when you call the original method, you need to use the syntax:

me->original_method(...)

Do not use:

wd_this->original_method(...)

Using "me" will only call the original method; using "wd_this" will trigger your overwrite exit which means this will jump to a recursive call to your own exit; This will certainly drain the resources of your system indefinitely until it dumps.

Brian H.

Read only

muneshpatwari
Active Participant
0 Likes
3,060

Hi David,

A workaround can be to copy the entire method code in the over-write exit and paste your check in the pre-exit above this code. Remove the pre-exit.

Hope it helps.

Regards,

Munesh.