Los geht’s mit dem nächsten Abenteuer. Die kommenden Monate werden wohl gut durch Schreib-Arbeit gefüllt werde …
Archiv der Kategorie: Geschüttelt und Gerührt
WD4A Message Area Configuration
METHOD init_message_area . * API Window Controller DATA: lr_api_window TYPE REF TO if_wd_window_controller. * Message area DATA: lr_wd_message_area TYPE REF TO if_wd_message_area. * Get the API lr_api_window ?= wd_this->wd_get_api( ). * Get the Message Area lr_wd_message_area = lr_api_window->get_message_area( ). * Configure the message are CALL METHOD lr_wd_message_area->set_display_attributes EXPORTING i_show_only_current = abap_false "Show message protocol i_msg_lines_visible = '-1' i_use_toggle_area = abap_true "Show old design i_for_all_instances = abap_false. ENDMETHOD.
In Place Media Visualization for SAPUI5
Intro
This short instruction explains all the components which are used for displaying media data based on an oData service and an SAP UI5 application.
Step-by-Step
Service
- First you need an object, s.a. a image or a pdf document. Let’s call it Media Object.
- Then you need an oData service to deliver the data for the Media Object.
- Just create a plain oData service
- Create an entity type.
- Check the MEDIA check box for the entity type (oData Project->Data Model->Entity Types, double click your enttiy type, the attributes are shown on the right hand side)
- Switch to the …DPC_EXT class (oData Project->Runtime Artifacts)
- Use context menu->Goto ABAP Workbench
- Redefine the /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_STREAM method (see sample code Appendix)
- Once you want to call the media service you have to at the $value at the end of the query, e.g. <Service URL>/$value
SAP UI5
View:
<core:HTML id=“pdfContainer“ ></core:HTML>
Controller:
var oContainer = this.getView().byId(„pdfContainer“);
var oContent = „<iframe src='“+ <Service URL>/$value +“‚
+ „style=’width:600px; height:500px;‘ frameborder=’0′></iframe>“;
Transactions
Transaction | Explanation |
SEGW | SAP Gateway Service Builder |
Appendix
METHOD /iwbep/if_mgw_appl_srv_runtime~get_stream.
DATA:
ld_mypdf TYPE xstring,
ls_stream TYPE ty_s_media_resource,
ls_header TYPE ihttpnvp.
* Create the media data
* ld_mypdf = ...
* Set the MIME type and the value and create data ref
ls_stream-mime_type = 'application/pdf'.
ls_stream-value = ld_mypdf.
copy_data_to_ref(
EXPORTING is_data = ls_stream
CHANGING cr_data = er_stream ).
* In order to display the media data in place you have to set the
* following
ls_header-name = 'content-disposition'.
ls_header-value = 'inline; filename=MyPDF.pdf'.
/iwbep/if_mgw_conv_srv_runtime~set_header( ls_header ).