Skip to Content
author's profile photo Former Member
Former Member

Setting Chart Title Dynamically

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 21, 2009 at 12:21 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 18, 2009 at 01:36 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 20, 2009 at 06:16 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 20, 2009 at 11:31 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.