Display XML in Web Dynpro
Hello,
i have a string variable filled with xml. And now i want to display this code in Web Dynpro with an ui element.
I tried a text_edit but it only shows the text but i want it to be displayed like in an IE.
Anybody an idea?
Regards Robert
Ok, so an Iframe ist not the best solution right now.
So i did what you said and uploaded the xml content to the ICM cache and generate an URL.
Now i tried to open the URL with an external Window, but inside the new opened IE i can't see anything.
Maybe my coding is not complete?
Regards,
Robert
DATA:
lv_xml_content TYPE string,
lo_http_response TYPE REF TO if_http_response,
lv_url TYPE string,
lv_xfile TYPE xstring,
lr_conv TYPE REF TO cl_abap_conv_out_ce,
lo_window_manager TYPE REF TO if_wd_window_manager,
lo_api_component TYPE REF TO if_wd_component,
lo_window TYPE REF TO if_wd_window.
cl_abap_conv_out_ce=>create( RECEIVING conv = lr_conv ).
lr_conv->convert( EXPORTING data = lv_xml_content
IMPORTING buffer = lv_xfile ).
CREATE OBJECT lo_http_response TYPE cl_http_response.
lo_http_response->append_data( lv_xfile ).
lo_http_response->set_content_type( 'text/xml' ).
lo_http_response->server_cache_expire_rel( expires_rel = 500 ).
lo_http_response->set_status( code = 200 reason = 'OK' ).
cl_http_server=>server_cache_upload(
EXPORTING
url = 'Test.xml'
response = lo_http_response ).
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_external_window(
url = 'Test.xml'
title = 'XML im Internetexplorer'
lo_window->open( ).
Edited by: Thalin on Sep 21, 2010 3:45 PM
Similar Messages
-
Display data in Web DynPro table from database via EJB
I have a JavaBeans model which has a method populateDataToTable()to retrieve data from database via Session bean (calling entity bean, returning ArrayList of data) and the data needed to be display in the Web DynPro table.
User Interface (Web DynPro) <-> JavaBeans Model <-> Busineess Logic (session bean) <-> Persistence (Entity Bean)<-> DB table.
The context bindiing and table part is ok. How do i load the data to the table ? what the coding to put in wdDoInit() ?
Any help would be appreciated.in wdinit(),
Collection col = new ArrayList();
try{
MyCommandBean bean = new MyCommandBean();
col = bean.getDataFromDbViaEJB();
wdContext.nodeMyCommandBean().bind(col);
} catch (Exception ex) {
ex.printStackTrace(ex);
in your JavaBean model class, MyCommandBean getDatafromDbViaEJB() method:
Collection col = new ArrayList();
Collection newcol = new ArrayList();
//include your own context initialization etc...
col = local.getDataViaSessionBean(param);
// if your returned result also a bean class, reassigned it to current MyCommandBean
for (Iterator iterator = col.iterator(); iterator.hasNext();) {
MyOtherBean otherBean=(MyOtherBean)iterator.next();
MyCommmandBean bean = new MyCommandBean();
bean.attribute1 = outBean.getAttirbute1();
// get other attibutes
newcol.add(bean);
return newcol; -
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. -
Create image of XSTRING data and display it in Web Dynpro
Hello,
I am trying to dynamically display an image in a Web Dynpro ABAP Image-Control. The problem is that the data is stored in the DB as XSTRING and I can't find a Method for example to create a new object in the MIME-Repository of the data which is read out of the DB at runtime.
I have already converted the XSTRING into w3mime-Format with the function module RSFO_XSTRING_TO_MIME, but the Control needs a string of a url to display the image (for example to a MIME-Object of the component or a link to a file on the ITS).
Is there somehow a possibility to do this?
Thanks for your help,
Kolja
Solved this way: See /people/brian.mckellar/blog/2003/09/30/bsp-in-depth-writing-an-http-handler
Message was edited by: Kolja EweringHi you may go through the below post to find what could be a better way to do that.
http://forum.java.sun.com/thread.jspa?threadID=5163829
REGARDS,
RaHuL -
Display HTML in Web DynPro Java View
Hi,
I have a data in HTML code. It is a full HTML code with the body, head, html.... Now in my Web DynPro i have a section whereby it displayed the message that store in the database table. In that column store all the HTML code. So now in my Web DynPro im using a TextEdit to display the message. It will showed all the HTML code in the TextEdit.
For example
<html>
<head>
</head>
<body>
<p>Testing</p>
</body>
</html>
Is it possible in Web DynPro to display the HTML just like a webpage? As it will convert the HTML code to a readable format.
Thanks.Hi Adrian,
In case you have formatted text that you wish to be rendered on a Web Dynpro view (but not shown as is) then you should use the FormattedTextView UI element.
Follow these steps:
1. Insert a FormattedTextView element in your view.
2. To define the content of the FormattedTextView, select the text property of your FormattedTextView element and bind the text property to the context attribute which has your HTML content
When the application is run, the HTML will be shown as a web page.
Event onAction is triggered when the user clicks on a link (<a> tag) inside the FormattedTextView. The parameter contains the href attribute of the triggered link.
The TextEdit UI element will not serve your pupose. Hope this helps.
Best Regards,
Supriya -
How to display pdf in Web Dynpro Page
Hi Experts,
I need to display the pdf file in web dynpro page. I am using Web dynpro 7.1(CE), in that no ui element like Iframe. With Iframe we can display the pdf file in web Dynpro page in 7.0.
But My problem is how display pdf with out using Iframe.
Please any one tell how to display with any other UI elements.
Regards,
Sunil.Hi sunil..
chk this link..
<u><b>Pdf</b></u>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0401535-f81c-2a10-0192-ffd41e8e8d59
<u><b>Adobe</b></u>
/people/achim.hauck/blog/2005/02/04/my-struggles-with-the-adobe-document-services-in-was640
<u><b>Configuration</b></u>
http://help.sap.com/saphelp_nw70/helpdata/en/43/8a1a8ece230c8ce10000000a11466f/content.htm
<u><b>Adobe Document services</b></u>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9e4e9afb-0701-0010-f8a8-b8cd093662c2
<u><b>Configuring Guided procedure of Interactive Forms</b></u>
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b9ea34c2-0701-0010-e2a2-d8e9cd6d85dc
<u><b>Forum Discussions abt Adobe Document Services</b></u>
Re: Configuring the Destination URL for the Adobe Document Services
Hop will this helpful for u..
Regards,
GS -
Remove buttons in ALV grid display in ABAP Web Dynpro
Hi,
Sub: ALV grid-->Web Dynpro ABAP.
Request guidance to prevent display of the buttons "Microsoft Excel" and "Print Version" (which provide options to export the ALV grid output into an Excel format document).
Is there a way we could hide this from being displayed on the ALV grid in a Web dynpro ABAP component output?
Thanks very much.
Best Regards,
AdiHi Adithya,
really simple solution is to call cl_salv_wd_model_table_util=>if_salv_wd_table_util_stdfuncs=>set_all( abap_false ). This deactivates all ALV functionality.
For individual setting cl_salv_wd_config_table if_salv_wd_standard_functions~set_<x>_allowed.
- Michelle -
Drop down in allready displaying table in web dynpro
Hi Experts,
We have a requirement where we are displaying the data of the table KNA1 in a table form (Web dynpro) which is editable.for the field NAME1 there must be drop down box which contain some values , so that for any row user can select one of the value and then when press SAVE button the table KNA1 should be updated with the new value of NAME1.
Can you please let us know how to do this.
Thanks
Mahesh>Can you please let us know how to do this.
Which part of what you describe and what exactly are you having problems with. You can of course change the cell editor of your column to DDLB. Is that where you are having problems. Or are you trying to decied between DDLBByKey and DDLBByIndex. For that I would suggest you read the following:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bb/69b441b0133531e10000000a155106/frameset.htm -
Displaying reports in web dynpro view
Hai all,
Iam working on a project in webdynpro which is used for the newly joined employees to fill their personal info.After they do that I need to display the reports to the Admin to Process the request for generating employee id.I have never worked with reports in web dynpro.All I need toknow is
--->Coding for getting the reports containing the requests and displaying them in the view.
Also this project is done using SAP HR---IS there any change in coding to retieve data from backend when using SAP HR.
Any help and answers will be appreciated.
Thanks n Regards
Sharanya.RHi,
You can try using UI element Iframe.
URL can be mentioned in source property of Iframe as http://www.google.com.
Re: How to Add URL in a view .
Regards
Manas Dua -
SOS: Display data in Web DynPro table from database via EJB.
i build two views : queryView and displayView!
displayView: is used to display all query result in the table;these data is bind to a commandBean model(javaBean imported).
queryView: is used to full in different query conditions,then u can pressed a button to trigger for displaying reuslt in the table of displayView.
commandBean(its attributes bind to the table cells in the displayView) :
public Class TestModel{
private String xxx;
setXxx();....
getXxx();...
ArrayList query(){
ArrayList alist= new ArrayList();
ArrayList list= new ArrayList();
alist = local.getDataViaSessionBean(param);
for (int i=0;i<alist.size();i++){
ArrayList row =(ArrayList)alist.get(i);
TestModel model= new TestModel();
model.setXxx((String)row.get(1));
list.add(bean);
return list;
my question is:i dont' know how to invoke the commanBean' mothod to diplay data in the displayView.
i know if that two view are combined to one views,i can write code as follow:
wdContext.currentTestModelElement().modelObject().query(para);
but now .u cann't access it!in wdinit(),
Collection col = new ArrayList();
try{
MyCommandBean bean = new MyCommandBean();
col = bean.getDataFromDbViaEJB();
wdContext.nodeMyCommandBean().bind(col);
} catch (Exception ex) {
ex.printStackTrace(ex);
in your JavaBean model class, MyCommandBean getDatafromDbViaEJB() method:
Collection col = new ArrayList();
Collection newcol = new ArrayList();
//include your own context initialization etc...
col = local.getDataViaSessionBean(param);
// if your returned result also a bean class, reassigned it to current MyCommandBean
for (Iterator iterator = col.iterator(); iterator.hasNext();) {
MyOtherBean otherBean=(MyOtherBean)iterator.next();
MyCommmandBean bean = new MyCommandBean();
bean.attribute1 = outBean.getAttirbute1();
// get other attibutes
newcol.add(bean);
return newcol; -
How to map XML to Web Dynpro context nodes?
Hi All,
Could anyone tell how xml string can be bound to context nodes ? In my requirement i need to serialize context nodes value to string and deserialize it back to nodes for implementing back naviagtion between views.
I didnt see much threads achieving this giving details on class cl_wdr_xml_convert_util and methods if_wd_client_conversion_util~string_to_struct.
I am using wd_context->to_xml to convert into xml.
From this format, i want to bind it back to context node.
When i use this below approch i get short dumb.
Serialization to xml:
lv_data_string = wd_context->to_xml( ).
Deserialization:
DATA lv_typedescr TYPE REF TO cl_abap_typedescr.
FIELD-SYMBOLS:
<fs_data> TYPE ANY TABLE.
CALL METHOD cl_abap_typedescr=>describe_by_object_ref
EXPORTING
p_object_ref = wd_context
RECEIVING
p_descr_ref = lv_typedescr
EXCEPTIONS
reference_is_initial = 1
OTHERS = 2.
try.
CALL METHOD cl_wdr_xml_convert_util=>if_wd_client_conversion_util~string_to_struct
EXPORTING
in = lv_data_string
typedescr = lv_typedescr
IMPORTING
data = <fs_data>
CATCH cx_wdr_conversion_exception into lo_err .
lv_exp = lo_err->get_text( ).
ENDTRY.
wd_context->bind_table( values = <fs-data>.
Using this way, i get a short dumb as assert statement is failed as value for typedescr->type_kind is '*'.
method if_wd_client_conversion_util~string_to_struct.
assert typedescr->type_kind = cl_abap_typedescr=>typekind_struct1
or typedescr->type_kind = cl_abap_typedescr=>typekind_struct2.
raise exception type cx_wdr_conversion_exception
exporting textid = cx_wdr_conversion_exception=>illegal_type.
On debugging changing this value to required also made no difference, as no value could be assigned to the field symbol.
Suggest a soution to do this.Hi Thomas,
Thanks for your replies.
I have corrected it, but the field symbol is empty and while debugging it says data type is incorrect.
code:
FIELD-SYMBOLS:
<fs_data> TYPE ANY TABLE.
data: lsbp type ZXBPCENTRAL,
go_ref type ref to data.
CALL METHOD cl_abap_typedescr=>describe_by_data " ( before it was describe_by_object_ref)
EXPORTING
p_data = lsbp
receiving
p_descr_ref = lv_typedescr.
try.
CALL METHOD cl_wdr_xml_convert_util=>if_wd_client_conversion_util~string_to_struct
EXPORTING
in = lv_data_string
typedescr = lv_typedescr
IMPORTING
data = go_ref "<fs_data>
CATCH cx_wdr_conversion_exception into lo_err .
lv_exp = lo_err->get_text( ).------> Here the error says " Invalid data type and hence, there is no data.
ENDTRY.
assign go_ref->* to <fs_data>.
I am still looking for solution and thanks a lot .... -
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 -
How to Change a Default Value from Drop Down Box displayed in Web Dynpro?
Hi,
How to Change a Default Value from 'High' to 'Low' in a Drop Down Box for RANGE field displayed in Standard Web Dynpro Component. I saw a Default Value set for a RANGE field in View Context When I select that field and click on Display. I am seeing Default Value set it to 'HI'. Please let me know how to change from HIgh to Low.
I appreciate your help!
Thanks,
Monicahi,
use the set_attribute( ) method now to set the attribute with a particular key eg HIGH in ur case
// u can use the code wizard( control +f7) this code will be auto generated when u select the
//radio button to read the context node
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node.
* navigate from <CONTEXT> to <CN_NODE> via lead selection
lo_nd_cn_node = wd_context->get_child_node( name = wd_this->wdctx_cn_node ).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* set single attribute
lo_el_cn_node->set_attribute(
name = `ATTribute name.`
value = 'LOW' ).
it will solve ur query ..
also refer to this component
wdr_test_events -> view dropdownbyidx and dropdownbykey ->method name onactionselect.
regards,
amit -
Web Dynpro-layout preview-Error-IE cannot display-service in SICF activated
Hello,
By starting a view in web dynpro framework, i have the error in tab layout "page cannot be displayed" from IE.
Before i make the change in the DNS and system32/../etc, the layout was displayed, but the web dynpro application cannot be started.
Now after those configurations and activation of services in SICF, i can start the web application only with firefox and not internet exploer, and, that internet explorer is preconfigured for the layout preview, i recieve all times the eror "cannot display" when i start a view in the layout tab.
1. How can i change settings so that view can be displayed in layout after i actived the (hope the suitables i.e. view designer) services in SICF - Default_host...
2. Is it possible to change IE to firefox as main browser for layout tab.
Note: For virtual domain i
1. add dns "domain.com" in the DNS
2. add in system32/etc/host file to "127.0.0.1 localhost", "10.10.0.10 sysserv.domain.com"
3. and trough tr. rz10 in the instance profil input the icm/.... ....domain.com
Through this three steps i could get the web dynpro application started,
but from the other side, the layout preview do not display the view again
and just send error the message: "THIS PROGRAM CANNOT DISPLAY THE WEBPAGE"
Many thanks for helping
arnaud
Edited by: Arnaud on Jul 15, 2010 4:36 PM
Edited by: Arnaud on Jul 15, 2010 8:31 PMHi,
The string is not correctly formed ( a quote and a concatenation ) :
Your url :
v_url:=nvl(v_rep_port,'http://'||v_rep_HOST ||':'||v_rep_port||')||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_svr;
The Correction :
v_url:=nvl(v_rep_port,'http://'||v_rep_HOST ||':'||v_rep_port)||'/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server='||v_rep_svr;
Hope it helps
Mohamed Dadi -
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
Maybe you are looking for
-
Purchase Order History Program - not working properly
Dear friends i am developing purchase order history program in ALV, which shows the report of purchase order status i.e (fields as below). document no PO date line item material number material name purchase org plant purchase group orderd quantity o
-
Creating debit/credit memo in AP with Payables Interface
Hello guys, I am able to create an invoice using the payables interface table AP_INVOICES_INTERFACE and running the Payables Open Interface concurrent program. My question is, is it possible to create a debit/credit memo in AP as well through the int
-
Cannot select multiple iPhoto events for screen saver anymore... why?
I previously had Lion and just upgraded to Mavericks last week. My screen saver settings were wiped out (no big deal), so I went into the settings to select the events, faces, etc. I had previously selected to run. But when I went to try put things b
-
JMS Sender Adapter Sharing Message Queue
Hi all. I´ve some scenarios (request/replay) with JMS Adapter and MQ Series. All of them working againts the same queues. In the sender side, each sender channel for each scenario must read from the same queue with a message selectors. The problem is
-
Installing/Updating iTunes 12.1.x 64bit Error 7
Every time I try to install or upgrade iTunes on Windows 7/64 to any 12.1 version, the Apple Mobile Device service fails to start every time. If I hit ignore, then let the install complete, I get a permanent "Error 7" message any time I try to start