on 05-16-2009 10:10 AM
Hi Experts,
I am currently using a mime(created using Graphics chart designer) for displaying a graph.
But, I am not able to set the Chart title dynamically.
Could someone please let me know how to set these properties Dynamically.
Thnx.
Regards,
Kishore
Hi,
Try the code below:
DATA: lv_xml_str TYPE string,
o_mr_api TYPE REF TO if_mr_api,
is_folder TYPE boole_d,
l_loio TYPE skwf_io,
lt_itab TYPE sdokcntbins,
lv_len TYPE i,
lv_url TYPE string,
lv_xml_xstr TYPE xstring.
* get the XML from MIME
IF o_mr_api IS INITIAL.
o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).
ENDIF.
* URL to MIME
IF lv_url IS INITIAL.
lv_url = '/sap/bc/bsp/sap/zdump/'.
* XML file name
CONCATENATE lv_url 'screen1.xml' INTO lv_url.
ENDIF.
TRANSLATE lv_url USING '\/'.
* get the MIME as xstring
CALL METHOD o_mr_api->get
EXPORTING
i_url = lv_url
IMPORTING
e_is_folder = is_folder
e_content = lv_xml_xstr
e_loio = l_loio
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4
OTHERS = 5.
* convert xstring to string
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_xml_xstr
IMPORTING
output_length = lv_len
TABLES
binary_tab = lt_itab.
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = lv_len
mimetype = 'text/xml'
IMPORTING
text_buffer = lv_xml_str
TABLES
binary_tab = lt_itab.
DATA: lr_xml_parser TYPE REF TO cl_ixml_mini_parser,
lr_xml_render TYPE REF TO cl_ixml_mini_renderer,
lr_dom TYPE REF TO if_ixml_mini_dom.
CREATE OBJECT lr_xml_parser.
CALL METHOD lr_xml_parser->if_ixml_mini_parser~parse_string(
EXPORTING
stream = lv_xml_str
IMPORTING
dom = lr_dom ).
DATA: lt_dom TYPE tixmltdom.
FIELD-SYMBOLS: <fs_dom> LIKE LINE OF lt_dom.
LOOP AT lr_dom->dom_table ASSIGNING <fs_dom>. "replace what ever you need here
IF <fs_dom>-name CS 'text'.
<fs_dom>-value = 'Hello testing'.
ENDIF.
ENDLOOP.
CLEAR lv_xml_str.
CREATE OBJECT lr_xml_render.
CALL METHOD lr_xml_render->if_ixml_mini_renderer~render_string(
EXPORTING
dom = lr_dom
IMPORTING
stream = lv_xml_str ).
Hope this resolves the issue.
Good luck.
Abhinav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Before displaying the chart get the chart from MIME and replace the title with dynamic value.
You might have to use the PARSER check the interface IF_IXML_PARSER. [Link|http://help.sap.com/saphelp_nw04/Helpdata/EN/86/8280d512d511d5991b00508b6b8b11/content.htm]
Regards,
Abhinav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kishore,
I am not sure but check [this|https://www.sdn.sap.com/irj/scn/downloads?rid=/library/uuid/e0a9ba90-0201-0010-d3a2-9cb376b5e181] might be helpful.
What's the extension of your chart in MIME?
Regards,
Abhinav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vishnurathan,
You need to specify chart title as a template, to do this specify the chart title within specific identifier such as "$TITLE$" now get the mime as an XML file and identify $TITLE$ and update this to display what ever you want. for example in Microsoft Office 2007 you can create a powerpoint slide template with extension .pptx , now what ever text you need as dynamic mention it within $$, get the mime as an XML file use XML specfic classes and methods to extract entire MIME document as an XML now get $Title$ and update the value.
Hope this helps.
Regards,
Abhinav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.