REPORT zcity_of_nottingham.
DATA wanted_poster TYPE string VALUE '1000 silver coins reward for the capture of Robin Hood'.
START-OF-SELECTION.
DATA(robin_hood) = zcl_robin_hood=>get_instance( ).
robin_hood->examine_wanted_poster( wanted_poster ).
robin_hood->change_wanted_poster_stealthy( ).
robin_hood->examine_wanted_poster( wanted_poster ).
CLASS zcl_robin_hood DEFINITION
PUBLIC
FINAL
CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS get_instance
RETURNING
VALUE(result) TYPE REF TO zcl_robin_hood.
METHODS constructor.
METHODS change_wanted_poster_stealthy.
METHODS examine_wanted_poster
IMPORTING
wanted_poster TYPE string.
PRIVATE SECTION.
CLASS-DATA instance TYPE REF TO zcl_robin_hood.
ENDCLASS.
CLASS zcl_robin_hood IMPLEMENTATION.
METHOD constructor.
ENDMETHOD.
METHOD get_instance.
IF instance IS NOT BOUND.
CREATE OBJECT instance.
ENDIF.
result = instance.
ENDMETHOD.
METHOD change_wanted_poster_stealthy.
FIELD-SYMBOLS <wanted_poster> TYPE string.
ASSIGN ('(ZCITY_OF_NOTTINGHAM)WANTED_POSTER') TO <wanted_poster>.
IF sy-subrc = 0.
REPLACE 'Robin Hood' IN <wanted_poster> WITH 'Prince John'.
ENDIF.
ENDMETHOD.
METHOD examine_wanted_poster.
WRITE / wanted_poster.
IF wanted_poster CS 'Robin Hood'.
WRITE / 'Seriously?' COLOR COL_NEGATIVE.
ELSEIF wanted_poster CS 'Prince John'.
WRITE / 'Now it''s okay.' COLOR COL_POSITIVE.
ENDIF.
ENDMETHOD.
ENDCLASS.
example output of report
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 |