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

Error while redefining a method in sub class

Former Member
0 Likes
2,064

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
Read only

Former Member
0 Likes
1,814

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
Read only

Former Member
0 Likes
1,815

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..

Read only

0 Likes
1,814

Thanks Maju

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

Advance Thanks

Vijaya

Read only

0 Likes
1,814

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

Read only

0 Likes
1,814

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

Read only

0 Likes
1,814

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..

Read only

Former Member
0 Likes
1,814

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

Read only

Former Member
0 Likes
1,813

Hello Vijaya lakshmi,

Method is already Created in your above screen shot.

Read only

Former Member
0 Likes
1,813

Dear Friends

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

Advance Thanks

Vijaya