Generic 打印ID对应的object type的工具

Created by Jerry Wang, last modified on Sep 23, 2015

输入任意类型对应的ID,该report能打印出ID对应的object type:
Generic 打印ID对应的object type的工具

REPORT zdisplay_id.

PARAMETERS: id TYPE if_fdt_types=>id OBLIGATORY DEFAULT 'FA163E8EAB031EE48B847ADC6A96D5F0'.
START-OF-SELECTION.
  DATA:      lo_instance TYPE REF TO if_fdt_admin_data,
             lv_unknown  TYPE boolean.
  CALL METHOD cl_fdt_factory=>get_instance_generic
    EXPORTING
      iv_id         = id
    IMPORTING
      eo_instance   = lo_instance
      ev_id_unknown = lv_unknown.
  IF lv_unknown = abap_true.
    WRITE: / 'ID Unknown.' COLOR COL_NEGATIVE.
    RETURN.
  ENDIF.
  DATA(lo_object) = cl_abap_classdescr=>describe_by_object_ref( lo_instance ).
  WRITE: / lo_object->get_relative_name( ) COLOR COL_NEGATIVE.

输出CL_FDT_FUNCTION, 表明该ID对应的object是 Function
Generic 打印ID对应的object type的工具
输出CL_FDT_RULESET, 表明该ID对应的object是Ruleset
Generic 打印ID对应的object type的工具

上一篇:泛型。


下一篇:病毒运行方式 2006-09-24 21:43