ABAP 使用cl oo class獲取類資訊

2021-05-28 05:25:09 字數 3073 閱讀 3884

report zfsl_show_desktop.

tables : seoclass.

data : zcl_oo_class type ref to cl_oo_class.

data : lt_attributes type seo_attributes,

ls_attributes type vseoattrib,

lt_methods type seo_methods,

ls_methods type vseomethod,

ls_signature type seocmpsign,

lt_params type seo_parameters,

ls_params type vseoparam,

lt_exceps type seo_exceptions,

ls_exceps type vseoexcep.

data : ls_seotype type seotype,

lt_subclass type seo_relkeys,

ls_subclass type seorelkey.

** get component exposure **

refresh : lt_domval.

cl_reca_ddic_doma=>get_values(

exporting

id_name = 'seoexpose'

id_langu = sy-langu

importing

et_values = lt_domval

exceptions

not_found = 1

others = 2 ).

write :/ 'components visibility '.

write :/ '----------------------'.

loop at lt_methods into ls_methods.

clear : lv_exposure.

move ls_methods-cmpname to lv_cpdname.

try.

zcl_oo_class->get_component_exposure(

exporting

cpdname = lv_cpdname

receiving

result = lv_exposure ).

clear : ls_domval.

read table lt_domval into ls_domval with key domvalue_l = lv_exposure.

if sy-subrc eq 0.

write :/ lv_cpdname, ls_domval-ddtext.

endif.

catch cx_component_not_existing .

endtry.

endloop.

write :/.

** get attribute type **

refresh : lt_domval.

cl_reca_ddic_doma=>get_values(

exporting

id_name ='seotyptype'

id_langu = sy-langu

importing

et_values = lt_domval

exceptions

not_found = 1

others = 2 ).

write :/ 'class attributes details'.

write :/ '------------------------'.

loop at lt_attributes into ls_attributes.

try.

move ls_attributes-cmpname to lv_cpdname.

zcl_oo_class->get_attribute_type(

exporting

cpdname = lv_cpdname

receiving

result = ls_seotype ).

clear :ls_domval.

read table lt_domval into ls_domval with key domvalue_l = ls_seotype-typtype.

if sy-subrc eq 0.

move ls_seotype-type to lv_type.

move ls_domval-ddtext to lv_text.

write :/ lv_cpdname, lv_text, lv_type.

endif.

catch cx_component_not_existing .

catch cx_wrong_component_type .

endtry.

endloop.

write :/.

** get list of sub classes **

refresh : lt_subclass.

lt_subclass = zcl_oo_class->get_subclasses( ).

if lt_subclass is not initial.

write :/ 'subclass details'.

write :/ '----------------'.

loop at lt_subclass into ls_subclass.

write :/ ls_subclass-refclsname, ls_subclass-clsname.

endloop.

endif.

write :/.

** get list of super classes **

clear : lv_superclass.

lv_superclass = zcl_oo_class->get_superclass( ).

write :/ 'super class -> ' ,lv_superclass.

endif.

source link:

使用ABAP呼叫BRF function

針對如下的brf function 基於如下輸入,根據rule的規則,計算出的final price應等於 10 1 0.12 8.93 可以使用如下的report來將上述輸入傳入brf 的api,通過abap 來呼叫function的執行 report zcall function.data lo...

ABAP 動態where 使用

report ztest001 xch.tables makt.data where tab 80 occurs 10 with header line.data wa itab like makt occurs 10with header line.parameters s trx like ma...

ABAP 使用的字元型別

1.abap基本資料型別 型別 描述 屬性 c 字元型別 預設長度1,最大長度不限 n 數字型別 預設長度1,最大不限,不能進行計算 i 整數字型別 預設長度1,不可定義長度,值範圍 2 31 2 31 d d 日期型別 固定長度8 p 包型別 預設長度1,最大長度16 t 時間型別 固定長度8,不...