Redefining a method of a view, Acorel
Gratis demo

Redefining a method of a view

Pieter Rijlaarsdam

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.

Redefining a method of a view, AcorelIf 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:


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


CALL METHOD super->do_prepare_output
        iv_first_time = iv_first_time.

This method calls the do_prepare_output of the parent class.

Redefining a method of a view, Acorel

Pieter Rijlaarsdam

Meer nieuws

  1. Pieter can you help me with this. I need to set the default currency field for a sales quotation. The context node is btadminh. I have enhance the appropriate view component and context node. I'm pretty certain i have to redefine the get_currency method. So if I right click on this method for the currency field there is an option to redefine this method. Now at the top it has a comment about calling the super class…but I'm uncertain what parameters to pass to this function. More information and sample code can be found here But no one is able to help me. This blog post was the best I could find.

  2. Pieter I got it..I ended up just uncommenting the code and I was able to put my code below it. This was an excellent post. Thank You Pieter. Here is the result of my code

    * First call super class
    ATTRIBUTE_PATH = attribute_path
    ITERATOR = iterator
    VALUE = value.

    * Check the system language
    if value eq ''.
    IF sy-langu EQ 'E'.
    VALUE = 'USD'. "its English so default USD
    elseif sy-langu EQ 'D'.
    VALUE = 'EUR'. "its German so EUR

  3. Cool. Be aware though that this will probably have the side effect that the user will not be able to delete the value if he wants to (which of course might not be a problem in your case).

    Good to hear that you found a solution 🙂

  4. Pieter the default value is set, however when I save my quotation the CRM system saves it but it has one error in that error pop up that opens up on the web browser. The error is "please select a currency" but one is already defaulted. Maybe I need to call the set currency method that you mentioned in the other blog post??

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *