SAP 实例 1 Images in HTML
作者:互联网
REPORT zharpo_010 NO STANDARD PAGE HEADING. TABLES : t001. TYPE-POOLS: slis. DATA : w_repid LIKE sy-repid. TYPES : BEGIN OF ty_comp. INCLUDE STRUCTURE t001. TYPES : END OF ty_comp. DATA: wa_layout TYPE slis_layout_alv. DATA: it_fieldcat TYPE slis_t_fieldcat_alv, wa_fieldcat TYPE slis_fieldcat_alv. DATA : it_comp TYPE TABLE OF ty_comp. INITIALIZATION. w_repid = sy-repid. START-OF-SELECTION. SELECT * FROM t001 INTO TABLE it_comp. END-OF-SELECTION. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING i_program_name = w_repid i_internal_tabname = 'IT_COMP' i_structure_name = 'T001' i_inclname = w_repid CHANGING ct_fieldcat = it_fieldcat[] EXCEPTIONS inconsistent_interface = 1 program_error = 2 OTHERS = 3. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = w_repid i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE' i_html_height_top = 50 "控制表头栏目的初始高度 is_layout = wa_layout it_fieldcat = it_fieldcat TABLES t_outtab = it_comp EXCEPTIONS program_error = 1 OTHERS = 2. *&---------------------------------------------------------------------* *& Form html_top_of_page *&---------------------------------------------------------------------* FORM html_top_of_page USING document TYPE REF TO cl_dd_document. DATA: text TYPE sdydo_text_element. text = 'Company Code Data'. CALL METHOD document->add_text EXPORTING text = text sap_style = 'HEADING'. CALL METHOD document->new_line. CALL METHOD document->new_line. text = 'User Name : '. CALL METHOD document->add_text EXPORTING text = text sap_emphasis = 'Strong'. CALL METHOD document->add_gap EXPORTING width = 2. text = sy-uname. * CALL METHOD document->add_text * EXPORTING * text = text * sap_style = cl_dd_document=>SMALL. ** sap_emphasis = cl_dd_document=>EMPHASIS. CALL METHOD document->add_text EXPORTING text = text * TEXT_TABLE = * FIX_LINES = * SAP_STYLE = cl_dd_document=>WARNING sap_color = cl_dd_document=>list_total_int sap_fontsize = cl_dd_document=>large sap_fontstyle = cl_dd_document=>serif sap_emphasis = cl_dd_document=>emphasis "加粗还是斜体 STRONG是加粗 * STYLE_CLASS = * CHANGING * DOCUMENT = . CALL METHOD document->add_gap EXPORTING width = 10. CALL METHOD document->add_icon EXPORTING sap_icon = 'ICON_DATE'. text = 'Date : '. CALL METHOD document->add_text EXPORTING text = text sap_emphasis = 'Strong'. CALL METHOD document->add_gap EXPORTING width = 2. text = sy-datum. CALL METHOD document->add_text EXPORTING text = text sap_style = 'Key'. CALL METHOD document->add_gap EXPORTING width = 10. text = 'Time : '. CALL METHOD document->add_text EXPORTING text = text sap_emphasis = 'Strong'. CALL METHOD document->add_gap EXPORTING width = 2. text = sy-uzeit. CALL METHOD document->add_text EXPORTING text = text sap_style = 'Key'. CALL METHOD document->new_line. CALL METHOD document->underline. "Draw an underLine CALL METHOD document->add_link EXPORTING * NAME = url = 'http://www.87cool.com' tooltip = '水寒冰居' text = '87Cool' * DESTINATION_IN_DOC_SET = * DESTINATION_IN_DOC_POS = * TABINDEX = * HOTKEY = * IMPORTING * LINK = . ENDFORM. "HTML_TOP_OF_PAGE
Description
Images loaded here from the MIME repository using an API are displayed in two browser controls.
- The method main1 uses the class CL_GUI_HTML_VIEWER directly. Its method LOAD_DATA is used to provide a URL for the image in the internal table, which is then used on the HTML page.
- The method main2 uses the class CL_ABAP_BROWSER as a wrapper for the direct use of CL_GUI_HTML_VIEWER and calls of the method LOAD_DATA. A reference, associated with the name used in the HTML page, is passed to the internal table.
See also the example for direct access to objects from the MIME repository using ICF.
标签:document,text,add,HTML,CALL,EXPORTING,Images,SAP,METHOD 来源: https://www.cnblogs.com/JackeyLove/p/13489137.html