功能代码:
FORM frm_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
" BREAK ABAP05.
CASE r_ucomm.
WHEN '&IC1'.
PERFORM frm_show_detail USING rs_selfield.
WHEN ''. "点击 detail 按钮时,显示供应商的采购订单列表
ENDCASE.
ENDFORM.
FORM frm_show_detail USING rs_selfield TYPE slis_selfield.
DATA: lv_id TYPE sxmsmguid.
DATA: lr_datum LIKE RANGE OF sy-datum WITH HEADER LINE.
CASE rs_selfield-fieldname.
WHEN 'M'.
WHEN 'LOGID'.
CLEAR gwa_data.
READ TABLE gt_data INTO gwa_data INDEX rs_selfield-tabindex.
PERFORM frm_view_jiek_data.
ENDCASE.
ENDFORM.
FORM frm_view_jiek_data .
DATA lt_tk01 TYPE TABLE OF ztifmara_log.
DATA lt_tk05 TYPE TABLE OF ztiftks05.
DATA lt_tk06 TYPE TABLE OF ztiftk06_log.
DATA lt_tksg01 TYPE TABLE OF ztfi_fkjz.
DATA lt_tksk02 TYPE TABLE OF ztifdbyw_log.
DATA lt_pbs05 TYPE TABLE OF zficot003.
DATA lt_z019 TYPE TABLE OF zmmi019_log.
DATA lt_crmf005 TYPE TABLE OF ztfi_kna1.
DATA: lv_json TYPE string,
lv_convert TYPE string,
lo_json_ser TYPE REF TO cl_trex_json_serializer,
lv_err_text TYPE string.
CASE gwa_data-jiekno.
WHEN 'ZFICOI200'.
* 日志明细
SELECT SINGLE json
INTO lv_json
FROM zbct_log_details
WHERE record_guid = gwa_data-logid.
ENDCASE.
TRY.
IF lv_json IS INITIAL.
RETURN.
ENDIF.
* 将JSON转换为HTML
CALL TRANSFORMATION sjson2html SOURCE XML lv_json
RESULT XML DATA(lv_html).
CATCH cx_xslt_runtime_error INTO DATA(lo_err).
lv_err_text = lo_err->get_text( ).
WRITE: lv_err_text.
RETURN.
ENDTRY.
* 显示HTML
lv_convert = cl_abap_codepage=>convert_from( lv_html ).
cl_abap_browser=>show_html( html_string = lv_convert ).
ENDFORM.