Icon download
This report is useful for choosing icons to use in ABAP reports or in PC applications, if you download them. I merged my version whit the one I found in the Internet (the download part); thanks a lot to the unknown developer!
ABAP
*&---------------------------------------------------------------------*
*& Report Z_ICONS
*&---------------------------------------------------------------------*
*& IperCube 2005 - Revamped from Internet 2013 by Unknown Developer
*&---------------------------------------------------------------------*
REPORT z_icons.
TABLES: icon.
SELECT-OPTIONS: id FOR icon-id.
SELECT-OPTIONS: name FOR icon-name.
PARAMETERS: dld_i AS CHECKBOX.
PARAMETERS: path(255) TYPE c.
* Init Parametri
INITIALIZATION.
* Get HomeDrive
DATA: Home_Drive TYPE string.
cl_gui_frontend_services=>environment_get_variable(
EXPORTING
variable = 'HOMEDRIVE'
CHANGING
value = Home_Drive
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4
).
IF sy-subrc <> 0.
* Error handling
ENDIF.
cl_gui_cfw=>flush( ).
* Get HomePath
DATA: Home_Path TYPE string.
cl_gui_frontend_services=>environment_get_variable(
EXPORTING
variable = 'HOMEPATH'
CHANGING
value = Home_Path
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4
).
IF sy-subrc <> 0.
* Error handling
ENDIF.
cl_gui_cfw=>flush( ).
* Set Save Path
CONCATENATE Home_Drive Home_Path '\SAP_icons\' INTO path.
********************************************************************
START-OF-SELECTION.
********************************************************************
DATA: icontab(32) OCCURS 10 WITH HEADER LINE.
DATA: filename TYPE string,
filefilter TYPE string,
fullpath TYPE string.
DATA: icon_wa TYPE icon,
internal TYPE icon-internal,
existing TYPE c.
DATA: my_bds TYPE REF TO cl_bds_document_set,
key TYPE sbdst_object_key,
files TYPE sbdst_files,
wa TYPE bapifiles.
FIELD-SYMBOLS: <f>.
REFRESH icontab.
SELECT * FROM icon
WHERE id IN id
AND name IN name.
ASSIGN (icon-name) TO <f>.
WRITE: /(5) <f>, 20 '@',21 icon-id+1(2),23 '@',icon-oleng,
icon-button,icon-status,icon-message,icon-function,
icon-name, icon-internal, icon-internal+1.
IF dld_i = 'X'.
APPEND icon-name TO icontab.
ENDIF.
ENDSELECT.
IF dld_i = 'X'.
" download of SAP icons appearing in the list
LOOP AT icontab.
"no icon download if icon already exists in directory
CONCATENATE path icontab '.gif' INTO filename.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = filename
RECEIVING
result = existing.
IF existing IS INITIAL.
" icon not there -> download from BDS
IF my_bds IS INITIAL.
CREATE OBJECT my_bds.
ENDIF.
TRANSLATE icontab TO UPPER CASE.
key = icontab.
wa-comp_count = 1.
wa-directory = path.
wa-mimetype = 'IMAGE/GIF'.
CONCATENATE icontab '.gif' INTO wa-filename.
APPEND wa TO files.
CALL METHOD my_bds->get_with_files
EXPORTING
classname = 'SAP_ICONS'
classtype = 'OT'
object_key = key
CHANGING
files = files
EXCEPTIONS
OTHERS = 1.
CLEAR files.
ENDIF.
ENDLOOP.
ENDIF.