04-20-2012 10:59 AM
Hello,
I try to create a pie chart, but it doesn't work. At least I tried this way: http://scn.sap.com/people/kai.gutenkunst/blog/2009/02/26/creating-charts-without-using-xml-classes .
But I don't know how the xml-file has to look like for a pie chart.
I also try to use the CHARTDESINGER (and the documentation), and I look up in the example GFW_PROG_PIE.
Can anyone help me please?
04-20-2012 7:25 PM
Hi Julia,
Try GRAL ......... (T-Code) , there are loads of Sample programs .... hope something u might get helpful there. ...............
In addition to GRAL, try using - FM => GRAPH_MATRIX_3D, GRAPH_3D ... these are easy to use... read documentation and try seeking online help.......
Thanks and Regards,
Ravindra Sonar.
04-26-2012 2:16 PM
thanks for your efforts!
after a lot of experiments I found a way with the above link. For all developer who have the save problem here the solution:
(It's a 2D Pie Chart, if you want a 3D you have to modify xml file).
TYPES values_type TYPE STANDARD TABLE OF i.
MODULE pbo_0101 OUTPUT.
* create some demo data in an internal table
APPEND 'a' TO categories.
APPEND 'b' TO categories.
APPEND 'c' TO categories.
series-label = 'Values'.
series-id = 'Series1'.
APPEND '10' TO series-values.
APPEND '30' TO series-values.
APPEND '40' TO series-values.
APPEND series TO series_table.
CLEAR series-values.
DATA: customizing_xml TYPE xstring.
* create some basic customizing settings
CALL TRANSFORMATION ztest_t2xml
SOURCE title = 'Text' chart_type = 'Pie'
categories = categories series = series_table
RESULT XML customizing_xml.
CREATE OBJECT go_ce_container
EXPORTING
container_name = 'CONTAINER'.
CREATE OBJECT go_ce_viewer
EXPORTING
parent = go_ce_container.
go_ce_viewer->set_data( xdata = customizing_xml ).
go_ce_viewer->set_customizing( xdata = customizing_xml ).
CALL METHOD go_ce_viewer->render.
ENDMODULE.
XML FILE:
<?sap.transformsimple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="CHART_TYPE"/>
<tt:root name="TITLE"/>
<tt:rootname="CATEGORIES"/>
<tt:root name="SERIES"/>
<tt:template>
<SAPChartCustomizingversion="2.1">
<GlobalSettings>
<ColorPalette>Tradeshow</ColorPalette>
<Defaults>
<ChartType>
<tt:valueref="CHART_TYPE"/>
</ChartType>
</Defaults>
</GlobalSettings>
<Elements>
</Elements>
<Categories>
<tt:loop ref="CATEGORIES">
<Category>
<tt:value/>
</Category>
</tt:loop>
</Categories>
<tt:loop ref="SERIES">
<Series>
<tt:attribute name="label">
<tt:valueref="LABEL"/>
</tt:attribute>
<tt:attribute name="customizing">
<tt:value ref="ID"/>
</tt:attribute>
<tt:loopref="VALUES">
<Point>
<Value type="y">
<tt:value/>
</Value>
</Point>
</tt:loop>
</Series>
</tt:loop>
</SAPChartCustomizing>
</tt:template>
</tt:transform>