Displaying streamed images in Web Dynpro
Hi All,
I have following scenario to programme.
- The DB have "images" stored as BLOB.
- I need to read the images (stream) and make them visible in Web Dynpro UI.
Problem is i only one way to providing images in Web Dynpro. The images are picked from url that points to Resource either at temporary location of permanent position Sap Images pool or contribution under mimes folder.
I see temporary location as one option here but still not able to figure out where to store it !
Can anybody help in this.
Thanks and Regards,
Ashwani Kr Sharma
Hi ,
Use
WDWebResource.getPublicCachedWebResource(byte[] webResource,
WDWebResourceType resourceType,
WDScopeType scopeType,
WDDeployableObjectPart deployableObjectpart,
String key)
Regards
Bharathwaj
Similar Messages
-
Display a photo via web dynpro (jpg files)
Hi
I have photo's of employees which I would like to display via my Web dynpro (it is jpg files). I was able to do it using an Interactive form element, but then I cannot resize the photo; it is to big. I was hoping to display it via an Image element, but then I only see the icon, but not my photo.
Could someone please assist me in helping to display my photo better?
Regards
DebbieHi Debbie,
Below is the code to generate the URL using ICM cache
"l_image is the variable that has your image in XSTRING format.
DATA:gx_mimetype TYPE string VALUE 'JPG'.
****Create the cached response object that we will insert our content into
DATA: cached_response TYPE REF TO if_http_response.
CREATE OBJECT cached_response
TYPE
cl_http_response
EXPORTING
add_c_msg = 1.
TRY. " ignore, if compression can not be switched on
CALL METHOD cached_response->set_compression
EXPORTING
OPTIONS = cached_response->co_compress_based_on_mime_type
EXCEPTIONS
OTHERS = 1.
CATCH cx_root.
ENDTRY.
****set the data and the headers
DATA: l_app_type TYPE string.
DATA: l_xstring TYPE xstring,
i_cache_timeout TYPE i VALUE '300'.
cached_response->set_data( l_image ).
l_app_type = gx_mimetype.
cached_response->set_header_field( name = if_http_header_fields=>content_type
value = l_app_type ).
****Set the Response Status
cached_response->set_status( code = 200 reason = 'OK' ).
****Set the Cache Timeout - 60 seconds - we only need this in the cache
****long enough to build the page and allow the Image on the Client to request it.
cached_response->server_cache_expire_rel( expires_rel = i_cache_timeout ).
DATA: r_url TYPE string.
DATA: i_path TYPE string VALUE '/sap/public',
i_format TYPE string VALUE 'JPG'.
****Create a unique URL for the object
DATA: guid TYPE guid_32.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = guid.
CONCATENATE i_path '/' guid '.' i_format INTO r_url.
****Cache the URL
cl_http_server=>server_cache_upload( url = r_url
response = cached_response ).
" bind the generated url with the image uielement attribute
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_url LIKE ls_context-url.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* set single attribute
lo_el_context->set_attribute(
EXPORTING
name = `URL`
value = r_url ).
Hope this helps!
Radhika -
How to display an XML in Web Dynpro
Hi,
I am pretty new to Web Dynpro and have a specific requirement.
I have a web dynpro page on which we display a table. One of the columns in the table is a XML message. Now on lead selection of each row I want to display the contents of the XML in an embedded control below the table. I have already implemented the functionality to download the XML message to file system but I want a capability to show the XML contents within my page in a formatted way.
If I use a text view, the XML does not look very nice.
I do not want to implement a new tree control based control now where I parse my xml file and then try to recursively generate a tree. This will take time for me as i am not very well versed with WD programming.
Can anyone tell me if there exists any control in WD which can display the XML in formatted way?
If you guys have used the new ABAP debugger and seen the XML viewer in it then you can get an idea of what I need. I am not sure about the control that the ABAP debugger uses. It will be good if someone can help me find something like that.
After all WD is all about reusability.
Regards,
VikasHi Vikas,
see this little example which creates a xml file to download and open in the browser. Put it in an action handler method.
DATA lr_conv TYPE REF TO cl_abap_conv_out_ce.
DATA lv_data TYPE string.
DATA lv_xfile TYPE xstring.
lv_data = '<?xml version=1.0" encoding="utf-8"?> put your xml here'.
cl_abap_conv_out_ce=>create( RECEIVING conv = lr_conv ).
lr_conv->convert( EXPORTING data = lv_data
IMPORTING buffer = lv_xfile ).
cl_wd_runtime_services=>attach_file_to_response(
EXPORTING
i_filename = 'test.xml'
i_content = lv_xfile
i_mime_type = 'application/xml' ).
Hope this helps you. Revert if need some more help.
Regards,
Pavan. -
Display sapscript form in Web Dynpro Java
Hi,
Is it possible to print an existing sapscript form i.e. PO from ECC to my Web Dynpro application? I have successfully created a Web Dynpro Java application to create POs but now have a requirement to display or print the PO?
Can someone provide me with a sample code? I'm hoping to be able to do this without using Adobe.
Again, thanks for all your help.
Best regards,
JaypeeHi mark,
Without Adobe also u can display PO order.
Below is the code to open a HTML window from WDJava, with data from WDJava...
Inside DoInit()
IWDAttributeInfo attr1 =
wdContext.getNodeInfo().getAttribute("htmlfile");
ISimpleTypeModifiable mtype1 = attr1.getModifiableSimpleType();
IWDModifiableBinaryType btype1 = (IWDModifiableBinaryType) mtype1;
btype.setFileName(attr.getName() + ".html");
btype.setMimeType(WDWebResourceType.HTML);
_contentType = mtype;
Where htmlfile is a context attribute of type binary... and do a global declaration like this
ISimpleTypeModifiable _contentType = null; (This declaration can be done at the end of your view's coding between Begin Others and End Others)
Now,
inside on action print
public void onActionPrintData(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String videoName )
//@@begin onActiondisplayVideo(ServerEvent)
byte[] content = new byte4028;
try {
content = this.displayPrint().getBytes("UTF-8");
wdContext.currentContextElement().setHtmlfile(content);
wdContext.currentPrintElement().setAttrUrl(
_contentType.format(content));
//Where content is loaded with data from displayPrint() method, which is holding the HTML *page to be displayed to the user *
IWDWindow win =
wdThis
.wdGetAPI()
.getComponent()
.getWindowManager()
.createNonModalExternalWindow(WDWebResource
.getWebResource(content, WDWebResourceType.HTML)
.getURL(),"ShowVideo");
win.setWindowSize(445,460);
win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
win.removeWindowFeature(WDWindowFeature.MENU_BAR);
//win.open();
win.show();
// wdComponentAPI.getMessageManager().reportSuccess("444444444444");
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportException ("Unable to open window"+e,false);
//@@end
Now finally, design your HTML Page inside the method displayPrint() like this
public java.lang.String displayPrint( java.lang.String strVideoName )
//@@begin displayPrint()
String htmlcontent=null;
htmlcontent="content what you want to show in print window";
use script inside the html content to do a print... like window.print();
return htmlcontent;
//@@end
Regards,
Sunaina Reddy T -
Oracle BLOB Display an image in Web Form
I have an Oracle database that stores image data. The data type of this image column is BLOB. I created a Window application using Visual C#, Oracle Provider for OLE DB to display the images on the Window forms. The mechanism to retrieve the data from Oracle database from client is to call an Oracle stored procedure that returns BLOB type. Now I want to convert it into Web application. I have difficulty to find
(1) Appropriate web control
(2) A way to bind OracleLOB object to this web control so the image can be displayed.
I am aware of the fact that in ASP .NET you can use ImageUrl property of an Image object to link a file stored in a particular URL.
Your help is very much appreciated.Hi ,
Please can you give me some examples or where can i find the solution.
Can you guys send some FMB examples on [email protected]
Please reply as sson as possible because we got stuck up here.
Regards, -
Display file content in Web Dynpro ABAP
Hello,
we would like to be able to display any file after having uploaded files using FileUpload ui element in a web dynpro abap application.
for microsoft word excel files, the OfficeControl ui element can be used and for pdf documents the InteractiveForm ui element can be used.
for other formats such as '.tif', '.jpg', '.txt'..... we did not find out how to be able to display the file contents
Does anybody know if and how this could be achieved?
Cheers
AnaChris,
You may be right. Also it requires some configuration in SAP KPro ( document class etc).
Please see SAP [Help |http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVBDS/BDS_STRUCTURE.pdf]on Business Document Services.
At page 64 of this document under topic 'Display Documents' 'Feature it says. "If it is not possible to display the document in place, an appropriate viewer that is available on the
PC is started and the document is displayed u201Cout placeu201C -
Displaying Custom images in Web Layout
Hello all,
Can anyone please tell tell me how to display a custom .gif image in web layout instead of the standard gif(rwbeige_logo.gif). Where do I've to store the image, for it to be detected during runtime. Thanks in advance.
Reagards,
Arun.Vfor where you store the image you can store it in the database table in the blob column such as. for the report layaut containing image take the following:
- in the report layaut you can create a report selecting a table that containing the blob column.
- in the report layaut, modify the property of the item that present the database blob column to image.
soufiane -
Showing Image in Web Dynpro using ABAP
Hi All,
I am new to Web Dynpro ABAP , basically my requirement is to show a image , could any one please tell me the steps to do that , i have already uploaded the image in application server using T-code smw0 , and in the layout i have taken the element IMAGE.
I have also made the context node as Image and under that i have made three attributes named as :-
IMAGE (Context Node)
source (Attibute type string)
tooltip (Attribute type string)
visible (Attribute type WDUI_VISIBILITY)
In the WDDOINIT method i have written the following code.
DATA:
context_node TYPE REF TO if_wd_context_node,
context_elem TYPE REF TO if_wd_context_element,
stru_image TYPE if_image_view=>element_image.
fill structure with values
stru_image-source = 'abc.gif'.
stru_image-tooltip = 'Image Tooltip!!'.
stru_image-visible = '02'. "=visible
navigate to <IMAGE> via lead selection
context_node = wd_context->get_child_node( name = `IMAGE` ).
get element via lead selection
context_elem = context_node->get_element( ).
bind structure to context element image
CALL METHOD context_elem->set_static_attributes
EXPORTING
static_attributes = stru_image.
But I am getting the error if_image_view does not exist.
Please help me and guide me if I am proceeding in a wrong way.
Thanks and Regards,
Rachit KhannaHi ,
Its very simple ....
Dont use any transaction to upload image.
right click on component and select
create->mime_object->import
suppose ur image is on desktop...
So select the path of desktop select the image and click ok.
U will see an MIMEs named folder in ur component and under which u will have ur image.
now add image element into UI and there u will have source name property ...just write the name of ur image file and test ur application.
U can see the image in output..
(Also there are different properties of image element to set the position and other things)
any queries ..feel free to ask
regards
panky -
Where to put images in web Dynpro project to have them deployed?
Hi Brothers,
I would like to show an image in an <img>-tag within a Formatted Text View UI Element.
I have created a folder img under src/.../projectname and I have referenced the image in the <img>-tag as follows:
< img src="/LocalDevelopment~LocalDevelopment~testroadmap~demo.sap.com/src/packages/com/sap/demo/projectname/img/newRow.JPG"; /.>
However, the image is not shown in the Formatted Text View UI Element.
Does anybody know where to put images so that they are packed in the .war achieve and deployed and how to referenced them?
Thanks, JohannesHi,
place the image in the following folder of application,
src\mimes\Components\<your component name>.testroadmap.demo.sap.com
If you store the image file in your Web Dynpro project under src /mimes /Components /<Name of Component>, you only have to specify the file name without a path.
Regards,
ramesh
Edited by: Ramesh Babu V on Sep 19, 2008 1:58 PM -
Problem in displaying GOS document in Web dynpro
Hi,
Requirement is to display attached documents of business objects (PR, PO) in Web Dynpro.
I am able to do this successfully but there is an issue with Office 2007 documents. Office 2007 documents are getting corrupted.
I am using following logic for reading the attached documents:
1. Called cl_binary_relation=>read_links method to get the document list.
2. Called SO_DOCUMENT_READ_API1 to get the content and details of documents.
3. Called SCMS_BINARY_TO_XSTRING to convert document content to XString.
4. Called SDOK_MIMETYPE_GET to get mime type for document so that I can bind it with FileDownload UI element.
After doing the analysis, I found that SO_DOCUMENT_READ_API1 is not returning correct file content and extension type for Office 2007 documents. Instead of '.docx' it is returning '.doc' and also the document content is not proper as I check by hard coding the mine type for .docx.
Please let me know, is there any other FM for reading document content or am I missing something?
Regards,
Vikram RawalHey Vikram Rawal,
maybe you can help me i also want to display attached documents of bussiness objects (material). When i call cl_binary=>read_links the table where the results should be is empty.
I hope you can help me.
Regards
Alexander Diring -
Problem in displaying GOS documents in Web Dynpro
Hi,
Requirement is to display attached documents of business objects (PR, PO) in Web Dynpro.
I am able to do this successfully but there is an issue with Office 2007 documents. Office 2007 documents are getting corrupted.
I am using following logic for reading the attached documents:
1. Called cl_binary_relation=>read_links method to get the document list.
2. Called SO_DOCUMENT_READ_API1 to get the content and details of documents.
3. Called SCMS_BINARY_TO_XSTRING to convert document content to XString.
4. Called SDOK_MIMETYPE_GET to get mime type for document so that I can bind it with FileDownload UI element.
After doing the analysis, I found that SO_DOCUMENT_READ_API1 is not returning correct file content and extension type for Office 2007 documents. Instead of '.docx' it is returning '.doc' and also the document content is not proper as I check by hard coding the mine type for .docx.
Please let me know, is there any other FM for reading document content or am I missing something?
Regards,
Vikram RawalHi,
I had the same problem...
Maintain the office 2007 extension from maintenance view V_TOADD (SM30)
for example
xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
then associate these extensions to your archive object maintenance view TOAVE.
Regards,
Ivan -
Hi Experts,
I 've converted the image as RAW STRING and stored in Database.i need to display from Database.is this possible to Display a image without using MIME object ?Hi Gowtham,
Please follow below threads..
How to add Image dynamically in Webdynpro ABAP
Can mime object be created at run-time?
Mime logo not displaying
Cheers,
Kris. -
Display Appraisal Templates in Web Dynpro
Hi All,
I have a requirement to build a Web Dynpro Application that exposes the Appraisal Templates built in the backend to the users.
Can someone guide me as to how I can go about with this. How can I access the Templates in Web Dynpro?
Regards,
Ashwini.Hi
As per your question, I understand that HTML output is getting generated through a R3- Bapi call. Fine, create a model with the data binding to the context to some text view. Simply create view with the relevant UI element through which you want to exhibit the data and call the R3 call through your model. instead of a HTML output, you will get your data in the view.
you may not get the exact format / style of the html output.
Otherwise, directly HTML content cannot be shown in webdynpro. You need to have some UI control to take its content.
Or else, you can go in for j2ee stack and end up with a java based appl, use a simple jsp and get the output!
if you have any specific queries do let us know
hope this helps you
thanks -
About displaying images in web dynpro
Hi experts,
I hav a scenario..in which der's one table..whch has links for all images...and afta clickin on a lick..dat image will b displayed on side of it..
Now..where from dis links wll b comin..hw r images strd in WDABAP...where from i can get da path for dis images...
I hope u understood ma query...
Please help me out...
Thks and Regards,
Runali.Hi Runali,
If there are large number of images, then you need not upload all the images as MIME object in your component. You can create a context node with a context attribute of type string.
Place an image UI element in the iview and bind its source property to that string attribute.
Now when you click on the link in your table, populate that context attribute with the location of the image (url).
In some of the organizations, images are stored in separate servers and there are webservices which talks to those servers. These webservices return the urls for the images. These urls can be used as above.
Regards,
Gaurav -
Safari Not Displaying All Images On Web Page
When I look at a web page in Safari on my iPhone 3GS, not all of the images on the page load. Instead, I see little blue squares with question marks in them. However, if I look at the same web page on an iPhone 4, the images DO load. Why is this happening?
Here are two screenshots to prove my point:
iPhone 3GS
iPhone 4Settings>Safari>Javascript On maybe?
May find an answer here as well:
http://manuals.info.apple.com/enUS/iPhone_iOS4_UserGuide.pdf
Maybe you are looking for
-
"The message could not be moved to the mailbox Archive" - iPhone 6
I have an iPhone 6 using the standard email app for my work (we use gmail apps), now using the latest iOS 8.1 When I try to swipe to Archive, it doesn't work and says: "Unable to Move Message. The message could not be moved to the mailbox Archive" If
-
-
I just update to ios6 and mi wifi blow up, the activation button does not slide to on position, is blocked
-
Xml form HTML Editor control change.
Hi, Is it possible to change External weblink control property of HTML Editor used in xml form builder.? As of now this control gives 2 options to provide external weblink (1.Open in active window ,2.open in new window).I want to add open in same win
-
I am getting a message saying: "The document "nameofdocument.psd" could not be opened. Photoshop cannot open files in the "Adobe Photoshop file" format. I get this message: 1. When trying to open a .psd file from the hard drive 2. As an attachment 3.