{"id":96,"date":"2016-05-03T10:21:44","date_gmt":"2016-05-03T08:21:44","guid":{"rendered":"http:\/\/www.rolandschwaiger.at\/?p=96"},"modified":"2016-05-03T10:21:44","modified_gmt":"2016-05-03T08:21:44","slug":"in-place-media-visualization-for-sapui5","status":"publish","type":"post","link":"http:\/\/www.rolandschwaiger.at\/?p=96","title":{"rendered":"In Place Media Visualization for SAPUI5"},"content":{"rendered":"<h3>Intro<\/h3>\n<p>This short instruction explains all the components which are used for displaying media data based on an oData service and an SAP UI5 application.<\/p>\n<h3>Step-by-Step<\/h3>\n<h6>Service<\/h6>\n<ol>\n<li>First you need an object, s.a. a image or a pdf document. Let&#8217;s call it Media Object.<\/li>\n<li>Then you need an oData service to deliver the data for the Media Object.\n<ol>\n<li>Just create a plain oData service<\/li>\n<li>Create an entity type.<\/li>\n<li>Check the MEDIA \u00a0check box for the entity type (oData Project-&gt;Data Model-&gt;Entity Types, double click your enttiy type, the attributes are shown on the right hand side)<\/li>\n<li>Switch to the &#8230;DPC_EXT class (oData Project-&gt;Runtime Artifacts)<\/li>\n<li>Use context menu-&gt;Goto ABAP Workbench<\/li>\n<li>Redefine the\u00a0\/IWBEP\/IF_MGW_APPL_SRV_RUNTIME~GET_STREAM method (see sample code Appendix)<\/li>\n<\/ol>\n<\/li>\n<li>Once you want to call the media service you have to at the $value at the end of the query, e.g. &lt;Service URL&gt;\/$value<\/li>\n<\/ol>\n<h6>SAP UI5<\/h6>\n<p>View:<\/p>\n<p>&lt;core:HTML id=&#8220;pdfContainer&#8220; &gt;&lt;\/core:HTML&gt;<\/p>\n<p>Controller:<\/p>\n<p>var oContainer = this.getView().byId(&#8222;pdfContainer&#8220;);<br \/>\nvar oContent = &#8222;&lt;iframe src='&#8220;+ &lt;Service URL&gt;\/$value +&#8220;&#8218;<br \/>\n+ &#8222;style=&#8217;width:600px; height:500px;&#8216; frameborder=&#8217;0&#8242;&gt;&lt;\/iframe&gt;&#8220;;<\/p>\n<h3>Transactions<\/h3>\n<table>\n<tbody>\n<tr>\n<td>Transaction<\/td>\n<td>Explanation<\/td>\n<\/tr>\n<tr>\n<td>SEGW<\/td>\n<td>SAP Gateway Service Builder<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Appendix<\/h3>\n<h5>METHOD \/iwbep\/if_mgw_appl_srv_runtime~get_stream.<\/h5>\n<pre><code>DATA:\r\n ld_mypdf TYPE xstring,\r\n ls_stream TYPE ty_s_media_resource,\r\n ls_header TYPE ihttpnvp.<\/code>\r\n\r\n* Create the media data\r\n * ld_mypdf = ...\r\n\r\n* Set the MIME type and the value and create data ref\r\n ls_stream-mime_type = 'application\/pdf'.\r\n ls_stream-value = ld_mypdf.\r\n copy_data_to_ref( \r\n   EXPORTING is_data = ls_stream\r\n   CHANGING cr_data = er_stream ).\r\n\r\n* In order to display the media data in place you have to set the \r\n* following\r\n ls_header-name = 'content-disposition'.\r\n ls_header-value = 'inline; filename=MyPDF.pdf'.\r\n \/iwbep\/if_mgw_conv_srv_runtime~set_header( ls_header ).<\/pre>\n<h5>ENDMETHOD.<\/h5>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s call it Media Object. Then you need an oData service to deliver the data for &hellip; <a href=\"http:\/\/www.rolandschwaiger.at\/?p=96\" class=\"more-link\"><span class=\"screen-reader-text\">In Place Media Visualization for SAPUI5<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-gg"],"_links":{"self":[{"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=96"}],"version-history":[{"count":8,"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":104,"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=\/wp\/v2\/posts\/96\/revisions\/104"}],"wp:attachment":[{"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.rolandschwaiger.at\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}