[ABAP] SAP Smart Forms: XSF Utilities – BDS Grafik (Formulargrafik) holen und anzeigen

TRY.
* Holt Formulargrafiken, die mit der SE78 eingerichtet wurden
    DATA(lv_xstr) = cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp( p_object = 'GRAPHICS'
                                                                  p_name   = 'ENJOY'
                                                                  p_id     = 'BMAP'
                                                                  p_btype  = 'BCOL' ). " BMON	- Rasterbild schwarz-weiß, BCOL	- Rasterbild Farbe

* freier Custom-Container innerhalb der Listenansicht
    DATA(o_cnt) = NEW cl_gui_custom_container( container_name = ''
                                               repid          = 'SAPMSSY0'
                                               dynnr          = '0120' ).

* Position des Containers setzen
    o_cnt->set_top( 50 ).
    o_cnt->set_left( 50 ).
    o_cnt->set_width( 640 ).
    o_cnt->set_height( 240 ).

* Bild über die URL laden und anzeigen
    DATA(o_pic) = NEW cl_gui_picture( parent = o_cnt ).
    o_pic->set_display_mode( display_mode = cl_gui_picture=>display_mode_stretch ).

* xstring -> solix
    DATA(it_bin_data) = cl_bcs_convert=>xstring_to_solix( lv_xstr ).

    DATA: lv_url TYPE swk_url.

* temporäre URL für das Bild erzeugen
    CALL FUNCTION 'DP_CREATE_URL'
      EXPORTING
        type                 = 'image/jpeg' " https://wiki.selfhtml.org/wiki/MIME-Type/%C3%9Cbersicht
        subtype              = ''
      TABLES
        data                 = it_bin_data
      CHANGING
        url                  = lv_url
      EXCEPTIONS
        dp_invalid_parameter = 1
        dp_error_put_table   = 2
        dp_error_general     = 3
        OTHERS               = 4.

* Bild von URL laden
    o_pic->load_picture_from_url_async( lv_url ).

    WRITE: / 'Test.'.
  CATCH cx_root INTO DATA(e_txt).
    WRITE: / e_txt->get_text( ).
ENDTRY.