Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8776

Re: How to change Chart Types in CL_GUI_CHART_ENGINE

$
0
0

Hello Taly,

 

it IS possible I just developed a program some months ago, that did exactly that:

You don’t NEED the Chart-Designer to accomplish this, but it makes it a lot easier , because you can build an example for your Chart and export the XML, so that you have the structure and then just have to build the same in your code.

You need to build two XML “Objects” one for the Customizing and one for the Gantt-Data.

To display your Diagramm as a Gant you have to set the Following XML Node:

 

<?xmlversion="1.0"encoding="utf-8"?>

<SAPChartCustomizingversion="2.0">

<GlobalSettings>

  …

  <Defaults>

   <ChartType>Gantt</ChartType>

   …

  </Defaults>

</GlobalSettings>

<Elements>

  <ChartElements>

   …

  </ChartElements>

</Elements>

<Values>

  <Series>

   …

  </Series>

</Values>

</SAPChartCustomizing>

 

To achieve this in ABAP as Eitan said already you have to use the Standard XML Object 'CL_IXML' and “build” you nodes.

 

  DATA: go_ixml          TYPE REF TO if_ixml,
      go_ixml_cust_doc
TYPE REF TO if_ixml_document.


DATA: lo_root           TYPE REF TO if_ixml_element,
      lo_globalsettings
TYPE REF TO if_ixml_element,
      lo_default       
TYPE REF TO if_ixml_element,
      lo_element       
TYPE REF TO if_ixml_element,
      lo_encoding      
TYPE REF TO if_ixml_encoding.


go_ixml
= cl_ixml=>create( ).
go_ixml_cust_doc
= go_ixml->create_document( ).

lo_encoding
= go_ixml->create_encoding(
           byte_order   
= if_ixml_encoding=>co_little_endian
           character_set
= 'utf-8' ).

go_ixml_cust_doc
->set_encoding( lo_encoding ).

lo_root
= go_ixml_cust_doc->create_simple_element(
           name
= 'SAPChartCustomizing'
           parent
= go_ixml_cust_doc ).

lo_root
->set_attribute( name = 'version' value = '2.0' ).

lo_globalsettings
= go_ixml_cust_doc->create_simple_element(
           name
= 'GlobalSettings' parent = lo_root ).

lo_default
= go_ixml_cust_doc->create_simple_element(
           name
= 'Defaults' parent = lo_globalsettings ).

lo_element
= go_ixml_cust_doc->create_simple_element(
           name
= 'ChartType' parent = lo_default ).

lo_element->if_ixml_node~set_value( 'Gantt' ).

 

 

Regards

Amadeus


Viewing all articles
Browse latest Browse all 8776

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>