[ABAP] Verwendung des Engineering Client Viewer für 2D-/3D-Objekte (ECL viewer)

Beispiel 1: JPEG anzeigen

DATA: o_dock TYPE REF TO cl_gui_docking_container.

PARAMETERS: p_name TYPE string. " Dummy-Parameter

AT SELECTION-SCREEN OUTPUT.

  IF NOT o_dock IS BOUND.
* Dockingcontainer erzeugen
    o_dock = NEW #( repid = sy-repid
                    dynnr = sy-dynnr
                    side  = cl_gui_docking_container=>dock_at_right
                    ratio = 50 ).

* ECL viewer erzeugen
    DATA(o_viewer) = NEW cl_gui_ecl_2dviewer( parent = o_dock ).

* Toolbar einstellen
    o_viewer->create_toolbar( close_button = abap_false
                              navigation = abap_true
                              options = abap_true
                              remove_document = abap_true
                              tools = abap_false
                              tool_stamp = abap_false
                              tool_compare = abap_false
                              tool_measurement = abap_false
                              viewer = abap_true
                              viewer_openfile = abap_true
                              viewer_savefile = abap_true
                              viewer_closefile = abap_true ).

* JPEG anzeigen
    o_viewer->open_document( file = 'c:\temp\temp.jpg'
                             file_type = 'image/jpeg' ). " https://wiki.selfhtml.org/wiki/Referenz:MIME-Typen

  ENDIF.

Beispiel 2: PDF anzeigen

  
* ECL viewer in extra Fenster
DATA(o_viewer) = NEW cl_gui_ecl_viewerbox( ).

* Fullscreen
o_viewer->set_alignment( alignment = cl_gui_control=>align_at_left + cl_gui_control=>align_at_right + cl_gui_control=>align_at_top + cl_gui_control=>align_at_bottom ).

* PDF öffnen
o_viewer->open_document( file = 'c:\temp\temp.pdf'
                         file_type = 'application/pdf' ). " https://wiki.selfhtml.org/wiki/Referenz:MIME-Typen

Weiterführende Infos: