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

How to copy SAP class and modify the code? Please help.

Former Member
0 Likes
8,392

I like to know what transaction should i use to copy a SAP class and modify it. Also please let me know how dangerous it is to do this work.

Details: The instructions that i got is listed below. I have very minimal ABAP knowledge. Please help.

First I need to copy the SAP class /SAPPSSRM/CL_FY_NUMBER to Z* class.

In the following code LV_FISCAL_YEAR+2(2) is blank, move the <FY> to this value, add the code after the line 84.

Is this client dependent? I mean we have two client 800 and 830; I think it does not make any difference in any client right?

Message was edited by:

Les york

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
4,168

You can use the SE24 to copy the class and than change appropriate mehtod.

Regards,

Naimesh Patel

I like to know what transaction should i use to copy a SAP class and modify it. Also please let me know how dangerous it is to do this work.

Details: The instructions that i got is listed below. I have very minimal ABAP knowledge. Please help.

First I need to copy the SAP class /SAPPSSRM/CL_FY_NUMBER to Z* class.

In the following code LV_FISCAL_YEAR+2(2) is blank, move the <FY> to this value, add the code after the line 84.

Is this client dependent? I mean we have two client 800 and 830; I think it does not make any difference in any client right?

Message was edited by:

Les york

8 REPLIES 8
Read only

naimesh_patel
Active Contributor
4,169

You can use the SE24 to copy the class and than change appropriate mehtod.

Regards,

Naimesh Patel

Read only

0 Likes
4,168

Where is the option in SE24 to copy the class?

Read only

0 Likes
4,168

You can see the button as 7th in the application toolbar or you can use the Ctrl + F5 key combination to copy it.

Regards,

Naimesh Patel

Read only

0 Likes
4,168

Naimesh,

Excellent! Now it is asking me for package. As I am doing in SRM sandbox I will choose local object right?

Read only

0 Likes
4,168

I copied the SAP class now where and how to proceed to modify the code? Please help Mr. Patel.

Read only

matt
Active Contributor
0 Likes
4,168

Local object yes.

I realise you're not an abaper, but if you got one in, he could simply create a subclass of /SAPPSSRM/CL_FY_NUMBER (assuming it's not been made final) and override only the method that needs changing. ( if it is final, then you have to use composition, but again, that's pretty straight forward ). The point is, that copy a class rarely, if ever, needs to be done. That's one of the major points about using classes. If you use subclassing or composition, only small amounts of code need to be copied - which means if SAP change other bits in a new release, you automatically get them, thereby reducing the risk of an upgrade mucking up your cloned class.

I'd be extremely nervous about having any code that had been implemented by a non-developer, being put into productive use.

matt

Read only

matt
Active Contributor
0 Likes
4,168

> Also please let me know how dangerous it is to do this work.

Extremely. Don't do it. Get an ABAPper in. If you screw up your database, then you'll have to pay SAP a lot of money to put it right. At least with an experienced programmer you minimise the risk of this happening.

I'd liken it to allowing a novice to service the brakes on your car.

matt

Read only

0 Likes
4,168

I will not do it. Thank you.