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 change/edit CLASS and FUNCTION MODULE ?`

ankur_sharma16
Active Participant
0 Likes
5,789

Hello Experts,

I want to change/edit the class and function module, like if they contains data element, say zelement, i want to update it to some other name like yelement.

For class i tried the FM RPY_CLIF_COMP_UPDATE but i am getting error in it.

For function module i got the FM RS_FUNCTION_CHANGE but it does not do anything.

Please suggest something.

Regards,

Ankur Sharma.

17 REPLIES 17
Read only

JJosh
Active Participant
0 Likes
4,302

Hi,

If it is custom built, then u can directly change else if it is standard.. copy to Z and then implement ur logic.

BR/Josh

Read only

0 Likes
4,302

Sorry i forgot to mention, it should be done programatically.

Please advice.

Read only

JJosh
Active Participant
0 Likes
4,302

Can u explain the issue ?

Read only

ankur_sharma16
Active Participant
0 Likes
4,302

Ok, my problem is, i want to change the name of data element which is being used in a class.

For eg:  ZELEMENT is used in class attribute as data element. So i want to change it to some other name, say YELEMENT.

This can be done using FM RPY_CLIF_COMP_UPDATE, but when am trying to do so, i get error every time.

Read only

0 Likes
4,302

Hi,

Please check the function module within the functon group SD51.

SD51 is the function group for Data Element Editing.

Cheers

~Niranjan

Read only

0 Likes
4,302

In se37 , explore  RPY_DATAELEMENT*

It is not advisable to change the DE names.

Read only

ankur_sharma16
Active Participant
0 Likes
4,302

But i need to update the data element name in class / FM .

Read only

ankur_sharma16
Active Participant
0 Likes
4,301

I know its not good to rename the data element, but this is what i need to do.

I am able to rename the data element but i should also rename at all the places where it is being used, so if its used in a class than i should also change there.

Read only

0 Likes
4,301

Hi,

I don't think there is any std way of doing this. You can check for where used list and then manually change.

Read only

ankur_sharma16
Active Participant
0 Likes
4,301

Since the FM is available, i think we can change the DE name by using it.

Still if you get anything related to it, do share with me.

Thanks.

Read only

0 Likes
4,301

Hi Ankur,

    Even if we rename the data element using the function module, it will just update the DDIC object and not to all the places where it is referred.

You will have to manually rename it in the places where it is used. I have worked with SAP Upgrades, so I don't think we have shortcuts for this in SAP .

BR/Josh

Read only

ankur_sharma16
Active Participant
0 Likes
4,301

Hello Josh,

You are absolutely correct, but i am doing the task to rename the data element, and then using where used list i am changing the DE name at all the places where it is being used. Like DE is used in TABLES / Structures i am able to change there also. But am stuck with classes and FMs. So for classes i got the update FM but some error is coming and i dont know how to cope with it.

Read only

0 Likes
4,301

okok I understood... The error is because.. since the same DE is referred in FM or Classes.... It throws error.

Try this : Before activating --> Change it in all places where it is referenced and also in the IMPORT / EXPORT parameters. I guess then it should be activated...

Also If the same FM / Classes is referenced in multiple places, this should also be taken into consideration.

Read only

ankur_sharma16
Active Participant
0 Likes
4,301

I have created a class for test purpose which is not used at anyother place.

I have created one data element globally and used it as attribute in the class.

for eg. :

class ZCLASS_1 definition

  public

  create public .

  public section.

data ATTR1 type ZELEMENT .

   methods METHOD1

    importing

      PAR1 type ZELEMENT

      PAR2 type ZELEMENT .

Now in the directory i can rename the data element, say Zelement. But i should also change the name at all the places where it is being used. So using where used list i am searching all the places and changing there.

Now since ZELEMENT is used in this class, it should be changed to the new name. So update the name in this class i have to do something. I tried updating the class with that update FM but its showing some error, because i guess am not passing all the data or something like that.

So now am stuck, i have FM to update but am not getting how to use it.

Read only

ankur_sharma16
Active Participant
0 Likes
4,301

Experts, please advice me.

Read only

ankur_sharma16
Active Participant
0 Likes
4,301

SEO_PARAMETER_CHANGE_F_DATA, SEO_ATTRIBUTE_CHANGE_F_DATA

Using thse 2 FMs we can update the class/interface.

Read only

0 Likes
4,301

Hi Ankur,

I had the same situation where the FM: RS_FUNCTION_CHANGE was not working. So, I resolved it by the following way:-

  1. Get the Include name of the Function module that you wanted to change. You may use any Function-READ APIs (like FUNCTION_INCLUDE_INFO etc)
  2. Call "RPY_INCLUDE_UPDATE". Pass the required data with the new source code of the FM-to-be changed

APPLICATION = 'X'

DEVELOPMENT_CLASS

INCLUDE_NAME = 'NAME OF THE INCLUDE THAT YOU READ IN THE PREVIOUS STEP'

TITLE_STRING = 'SOME MEANINGFUL TEXT"

SOURCE_EXTENDED TABLE SHOULD HAVE THE NEW SOURCE CODE.

So, You can then see the FM changed with new source code.

~ Guru