Skip to Content
0
Mar 16, 2010 at 09:09 PM

DEFAULT parameter in method definition

5421 Views

Hello everybody,

I do not understand why the following code will lead to a syntax error:

Within a static method, you can only access class attributes without further specifications.

CLASS lcl_range DEFINITION.
  PUBLIC SECTION.
    DATA: mv_start TYPE date,
          mv_stop TYPE date.

    METHODS:
      create_copy
        IMPORTING iv_start TYPE date DEFAULT mv_start
                  iv_stop TYPE date DEFAULT mv_stop
        RETURNING VALUE(ro_range) TYPE REF TO lcl_range.

ENDCLASS.

Replacing the DATA definition with CLASS-DATA will work, but I do not want a static attribute.

I want to be able to clone an object

best regards