Acorel
Gratis demo

Redefining a method of a view

Pieter Rijlaarsdam, 04 augustus 2010

If you need to redefine a method because you want to alter the standard behavior of the system, you should always first ‘enhance the component and enhance the view’. When enhancing, the system generates enherited z-classes containing only inherited methods. How to redefine a view can be found here.

If you want to alter the coding of the standard, you can now redefine an inherited method. Redefining means that the system no longer calls the standard class, but your redefined class.

It is recommended to always call the standard coding either in the beginning of the redefined class or in the end, depending on what kind of alteration you are planning. This way, if the standard functionality changes, your code still calls this changed functionality.

The standard (inherited) method can always be called using ABAP coding:

CALL METHOD super->[NAME OF THE CURRENT METHOD]
    EXPORTING
        [IMPORTING PARAMETERS] = [IMPORTING PARAMETERS]
    IMPORTING
        [EXPORTING PARAMETERS] = [EXPORTING PARAMETERS]

Of course if there are no parameters, the importing and exporting parameters can be left out.

Example:

CALL METHOD super->do_prepare_output
    EXPORTING
        iv_first_time = iv_first_time.

This method calls the do_prepare_output of the parent class.

Pieter Rijlaarsdam

Read all my blogs

Receive our weekly blog by email?
Subscribe here:

More blogs