Html viewer in sap abap

SAP ABAP Technical Help

CALL SCREEN 0100 .
*&———————————————————————*
*& Module STATUS_0100 OUTPUT
*&———————————————————————*
* text
*———————————————————————-*
MODULE status_0100 OUTPUT .
DATA :gt_html type w3htmltab,
gv_title TYPE sy- title .
DATA : gr_html TYPE REF TO cl_gui_html_viewer,
gr_cont TYPE REF TO cl_gui_custom_container.
*DATA: html TYPE w3htmltab.
DATA : html TYPE ZCHAR6000_T.
DATA : LV_HTML TYPE string.
DATA : lf_html TYPE string.
PERFORM HTML.
SET PF-STATUS ‘HTML’ .
SET TITLEBAR ‘HTML_TITLE’ . » WITH gv_title.

DATA : lv_url TYPE char255.
CREATE OBJECT GR_CONT
EXPORTING
* PARENT = PARENT
CONTAINER_NAME = ‘HTML_CONT’
* STYLE = STYLE
* LIFETIME = LIFETIME_DEFAULT
* REPID = SY-REPID
* DYNNR = SY-DYNNR
* NO_AUTODEF_PROGID_DYNNR = NO_AUTODEF_PROGID_DYNNR
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
.
IF sy-subrc <> 0 .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
CREATE OBJECT gr_html
EXPORTING
* shellstyle = shellstyle
PARENT = GR_CONT
* lifetime = ‘1’
* saphtmlp = ‘X’
* uiflag = ‘6’
* name = name
* saphttp = saphttp
* query_table_disabled = ‘X’
EXCEPTIONS
cntl_error = 1
cntl_install_error = 2
dp_install_error = 3
dp_error = 4
others = 5
.
IF sy-subrc <> 0 .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .

CALL METHOD gr_html->load_data(
* EXPORTING
* url = LV_URL
* type = ‘HTML’
* subtype = ‘HTML’
* size = 100
* encoding = encoding
* charset = charset
* language = ‘E’
IMPORTING
ASSIGNED_URL = LV_URL
CHANGING
DATA_TABLE = HTML
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_general = 2
cntl_error = 3
).
IF sy-subrc <> 0 .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .

GR_HTML->SHOW_URL(
EXPORTING
URL = LV_URL
* FRAME = FRAME
* IN_PLACE = ‘ X’
EXCEPTIONS
cntl_error = 1
cnht_error_not_allowed = 2
cnht_error_parameter = 3
dp_error_general = 4
).
IF sy-subrc <> 0 .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF .
ENDMODULE . » STATUS_0100 OUTPUT
*&———————————————————————*
*& Module USER_COMMAND_0100 INPUT
*&———————————————————————*
* text
*———————————————————————-*
MODULE user_command_0100 INPUT .
CASE sy-ucomm.
WHEN ‘EXIT’ OR ‘CANCEL’ or ‘BACK’ .
LEAVE TO SCREEN 0 .
WHEN ‘PRINT’ .
call method GR_HTML->execwb(
EXPORTING
cmd_id = GR_HTML->wb_cmdid_print
* cmd_opt = ‘2’
* result = result
EXCEPTIONS
cntl_error = 1
).
IF sy-subrc <> 0 .
message e003(cnht) raising html_print_error.
ENDIF .

DATA : LV_NETWR TYPE C LENGTH 20 .
PERFORM STYLE CHANGING LV_HTML.
LF_HTML = LV_HTML.
CLEAR LV_HTML.
DATA : lv_date TYPE CSAP_MBOM-DATUV.
CALL FUNCTION ‘CONVERSION_EXIT_PDATE_OUTPUT’
EXPORTING
input = SY-DATUM
IMPORTING
OUTPUT = LV_DATE
.
CONDENSE LV_DATE.
LOOP AT IT_HEADER INTO WA_HEADER.
PERFORM HEADER USING WA_HEADER LV_DATE CHANGING LV_HTML.
CONCATENATE LF_HTML LV_HTML INTO LF_HTML SEPARATED BY SPACE.
CONDENSE LF_HTML.
CLEAR LV_HTML.
LOOP AT IT_CON INTO WA_CON WHERE MATNR = WA_HEADER-MATNR AND WERKS = WA_HEADER-WERKS.
PERFORM CON USING WA_CON CHANGING LV_HTML.
CONCATENATE LF_HTML LV_HTML INTO LF_HTML SEPARATED BY SPACE.
CONDENSE LF_HTML.
CLEAR LV_HTML.
ENDLOOP .
CLEAR COUNT .

Читайте также:  Http learning all ru instrukcia index html

CONCATENATE LF_HTML
‘‘
‘‘
INTO lf_html SEPARATED BY space.
*CONDENSE lf_html.

DATA subrc TYPE c VALUE ‘X’ .
DATA len TYPE i .

*&———————————————————————*
*& Form HEADER
*&———————————————————————*
* text
*———————————————————————-*
* —>P_WA_HEADER text
* —>P_LV_DATE text
* *———————————————————————-*
FORM HEADER USING P_WA_HEADER LIKE WA_HEADER
P_LV_DATE LIKE CSAP_MBOM-DATUV
CHANGING P_LV_HTML.
CONCATENATE

Material Number : ‘ P_WA_HEADER-MATNR ‘ Plant : ‘ P_WA_HEADER-WERKS
BUOM : ‘ P_WA_HEADER-MEINS ‘ Date : ‘ P_LV_DATE ‘


INTO P_LV_HTML SEPARATED BY space.
ENDFORM . » HEADER1
*&———————————————————————*
*& Form CON
*&———————————————————————*
* text
*———————————————————————-*
* —>P_WA_CON text
* *———————————————————————-*
FORM CON USING P_WA_CON LIKE WA_CON
CHANGING P_LV_HTML.
IF COUNT = 0 .
CONCATENATE


Consumption Trend





‘ ‘
INTO P_LV_HTML SEPARATED BY space.
ENDIF .
IF COUNT = 6 .
CONCATENATE P_LV_HTML




INTO P_LV_HTML SEPARATED BY space.
ELSE .
CONCATENATE P_LV_HTML


INTO P_LV_HTML SEPARATED BY space.
ENDIF .
IF COUNT = 11 .
CONCATENATE P_LV_HTML


‘ P_WA_CON-MONTH_T ‘: ‘ P_WA_CON-QTY ‘

‘ P_WA_CON-MONTH_T ‘:‘ P_WA_CON-QTY ‘


INTO P_LV_HTML SEPARATED BY space.
ENDIF .
COUNT = COUNT + 1 .
ENDFORM . » CON
*&———————————————————————*
*& Form EKPO
*&———————————————————————*
* text
*———————————————————————-*
* —>P_WA_EKPO text
* —>P_LV_NETWR text
* —>P_LV_DATE text
* * *———————————————————————-*
FORM EKPO USING P_WA_EKPO LIKE WA_EKPO
CHANGING P_LV_NETWR
P_LV_DATE
P_LV_HTML.

Источник

ABAP guide

Экран 0100 содержит Custom Container с именем CONTAINER_0100. GUI-статус STAT_0100 содержит две кнопки: «ОК» и «Отмена».

DATA: gv_url(100), gt_html_data TYPE bcsy_text, go_cont_0100 TYPE REF TO cl_gui_custom_container, go_html_0100 TYPE REF TO cl_gui_html_viewer, gv_okcode TYPE sy-ucomm, gv_dummy. FIELD-SYMBOLS: LIKE LINE OF gt_html_data. REFRESH: gt_html_data. " Head INSERT INITIAL LINE INTO TABLE gt_html_data ASSIGNING . -line = 'body '. " Body INSERT INITIAL LINE INTO TABLE gt_html_data ASSIGNING . -line = '

Hello, World!

'. INSERT INITIAL LINE INTO TABLE gt_html_data ASSIGNING . -line = ''. CALL SCREEN 0100 STARTING AT 1 1. *&---------------------------------------------------------------------* *& Module STATUS_0100 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_0100 OUTPUT. SET PF-STATUS 'STAT_0100'. SET TITLEBAR 'TITLE_0100'. IF go_cont_0100 IS INITIAL. CREATE OBJECT go_cont_0100 EXPORTING * parent = container_name = 'CONTAINER_0100' * style = * lifetime = lifetime_default * repid = * dynnr = * no_autodef_progid_dynnr = EXCEPTIONS cntl_error = 1 cntl_system_error = 2 create_error = 3 lifetime_error = 4 lifetime_dynpro_dynpro_link = 5 OTHERS = 6. IF go_cont_0100 IS NOT INITIAL. CREATE OBJECT go_html_0100 EXPORTING * shellstyle = parent = go_cont_0100 * lifetime = lifetime_default * saphtmlp = 'X' * uiflag = * name = * saphttp = * query_table_disabled = '' EXCEPTIONS cntl_error = 1 cntl_install_error = 2 dp_install_error = 3 dp_error = 4 OTHERS = 5. ENDIF. ENDIF. IF go_html_0100 IS NOT INITIAL. CALL METHOD go_html_0100->load_data EXPORTING * url = * type = 'text' * subtype = 'html' * size = 0 encoding = 'UTF-8' * charset = * language = IMPORTING assigned_url = gv_url CHANGING data_table = gt_html_data EXCEPTIONS dp_invalid_parameter = 1 dp_error_general = 2 cntl_error = 3 OTHERS = 4. CALL METHOD go_html_0100->show_url EXPORTING url = gv_url * frame = * in_place = ' X' EXCEPTIONS cntl_error = 1 cnht_error_not_allowed = 2 cnht_error_parameter = 3 dp_error_general = 4 OTHERS = 5. ENDIF. ENDMODULE. " STATUS_0100 OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_0100 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_0100 INPUT. CASE gv_okcode. WHEN 'OK' OR 'CANCEL'. LEAVE TO SCREEN 0. WHEN OTHERS. ENDCASE. ENDMODULE. " USER_COMMAND_0100 INPUT

Источник

SAP HTML Viewer

SAP HTML Viewer is a control developed by SAP for use within the SAP GUI. SAP has not developed its own Web Browser. Instead, the SAP HTML Viewer uses the functions exposed by the underlying Web browser on the current frontend.

The graphic below shows the SAP HTML Viewer in an SAP screen:

The screen comes from the example program SAPHTML_EVENTS_DEMO.

The interface of the SAP HTML Viewer is the same for all platforms, but its functions will depend on the underlying HTML browser. Under SAP GUI for Windows , it uses Microsoft Internet Explorer 4.0 as an external browser. Under SAP GUI for Java, it uses the Ice Browser, which is installed with the GUI.

You can use the SAP HTML Viewer with other controls (for example, buttons and list boxes) on a screen in an SAP transaction. It allows you to display HTML pages, graphics, and pictures in your transactions, either retrieved from the database or generated at runtime.

As well as displaying data, the SAP HTML Viewer can also trigger events in reaction to user input. You can react to these events in your application program (see Registering and Processing Events ). Events are triggered when the user chooses a URL or sends an HTML document. The URL or document data is made available to the ABAP program.

The SAP HTML Viewer also supports navigation in HTML pages and MIME documents from sources outside the current SAP transaction (for example, from a desktop file system or an HTTP server). This is made possible by a close integration of the 4.6 release of SAP GUI with your Internet and Intranet environment.

The SAP HTML Viewer will only work on frontend platforms on which Microsoft Internet Explorer version 4.0 (or higher) is installed.

The SAP GUI installation does not install Microsoft Internet Explorer. You need a SAP GUI installation with Release 4.6 or higher.

Certain features of the SAP HTML Viewer are not available (or behave differently) under SAP GUI for HTML. The following components are affected:

Источник

Html viewer in sap abap

SAP HTML Viewer is a control developed by SAP for use within the SAP GUI. SAP has not developed its own Web Browser. Instead, the SAP HTML Viewer uses the functions exposed by the underlying Web browser on the current frontend.

The graphic below shows the SAP HTML Viewer in an SAP screen:

This graphic is explained in the accompanying text

The screen comes from the example program SAPHTML_EVENTS_DEMO.

Implementation considerations

The interface of the SAP HTML Viewer is the same for all platforms, but its functions will depend on the underlying HTML browser. Under SAP GUI for Windows , it uses Microsoft Internet Explorer 4.0 as an external browser. Under SAP GUI for Java, it uses the Ice Browser, which is installed with the GUI.

Integration

You can use the SAP HTML Viewer with other controls (for example, buttons and list boxes) on a screen in an SAP transaction. It allows you to display HTML pages, graphics, and pictures in your transactions, either retrieved from the database or generated at runtime.

Features

As well as displaying data, the SAP HTML Viewer can also trigger events in reaction to user input. You can react to these events in your application program (see Registering and Processing Events ). Events are triggered when the user chooses a URL or sends an HTML document. The URL or document data is made available to the ABAP program.

The SAP HTML Viewer also supports navigation in HTML pages and MIME documents from sources outside the current SAP transaction (for example, from a desktop file system or an HTTP server). This is made possible by a close integration of the 4.6 release of SAP GUI with your Internet and Intranet environment.

Constraints

SAP GUI for HTML

The SAP HTML Viewer will only work on frontend platforms on which Microsoft Internet Explorer version 4.0 (or higher) is installed.

The SAP GUI installation does not install Microsoft Internet Explorer. You need a SAP GUI installation with Release 4.6 or higher.

Certain features of the SAP HTML Viewer are not available (or behave differently) under SAP GUI for HTML. The following components are affected:

Источник

Оцените статью