Link Search Menu Expand Document

Create an option


To create an option based on class attributes, just press F8.

The description of the fields is similar to the description of the structure

except that attributes must be PUBLIC and READ-ONLY
They can be either:

  • Instance Attribute
  • Static Attribute
    but not both at the same time (otherwise an exception will occur)

Since READ-ONLY attributes cannot be changed outside the class you need to add ZCL_AQO_OPTION to the class friends.
If you forget to do this, a special reminder will be issued at runtime

When make initialization

It is advisable to call the setup creation code once in CONSTRUCTOR or in CLASS-CONSTRUCTOR

  " Default values! For simple types use initilazation in declaration itself

  " Optional initialization
  APPEND INITIAL LINE TO me->bukrs_range ASSIGNING <ls_bukrs>.
  <ls_bukrs>-sign   = 'I'.
  <ls_bukrs>-option = 'BT'.
  <ls_bukrs>-low    = '1000'.
  <ls_bukrs>-high   = '3000'.

  SELECT * INTO TABLE me->t002_tab
  FROM t002.

  " Read new values
        iv_package_id = '$TMP'                " Package    "#EC NOTEXT
        iv_option_id  = 'Class options'(op1)  " Any text < 30 symbols
        " Public read-only attributes is options!
        " CLASS-DATA or DATA (but not both)
        io_data       = me
        " iv_repair     = abap_true
    CATCH zcx_aqo_exception INTO lo_error.
      MESSAGE lo_error TYPE 'S' DISPLAY LIKE 'E'.

After that, the attributes of ME->* will contain the data that the developer or consultant could change in one of the maintenance programs