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

Enhancing Standard Class method

former_member425121
Participant
0 Likes
6,530

Hi

I need to modify one method on standard class. I know this question must be already answered in the forum, but i do not find this , i found how to add a new method but not how to modify a method.

I know i must go SE24: Class->Enhance->Give mi Z name implementation ; but then how insert my code into standard method ?

Does somebody can help me about how can i modify a standard method please.

Thanks & Regards

Frank

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
2,743

Hi,

You need to use implicit enhancement point to modify behavior of that method. Display that method in SE80, activate enhancement framework (Ctrl+F4) and display implicit enhancement points Edit -> Enhancement Operations -> Show Implicit Enhancement Options. You will see a line with quotes for each implicit enhancement point. For a class method you will have he start and end of method. You can use start of the method to overwrite code. Just don't forget to call exit to avoid execution of original code.

Cheers

5 REPLIES 5
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,743

>

> Does somebody can help me about how can i modify a standard method please.

Hello Frank,

To "modify" a standard method you have to use ex/implicit enhancement techniques.

You can "overwrite" the method implementation by using "overwrite method". Menu path is as follows:

Edit u2192 Enhancement Operations u2192 Add Overwrite Method

Further read on: [Enhancements to Global Classes and Interfaces|http://help.sap.com/saphelp_nw04s/helpdata/en/58/4fb541d3d52d31e10000000a155106/content.htm]

Hope this helps.

BR,

Suhas

Read only

mvoros
Active Contributor
0 Likes
2,744

Hi,

You need to use implicit enhancement point to modify behavior of that method. Display that method in SE80, activate enhancement framework (Ctrl+F4) and display implicit enhancement points Edit -> Enhancement Operations -> Show Implicit Enhancement Options. You will see a line with quotes for each implicit enhancement point. For a class method you will have he start and end of method. You can use start of the method to overwrite code. Just don't forget to call exit to avoid execution of original code.

Cheers

Read only

0 Likes
2,743

Thanks Suhas , Martin

I saw the enhancement implicit points in my standard method (one point at begin method and other point at end of method)

and i added my code at end of method and it works.

I really don't understand about 'do not forget call exit to avoid call the original class'; when i added my code in method it askme for a enhancement Z implementaction name , but i'm modifying the standard class so even i still remaining calling the standard class the method has my modyfications. Am i right ?

Thanks

Frank

Read only

Former Member
0 Likes
2,743

Hello Frank,

Martin mentioned you "'do not forget call exit to avoid call the original class';" because if you use the begining of the method enhancement options for your Z implementation you don't need to execute the SAP standard code after your custom code execution. That is the reason he mentioned don't forget to call exit after your custom code.

Next question answer is "Yes".

Your new custom Z implementation will be called when the SAP standard method execution comes to that point.

Let me know if you have any questions.

Thanks,

Greetson

Read only

0 Likes
2,743

Ok i know now wich was the point.

Thanks Greetson

Regards

Frank