on 02-09-2006 2:43 PM
Hi all,
I export a Web Template's Data Provider into an XML-File by using
<SAP_BW_URL DATA_PROVIDER='DATAPROVIDER_1' CMD='EXPORT' FORMAT='XML' REDIRECT_URL='http://linktomycontroller.do'>
and redirect it to a custom controller. But I don't know how to access the XML-file from ABAP. I've only got a url-parameter ?XML_ID=53BSGJL8AUWI6N6DV75MIYBGW...
Is there a function that delivers the file's path or something like that because I want to parse this file and process its data in ABAP?
Thanks in advance!
Best regards,
Dominik
if you are on BW3.5 you simply use FM RRW3_GET_QUERY_VIEW_DATA to execute the query from ABAP and to get the xml
CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'
EXPORTING
i_infoprovider = wf_ip
i_query = wf_query
* I_VIEW_ID =
i_t_parameter = q_variables
IMPORTING
e_axis_info = i_axis_info
e_cell_data = i_cell_data
e_axis_data = i_axis_data
e_txt_symbols = i_txt_symbols
EXCEPTIONS
no_applicable_data = 1
invalid_variable_values = 2
no_authority = 3
abort = 4
invalid_input = 5
invalid_view = 6
OTHERS = 7 .
CASE sy-subrc .
WHEN 0 .
data; xml_out type string .
CALL TRANSFORMATION (`ID`)
SOURCE axis_info = i_axis_info[]
cell_data = i_cell_data[]
axis_data = i_axis_data[]
txt_symbols = i_txt_symbols[]
RESULT XML xml_out.
* now xml_out will have the results in xml format.
endcase .
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Durairaj,
many thanks for your help - I finally got my XML-document without calling 'RRW3_GET_QUERY_VIEW_DATA' and I want to call the reverse transformation from XML to ABAP. Is this possible with the same SAP delivered Transformation program 'ID'?
I would like to call something like
CALL TRANSFORMATION ...
SOURCE XML xml_string
RESULT ???
What must be the structure of the result? I would like to get the axis_info, cell_data, ...tables.
Thanks for any help in advance!
Regards,
Dominik
<i> I finally got my XML-document without calling 'RRW3_GET_QUERY_VIEW_DATA'</i>
Can you share with us, how you achieved this?
yes its possible with ID
DATA: i_axis_info TYPE rrws_thx_axis_info ,
i_cell_data TYPE rrws_t_cell ,
i_axis_data TYPE rrws_thx_axis_data ,
i_txt_symbols TYPE rrws_t_text_symbols .
CALL TRANSFORMATION (`ID`)
SOURCE XML xml_out
RESULT i_axis_info = i_axis_info
i_cell_data = i_cell_data
i_axis_data = i_axis_data
i_txt_symbols = i_txt_symbols .
Regards
Raja
Hi Raja,
the transformation iTabs --> XML works fine, but if I try to
go the opposite way XML --> iTabs I get a runtime error.
My Code looks like that:
DATA: i_axis_info type RRWS_THX_AXIS_INFO,
i_cell_data type RRWS_T_CELL,
i_axis_data type RRWS_THX_AXIS_DATA,
i_txt_symbols type RRWS_T_TEXT_SYMBOLS.
CALL TRANSFORMATION (`ID`)
SOURCE
XML l_xml_string
RESULT
axis_info = i_axis_info
cell_data = i_cell_data
axis_data = i_axis_data
txt_symbols = i_txt_symbols .
For example 'axis_info' is an node's name in the XML document, but do I address the destination iTabs correctly?
I get the following error when running the code above: CX_XSLT_RUNTIME_ERROR
Regards,
Dominik
>>I finally got my XML-document without calling >>'RRW3_GET_QUERY_VIEW_DATA'
>>Can you share with us, how you achieved this?
Well, I exported the navigation state of a Web Template into a XML document and redirected it to an ABAP web service.
SAP_BW_URL DATA_PROVIDER='DATAPROVIDER_NAME' CMD='EXPORT' FORMAT='XML' redirect_url='http://url_of_your_web_service.do'>
Regards,
Dominik
thanks for sharing the info.
probably the xml format is wrong.
this is what i did.
CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'
EXPORTING
i_infoprovider = wf_ip
i_query = wf_query
* I_VIEW_ID =
i_t_parameter = q_variables
IMPORTING
e_axis_info = i_axis_info
e_cell_data = i_cell_data
e_axis_data = i_axis_data
e_txt_symbols = i_txt_symbols
EXCEPTIONS
no_applicable_data = 1
invalid_variable_values = 2
no_authority = 3
abort = 4
invalid_input = 5
invalid_view = 6
OTHERS = 7 .
CALL TRANSFORMATION (`ID`)
SOURCE i_axis_info = i_axis_info[]
i_cell_data = i_cell_data[]
i_axis_data = i_axis_data[]
i_txt_symbols = i_txt_symbols[]
RESULT XML xml_out.
CLEAR :i_axis_info,i_cell_data,i_axis_data,i_txt_symbols.
REFRESH:i_axis_info,i_cell_data,i_axis_data,i_txt_symbols .
CALL TRANSFORMATION (`ID`)
SOURCE XML xml_out
RESULT i_axis_info = i_axis_info
i_cell_data = i_cell_data
i_axis_data = i_axis_data
i_txt_symbols = i_txt_symbols .
can you check whether the xml fromat youare getting is same as the xml format generated by
CALL TRANSFORMATION (`ID`)
SOURCE i_axis_info = i_axis_info[]
i_cell_data = i_cell_data[]
i_axis_data = i_axis_data[]
i_txt_symbols = i_txt_symbols[]
RESULT XML xml_out.
Regards
Raja
i see a difference in the xml file generated by your method and
CALL TRANSFORMATION (`ID`)
SOURCE axis_info = i_axis_info[]
cell_data = i_cell_data[]
axis_data = i_axis_data[]
txt_symbols = i_txt_symbols[]
RESULT XML xml_out.
in the xml file generated by your method there is a tag called <SOURCE> after <asx:values> where as in the xml generated by call transformation its not there.
Regards
Raja
to capture the error thrown by call transformation surrond it with try endtry block.
DATA: xslt_error TYPE REF TO cx_xslt_exception .
DATA: xslt_message TYPE string .
TRY .
CALL TRANSFORMATION (`ID`)
SOURCE xml xml_out
RESULT i_axis_info = i_axis_info
i_cell_data = i_cell_data
i_axis_data = i_axis_data
i_txt_symbols = i_txt_symbols .
CATCH cx_xslt_exception INTO xslt_error.
xslt_message = xslt_error->get_text( ).
ENDTRY.
Regards
Raja
Hi Raja,
sure I'll let you know what i finally did.
I needed to get the data of a query out of a web template into an external web service / external application. My first approach was to use a command url in the template and export the navigation state into an XML file that gets parsed within the external app.
But what I finally did was to call a web service and there a got the query by using CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA' (as you told me --> thanks a lot!). So there was no need to transform a XML file. I've got all information I needed in 4 internal tables (see table interface).
Regards,
Dominik
if you use the standard webservice for consuming query view data it uses the same FM 'RRW3_GET_QUERY_VIEW_DATA'
webservice details are explained in this link.
http://help.sap.com/saphelp_nw04/helpdata/en/d8/3bfc3f8fc2c542e10000000a1550b0/frameset.htm
Regards
Raja
Dominik -
Looks like the xml data is stored as a form field...this is from help.sap.com
<i>The generated XML can be automatically forwarded to antoher service as a form field if this address is specified as the REDIRECT_URL when the export commandis called. </i>
To get this data in a bsp page, the following code should work...
<%@page language="abap"%>
<%
DATA: table_fields type TIHTTPNVP,
wa_fields type IHTTPNVP.
retrieve the form fields
call method request->GET_FORM_FIELDS
CHANGING
fields = table_fields.
and put them in our table
loop at table_fields into wa_fields.
*wa_fields-value should contain the xml data
%>
<%= wa_fields-value %>
<%
endloop.
%>
<b>Please note, this only works in bw 3.5...</b>
now that you have the xml in an internal table, you can parse the xml using some of the methods described here=>
/people/brian.mckellar/blog/2004/06/25/bsp-programming-rss-httpclient-xml-xslt
good luck...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.