..3 Printing program
Create a report Z_ICONTABLE and paste below code into it:
REPORT z_icontable.
* declare the context
DATA gt_context TYPE zcontext_icontable .
* fill the context
* >> scope
SELECT id name
INTO CORRESPONDING FIELDS OF TABLE gt_context
FROM icon
UP TO 100 ROWS
WHERE oleng EQ 2 .
* >> retrieve icons raw data
FIELD-SYMBOLS <context> TYPE zcontext_icontable_row .
LOOP AT gt_context ASSIGNING <context> .
PERFORM get_icon_rawdata USING <context>-name
CHANGING <context>-rawdata .
ENDLOOP .
* call the form
CALL FUNCTION 'ZXLWB_CALLFORM'
EXPORTING
iv_formname = 'ICONTABLE'
iv_context_ref = gt_context
EXCEPTIONS
process_terminated = 1
OTHERS = 2.
IF sy-subrc NE 0 .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .
ENDIF .
*&---------------------------------------------------------------------*
*& Form get_icon_rawdata
*&---------------------------------------------------------------------*
FORM get_icon_rawdata USING pv_icon_name TYPE ANY
CHANGING cv_icon_rawdata TYPE any .
DATA:
lr_bds_document TYPE REF TO cl_bds_document_set ,
lv_objkey TYPE bapibds01-objkey ,
lv_content_size TYPE i ,
lt_content TYPE sbdst_content ,
lt_components TYPE sbdst_components .
FIELD-SYMBOLS:
<context> TYPE zcontext_icontable_row ,
<components> TYPE bapicompon .
CREATE OBJECT lr_bds_document .
lv_objkey = pv_icon_name .
lr_bds_document->get_with_table(
EXPORTING
classname = 'SAP_ICONS'
classtype = 'OT'
object_key = lv_objkey
CHANGING
content = lt_content
components = lt_components
EXCEPTIONS
OTHERS = 1 ) .
READ TABLE lt_components ASSIGNING <components> INDEX 1 .
CHECK sy-subrc EQ 0 .
lv_content_size = <components>-comp_size .
CHECK lv_content_size GT 0 .
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_content_size
IMPORTING
buffer = cv_icon_rawdata
TABLES
binary_tab = lt_content.
ENDFORM . "get_icon_rawdata