SAP ABAP - Sample Program On Downloading Graphics From Any SAPSCRIPTS.

This program downloads graphics present in SAPSCRIPT to the system.

REPORT ztest_graphic_download.

DATA : l_bytecount TYPE i,
l_tdbtype LIKE stxbitmaps-tdbtype,
l_content TYPE STANDARD TABLE OF bapiconten INITIAL SIZE 0.

DATA: graphic_size TYPE i.

DATA: BEGIN OF graphic_table OCCURS 0,
line(255) TYPE x,
END OF graphic_table.

CALL FUNCTION 'SAPSCRIPT_GET_GRAPHIC_BDS'
EXPORTING
i_object = 'GRAPHICS'
i_name = 'ZWM_INDICATOR_BIG'
i_id = 'BMAP'
i_btype = 'BMON'
IMPORTING
e_bytecount = l_bytecount
TABLES
content = l_content
EXCEPTIONS
not_found = 1
bds_get_failed = 2
bds_no_content = 3
OTHERS = 4.


CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP'
EXPORTING
old_format = 'BDS'
new_format = 'BMP'
bitmap_file_bytecount_in = l_bytecount
IMPORTING
bitmap_file_bytecount = graphic_size
TABLES
bds_bitmap_file = l_content
bitmap_file = graphic_table
EXCEPTIONS
OTHERS = 1.


CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
bin_filesize = graphic_size
filename = 'C:\abc2.bmp'
filetype = 'BIN'
TABLES
data_tab = graphic_table
EXCEPTIONS
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6.

IF sy-subrc EQ 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


Your suggestions and comments are welcome in this section.


Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.