cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Chart Title Dynamically

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks a lot Abhinav.

Cheers,

Kishore

former_member187977
Participant
0 Kudos

hi abhinav,

how do I get the Mime as if_ixml_document type. The I_Customizing property of BG UI element takes values type if_ixml_document. I want to set the Mime in I_Customizing. how do i do it ?

Regards

seventyros

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Abhinav,

The extn is '.XML'

we had used the SAP Chart Designer 640 and saved the customizing and used it as a mime in the BSP application.

Regards,

Kishore

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Abhinav,

Thanks for your reply.

Could you please explain with an example.

Regards,

kishore

Former Member
0 Kudos

Hi,

Could you please help us out with this issue.

Thnx in advance,

Regards,

Kishore