- COC1_FEATURE_CHECK to get characteristic ID
- CTMS_DDB_INIT to initialize memory
- CTMS_CLASS_DDB to put in memory classification settings
- CTMS_DDB_SET_VAL_FROM_OBJECT to set values in update screen from existing object (option)
- CTMS_DDB_SET_VALUE_INTERNAL to set values in update screen in case of using reference data structure
- CTMS_DDB_SET_VALUE_ONLINE to call the update screen
- CTMS_DDB_HAS_VALUES_INTERNAL to check and get the values from the update screen after user action
- zcl_abapblog_com_classific=>create_structure_for_class to create reference data structure
- zcl_abapblog_com_classific=>move_screen_val_to_ref_data to move screen values to reference data
- zcl_abapblog_com_classific=>clear_initial_line_api_vari to delete initial line for multiple values characteristics
- zcl_abapblog_com_classific=>move_ref_data_to_screen_val to move reference data to update screen values table
value( I_SET_VAL_FROM_OBJECT ) TYPE FLAG -> If set to 'X' then we get values from the classification object directly, if empty then from ref data
value( I_OBJECT ) TYPE AUSP-OBJEK -> Key of object to be classified
value( I_TABLE ) TYPE TCLA-OBTAB -> Name of database table for object
value( I_DATE ) TYPE SY-DATUM  DEFAULT SY-DATUM -> date for characteristics value
I_STRUCTURE TYPE REF TO CL_ABAP_STRUCTDESCR OPTIONAL -> structure of classification for reference data
ET_VALUES TYPE TT_API_VALI -> table with update screen values in it's internal format
C_DATA TYPE REF TO DATA OPTIONAL -> Classification details with reference data
CHARACTERISTIC_UNKNOWN  
ERROR_SETTING_CHAR_VALUES  
NO_VALUES_FOUND  
ERROR_CREATING_TABLE  
  method show_charact_values_screen.
    data: m_ucomm like sy-ucomm.
    data: ms_api_char type api_char.
    data: mt_api_char like standard table of ms_api_char.
    data: m_atinn type api_value-atinn.
    data: mt_error_val type standard table of api_vali.
    data: mt_vali type standard table of api_vali.
    data: mt_vali2 type standard table of api_vali.
    data: ms_data type ref to data.
    data: mo_structure type ref to cl_abap_structdescr.
    data: mo_table     type ref to cl_abap_tabledescr.
    refresh et_values[].
    "get characteristic ID
    call function 'COC1_FEATURE_CHECK'
      exporting
*       feature_id                  = atinn
        feature_neutral_name        = i_atnam
      importing
        feature_id                  = m_atinn
*       feature_neutral_name        = atnam
*       conversion_exit             = l_atkon
*       number_of_positions         = l_anzst
*       set_get_parameter           = l_atpid
      exceptions
        invalid_class_type          = 1
        missing_feature_information = 2
        no_feature_found            = 3
        no_feature_valid            = 4
        no_language                 = 5
        others                      = 6.
    if sy-subrc <> 0.
*   Error
      raise characteristic_unknown.
    endif.
    ms_api_char-atinn = m_atinn.
    append ms_api_char to mt_api_char.
    call function 'CTMS_DDB_INIT'.
    call function 'CTMS_CLASS_DDB'
      exporting
        class             = i_class
        classtype         = i_klart
        mode              = 'S'
*       LANGUAGE          = SY-LANGU
        key_date          = i_date
        objectid          = i_table
        object            = i_object
*       I_ADD_ON_CHAR     = ' '
*       I_TABS_ACTIVE     = ' '
*       INIT_CONF         = ' '
*       READONLY          = ' '
*       I_CALLED_FROM_DDB = ' '
      exceptions
        not_found         = 1
        others            = 2.
    if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    if i_set_val_from_object is not initial and
       i_object is not initial              and
       i_table  is not initial.
      call function 'CTMS_DDB_SET_VAL_FROM_OBJECT'
        exporting
          object                             = i_object
          objectid                           = i_table
          date                               = i_date
*   TABLES
*     OBJECTS                            = OBJECTS
       exceptions
         not_found                          = 1
         no_objectid                        = 2
         no_object                          = 3
         fb_ctms_class_ddb_not_called       = 4
         others                             = 5
                .
      if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    elseif it_values[] is supplied.
      zcl_abapblog_com_classific=>clear_initial_line_api_vari( it_api_char = mt_api_char   ).
      call function 'CTMS_DDB_SET_VALUE_INTERNAL'
        tables
          imp_values                    = it_values[]
          exp_values_error              = mt_error_val[]
        exceptions
          currency_check                = 1
          date_check                    = 2
          format_check                  = 3
          illegal_internal_baseunit     = 4
          interval_check                = 5
          pattern_check                 = 6
          time_check                    = 7
          unit_check                    = 8
          value_not_found               = 9
          no_valid_dimension            = 10
          interval_not_allowed          = 11
          display_mode                  = 12
          characteristic_not_found      = 13
          value_not_possible            = 14
          characteristic_enqueue        = 15
          objectcharacteristic          = 16
          only_one_value_allowed        = 17
          characteristic_not_selectable = 18
          input_to_long                 = 19
          value_contradiction           = 20
          others                        = 21.
      if sy-subrc <> 0.
        raise error_setting_char_values.
      endif.
    elseif c_data is not initial.
      zcl_abapblog_com_classific=>move_ref_data_to_screen_val(
        exporting
          i_atnam                      = i_atnam
          i_data                       = c_data
        changing
          ct_values                    = mt_vali
        exceptions
          no_structure_or_table_passed = 1
          error_creating_structure     = 2
          no_data_to_change            = 3
          structure_error              = 4
          others                       = 5
             ).
      if sy-subrc eq 0.
        zcl_abapblog_com_classific=>clear_initial_line_api_vari( it_api_char = mt_api_char   ).
        call function 'CTMS_DDB_SET_VALUE_INTERNAL'
          tables
            imp_values                    = mt_vali[]
            exp_values_error              = mt_error_val[]
          exceptions
            currency_check                = 1
            date_check                    = 2
            format_check                  = 3
            illegal_internal_baseunit     = 4
            interval_check                = 5
            pattern_check                 = 6
            time_check                    = 7
            unit_check                    = 8
            value_not_found               = 9
            no_valid_dimension            = 10
            interval_not_allowed          = 11
            display_mode                  = 12
            characteristic_not_found      = 13
            value_not_possible            = 14
            characteristic_enqueue        = 15
            objectcharacteristic          = 16
            only_one_value_allowed        = 17
            characteristic_not_selectable = 18
            input_to_long                 = 19
            value_contradiction           = 20
            others                        = 21.
        if sy-subrc <> 0.
          raise error_setting_char_values.
        endif.
      endif.
    endif.
    call function 'CTMS_DDB_SET_VALUE_ONLINE'
      exporting
        characteristic       = m_atinn
        display              = i_display
*       udef_instance        = '999'
      importing
        return_with_function = m_ucomm.
    call function 'CTMS_DDB_HAS_VALUES_INTERNAL'
      exporting
        assigned_values      = 'X'
        allowed_values       = ' '
        valid_values         = ' '
        inconsistent_values  = ' '
        first_assigned_value = ' '
        default_values       = ' '
        language             = sy-langu
        document_info        = ' '
        excl_knowledge       = ' '
        i_called_from_ddb    = ' '
      tables
        imp_characteristics  = mt_api_char[]
        exp_values           = et_values[]
      exceptions
        not_found            = 1
        others               = 2.
    if sy-subrc <> 0.
      raise no_values_found.
    endif.
*  endif.
    if c_data is requested.
      if c_data is initial.
        if i_structure is bound.
          mo_structure = i_structure.
        else.
          zcl_abapblog_com_classific=>create_structure_for_class(
            exporting
              i_class                     = i_class
              i_classtype                 = i_klart
              i_key_date                  = i_date
            importing
              e_structure                 = mo_structure
*          et_data                     = es_classif_details-data
*          e_table                     = mo_table
            exceptions
              class_classtype_fetch_error = 1
              error_creating_table        = 2
              characteristics_error       = 3
              others                      = 4
                 ).
          if sy-subrc eq 0.
          endif.
        endif.
        try.
            create data c_data type handle mo_structure.
          catch cx_sy_create_data_error.
            raise error_creating_table.
        endtry.
      endif.
      zcl_abapblog_com_classific=>move_screen_val_to_ref_data(
      exporting
        it_values                    = et_values[]
        i_atnam                      = i_atnam
      changing
        c_data                       = c_data
      exceptions
        no_structure_or_table_passed = 1
        error_creating_structure     = 2
        no_data_to_change            = 3
        structure_error              = 4
        others                       = 5
        ).
      if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endif.
  endmethod.                    "show_charact_values_screen



