`

Export form graphic to local PC

    博客分类:
  • ABAP
阅读更多
REPORT  ztest.

DATA: w_size TYPE i,
      w_graphic_xstr TYPE xstring.
*Internal table
DATA: BEGIN OF it_graphic_table OCCURS 0,
        line(255) TYPE x,
      END OF it_graphic_table.

START-OF-SELECTION.
  CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
    EXPORTING
      p_object  = 'GRAPHICS'
      p_name    = 'XX_LOGO' "NAME
      p_id      = 'BMAP'
      p_btype   = 'BMON' " or BCOL(BMON:Bloack and White Bitmap Image; BCOL:Color Bitmap Image)
    RECEIVING
      p_bmp     = w_graphic_xstr
    EXCEPTIONS
      not_found = 1
      OTHERS    = 2.

  w_size = XSTRLEN( w_graphic_xstr ).

  WHILE w_graphic_xstr IS NOT INITIAL.
    it_graphic_table-line = w_graphic_xstr.
    APPEND it_graphic_table.
    SHIFT w_graphic_xstr BY 255 PLACES LEFT IN BYTE MODE.
  ENDWHILE.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      bin_filesize            = w_size
      filename                = 'C:\TEST.BMP'
      filetype                = 'BIN'
    TABLES
      data_tab                = it_graphic_table
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      OTHERS                  = 22.
  IF sy-subrc <> 0.

  ENDIF.


FM: DP_CREATE_URL->Generates a temporary URL that displays in a   temporary table
    SAPSCRIPT_ATTRIB_GRAPHIC_BDS->SAPscript Graphics and bitmaps
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics