两种方法动态获得ABAP类的class attribute的值
程序员文章站
2022-05-30 23:40:48
...
DATA: lo_node TYPE REF TO object.
" 方法1
cl_crm_order_timer=>start( ).
DO 1000 TIMES.
CREATE OBJECT lo_node TYPE ('CL_PRD01OV_MATERIALOV_CN00').
ASSIGN lo_node->('BASE_ENTITY_NAME') TO FIELD-SYMBOL(<name>).
ENDDO.
cl_crm_order_timer=>stop( 'Field Symbol' ).
WRITE:/ <name>.
" 方法2
cl_crm_order_timer=>start( ).
SELECT SINGLE attvalue INTO @DATA(lv) FROM vseoattrib WHERE clsname = 'CL_PRD01OV_MATERIALOV_CN00'
AND cmpname = 'BASE_ENTITY_NAME'.
REPLACE ALL OCCURRENCES OF '''' IN lv WITH space.
cl_crm_order_timer=>stop( 'DB' ).
WRITE:/ lv.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":