Chinaunix首页 | 论坛 | 博客
  • 博客访问: 67417
  • 博文数量: 172
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1631
  • 用 户 组: 普通用户
  • 注册时间: 2020-05-14 13:25
个人简介

代码5S

文章分类

全部博文(172)

文章存档

2020年(172)

我的朋友

分类: 其他平台

2020-10-13 08:30:46


点击(此处)折叠或打开

  1. REPORT zdemo16.

  2. DATA: g_bytecount TYPE i,
  3.       g_content TYPE STANDARD TABLE OF
  4.                                     bapiconten INITIAL SIZE 0,
  5.       g_bitmap_file_bytecount TYPE i,
  6.       g_file_name TYPE string.

  7. DATA:BEGIN OF g_bitmap_file OCCURS 0,
  8.      line(255) TYPE x,
  9.     END OF g_bitmap_file,
  10. g_bitmaps TYPE TABLE OF stxbitmaps WITH HEADER LINE.

  11. DATA gv_type TYPE stxbitmaps-tdbtype.

  12. PARAMETER: p_image LIKE stxbitmaps-tdname
  13.                    DEFAULT '',
  14.            p_file LIKE ibipparms-path
  15.                    DEFAULT 'D:\test.bmp'.

  16. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  17.   CALL FUNCTION 'F4_FILENAME'
  18.     IMPORTING
  19.       file_name = p_file.

  20. *F4 search for image
  21. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_image.
  22.   CALL FUNCTION 'SAPSCRIPT_SEARCH_GRAPHIC_BDS'
  23.     EXPORTING
  24.       selection_screen = 'X'
  25.       select_entry = 'X'
  26.       selection_show = 'X'
  27.     IMPORTING
  28.       e_name = p_image
  29.     TABLES
  30.       t_selections = g_bitmaps
  31.     EXCEPTIONS
  32.       nothing_found = 1
  33.       selection_canceled = 2
  34.       internal_error = 3
  35.       OTHERS = 4.
  36.   IF sy-subrc <> 0.
  37.     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  38.             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  39.   ENDIF.

  40. START-OF-SELECTION.
  41.   MOVE p_file TO g_file_name.

  42.   gv_type = 'BCOL'.
  43.   CALL FUNCTION 'SAPSCRIPT_GET_GRAPHIC_BDS'
  44.     EXPORTING
  45.       i_object = 'GRAPHICS'
  46.       i_name = p_image
  47.       i_id = 'BMAP'
  48.       i_btype = gv_type
  49.     IMPORTING
  50.       e_bytecount = g_bytecount
  51.     TABLES
  52.       content = g_content
  53.     EXCEPTIONS
  54.       not_found = 1
  55.       bds_get_failed = 2
  56.       bds_no_content = 3
  57.       OTHERS = 4.
  58.   IF sy-subrc <> 0.
  59.     MESSAGE '图片不存在' TYPE 'E'.
  60.   ENDIF.

  61.   CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP'
  62.     EXPORTING
  63.       old_format = 'BDS'
  64.       new_format = 'BMP'
  65.       bitmap_file_bytecount_in = g_bytecount
  66.     IMPORTING
  67.       bitmap_file_bytecount = g_bitmap_file_bytecount
  68.     TABLES
  69.       bds_bitmap_file = g_content
  70.       bitmap_file = g_bitmap_file
  71.     EXCEPTIONS
  72.       OTHERS = 1.
  73.   IF sy-subrc <> 0.
  74.     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  75.             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  76.   ENDIF.

  77. *Download to pc
  78.   CALL FUNCTION 'GUI_DOWNLOAD'
  79.     EXPORTING
  80.       bin_filesize = g_bitmap_file_bytecount
  81.       filename = g_file_name
  82.       filetype = 'BIN'
  83.     TABLES
  84.       data_tab = g_bitmap_file
  85.     EXCEPTIONS
  86.       file_write_error = 1
  87.       no_batch = 2
  88.       gui_refuse_filetransfer = 3
  89.       invalid_type = 4
  90.       no_authority = 5
  91.       unknown_error = 6
  92.       header_not_allowed = 7
  93.       separator_not_allowed = 8
  94.       filesize_not_allowed = 9
  95.       header_too_long = 10
  96.       dp_error_create = 11
  97.       dp_error_send = 12
  98.       dp_error_write = 13
  99.       unknown_dp_error = 14
  100.       access_denied = 15
  101.       dp_out_of_memory = 16
  102.       disk_full = 17
  103.       dp_timeout = 18
  104.       file_not_found = 19
  105.       dataprovider_exception = 20
  106.       control_flush_error = 21
  107.       OTHERS = 22.
  108.   IF sy-subrc <> 0.
  109.     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  110.             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  111.   ENDIF.

阅读(474) | 评论(0) | 转发(0) |
0

上一篇:ALV事件函数

下一篇:ABAP DOI1

给主人留下些什么吧!~~