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: 

Class enhancement: Use super-> in overwrite exit

0 Kudos

Hi all,

We need to enhance a method in a class inherited from a super class.

In this method there is an access to the inheriting method:

CALL METHOD super->if_fpm_guibb_form~get_data


This is not working in the overwrite exit, and adding core_object-> like this:

CALL METHOD core_object->super->if_fpm_guibb_form~get_data

does not work better.


Any idea ?


Thanx !

4 REPLIES 4

Former Member
0 Kudos

having the same issue, anyone knows the answer?

0 Kudos

It seems to works now. see below for one class method overwrite exit (additional codes / changes hightlighted in red)

CLASS LCL_ZCL_CLL_POWLT_SURVMON DEFINITION DEFERRED.

CLASS /SAPSRM/CL_CLL_POWLT_SURVMON DEFINITION LOCAL FRIENDS LCL_ZCL_CLL_POWLT_SURVMON.

CLASS LCL_ZCL_CLL_POWLT_SURVMON DEFINITION INHERITING FROM /SAPSRM/CL_CLL_POWL_BO_SURV. "Superclass of the original class

PUBLIC SECTION.

     CLASS-DATA OBJ TYPE REF TO LCL_ZCL_CLL_POWLT_SURVMON. "#EC NEEDED

     DATA CORE_OBJECT TYPE REF TO /SAPSRM/CL_CLL_POWLT_SURVMON. "#EC NEEDED

INTERFACES  IOW_ZCL_CLL_POWLT_SURVMON.

     METHODS:   CONSTRUCTOR IMPORTING CORE_OBJECT     TYPE REF TO /SAPSRM/CL_CLL_POWLT_SURVMON OPTIONAL. ENDCLASS.

CLASS LCL_ZCL_CLL_POWLT_SURVMON IMPLEMENTATION.

METHOD CONSTRUCTOR.

super->constructor( ).

me->CORE_OBJECT = CORE_OBJECT.

core_object->L_CL_CLL_POWL_BO_SURV ?= OBJ. "L_CL_CLL_POWL_BO_SURV an enhancement attribute with type ref                                                                                   " to /SAPSRM/CL_CLL_POWL_BO_SURV (superclass of the class /SAPSRM/CL_CLL_POWLT_SURVMON)

ENDMETHOD.

Then change the calling of super->method to core_object->L_CL_CLL_POWL_BO_SURV->method



However as it created another instance by SUPER->CONTRUCTOR( ). I belive all attributes values inherted from the superclass with be gone...... looking for another implementation........

0 Kudos

Hi,

The code above was useful but we had to amend some lines.

I am writing the code that worked for us but using other overwrite exit. Please check the amended lines indicated below.

CLASS LCL_ZPTP_CL_CH_WD_DODM_SC_I_D DEFINITION DEFERRED.

CLASS /SAPSRM/CL_CH_WD_DODM_SC_I_DSC DEFINITION LOCAL FRIENDS LCL_ZPTP_CL_CH_WD_DODM_SC_I_D.

CLASS LCL_ZPTP_CL_CH_WD_DODM_SC_I_D DEFINITION INHERITING FROM /SAPSRM/CL_CH_WD_DO_MAPPER. "Superclass of the original class.

PUBLIC SECTION.

CLASS-DATA OBJ TYPE REF TO LCL_ZPTP_CL_CH_WD_DODM_SC_I_D. "#EC NEEDED

DATA CORE_OBJECT TYPE REF TO /SAPSRM/CL_CH_WD_DODM_SC_I_DSC . "#EC NEEDED

  INTERFACES  IOW_ZPTP_CL_CH_WD_DODM_SC_I_D.

  METHODS:

    CONSTRUCTOR IMPORTING CORE_OBJECT

      TYPE REF TO /SAPSRM/CL_CH_WD_DODM_SC_I_DSC OPTIONAL.

ENDCLASS.

CLASS LCL_ZPTP_CL_CH_WD_DODM_SC_I_D IMPLEMENTATION.

METHOD CONSTRUCTOR.

Amended:   CALL METHOD super->constructor

    EXPORTING

      ion_cll_set_facade        CORE_OBJECT->MON_CLL_SET_FACADE

      io_wd_view_controller      = CORE_OBJECT->mo_wd_view_controller

      io_wd_component_controller = CORE_OBJECT->mo_wd_component_controller

      io_parent_bo_mapper        = CORE_OBJECT->mo_parent_bo_mapper

      io_meta_init              = CORE_OBJECT->mo_meta_init.

  ME->CORE_OBJECT = CORE_OBJECT.

Amended:  ME->CORE_OBJECT->%_ZPTP_CL_CH_WD_DODM_SC_I_D ?= obj."%_ZPTP_CL_CH_WD_DODM_SC_I_D an enhancement attribute with type ref

                                                    " to /SAPSRM/CL_CH_WD_DO_MAPPER (superclass of the class /SAPSRM/CL_CH_WD_DODM_SC_I_DSC)

ENDMETHOD.


for us the last line did not work, but we tried this line and it worked successfully.


Then change the calling of super->method to Amended: CALL METHOD obj->/SAPSRM/IF_CLL_MAPPER~REFRESH.




juanlee337
Explorer
0 Kudos

does anybody have answer to this question?