abap 将xstring转换成PDF展示

收到外围系统的xstring之后,如何在sap中将其打开呢

1.创建一个屏幕

abap 将xstring转换成PDF展示_第1张图片

2.绘制一个customer control

abap 将xstring转换成PDF展示_第2张图片

3.创建流逻辑

abap 将xstring转换成PDF展示_第3张图片

4.流逻辑如下:

DATA: go_html_container TYPE REF TO cl_gui_custom_container,
go_html_control   TYPE REF TO cl_gui_html_viewer,
lv_url           TYPE char255,
lt_data          TYPE STANDARD TABLE OF x255.

MODULE status_0100 OUTPUT.

  IF go_html_container IS INITIAL .
    CREATE OBJECT go_html_container
      EXPORTING
        container_name = 'PDF'.

    CREATE OBJECT go_html_control
      EXPORTING
        parent = go_html_container.

    CALL METHOD go_html_control->load_data
      EXPORTING
        type                   = 'application'
        subtype                = 'pdf'
      IMPORTING
        assigned_url           = lv_url
      CHANGING
        data_table             = lt_data
      EXCEPTIONS
        dp_invalid_parameter   = 1
        dp_error_general       = 2
        cntl_error             = 3
        html_syntax_notcorrect = 4
        OTHERS                 = 5.

    CALL METHOD go_html_control->show_url
      EXPORTING
        url                    = lv_url
        in_place               = 'X'
      EXCEPTIONS
        cntl_error             = 1
        cnht_error_not_allowed = 2
        cnht_error_parameter   = 3
        dp_error_general       = 4
        OTHERS                 = 5.
  ENDIF.

ENDMODULE.

MODULE user_command_0100 INPUT.
  CALL METHOD go_html_control->free
    EXCEPTIONS
      cntl_error        = 1
      cntl_system_error = 2
      OTHERS            = 3.
  LEAVE TO SCREEN 0. "因为我有两个屏幕,所以我要返回上一个,若只有一个,可以注释这句
ENDMODULE.

你可能感兴趣的:(ABAP,abap)