Application Development 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: 

Error while redefining a method in sub class

Former Member
0 Kudos

Dear Friends,

When i am trying to redefine ( SYNC_DATA ) method in one subclass, i am getting the following error

"A Component SYNC_DATA has already been inherited from ZCL_IPS_EXCEL_MASTER"( this is parent class)

please check the screen shot, could you please let me know what is the issue ?

Advance Thanks

Vijaya

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Please check your methods, SYNC_DATA is already defined(i.e. inherited from parent)....

Please select the existing method for re-definition rather than  creating new..

8 REPLIES 8

Former Member
0 Kudos

Please check your methods, SYNC_DATA is already defined(i.e. inherited from parent)....

Please select the existing method for re-definition rather than  creating new..

0 Kudos

Thanks Maju

could you please let me know , how to call this SYNC_DATA  method in my program

Advance Thanks

Vijaya

0 Kudos

Hi,

You can call your method using objects or from the "Pattern" button in ABAP editor..

Use Pattern so that it gives you the same interface as u call a function module.

1. From SE38, press "Pattern Button"

2. Click on ABAP Object patterns radio button

3. Now Select "call Method" radio button..

4. Instance:           Provide the Object created for the class

    Class/Interface: provide the class name

    Method:             provide the Method name

5. ENTER

0 Kudos

SYNC_DATA  is declared as protected

Inline image 1

when i try to call this method i am getting " ACCESS TO PROTECT METHOD SYNC_DATA  IS NOT ALLOWED"  could you please let me know how to call this method in my program

Advance thanks

Vijaya

0 Kudos

Hi Vijaya,

I would recommend you to first understand the Object oriented concepts and start your work..Please search through scn for threads and documents...

To being with see this: http://scn.sap.com/docs/DOC-10236

"In subclasses, it is not possible to access the protected components of the superior classes using reference variables of the type of the superior class, because otherwise an attribute of an object of the dynamic type of the superior class or another subclass could be changed."{SAP Documentation}

Please use the correct Object(instance) to access the method..

former_member215344
Contributor
0 Kudos

Hi Vijaya,

As Maju said, you need to redefine the same method from menu options. It won't allow you to create another method with the same name.

Also if you want to invoke the super class method in addition to your redefined code, you need to call super->SYNC_DATA() before the re-definition.

Thanks,

Ajay Bose

Former Member
0 Kudos

Hello Vijaya lakshmi,

Method is already Created in your above screen shot.

Former Member
0 Kudos

Dear Friends

could you please let me know , how to call this SYNC_DATA  method in my program

Advance Thanks

Vijaya