Skip to Content
0
May 15, 2008 at 02:23 AM

ABAP OLE to Excel to Create a Chart

305 Views

Hi All,

I have a requirement to

1) Output data from an internal table into excel, and

2) Create a chart from the data in excel

The ABAP program is driving the creation of the chart in excel.

So far I have been able to export the data using OLE calls, create a chart object, and position it on the sheet.

The VBA Code replicated in ABAP so far is as follows

Charts.Add

ActiveChart.ChartType = xlCylinderColStacked100

ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"

ActiveSheet.Shapes(1).IncrementLeft -306.75

ActiveSheet.Shapes(1).IncrementTop -158.25

ActiveSheet.Shapes(1).ScaleWidth 1.33, msoFalse, msoScaleFromTopLeft

ActiveSheet.Shapes(1).ScaleHeight 1.17, msoFalse, msoScaleFromTopLeft

Next step is to define the data source for the chart, and this is where I am getting stuck.

The VBA code to be replicated in ABAP is as follows

Set source = Sheets("Sheet1").Range("B30:B42,D30:F42")

ActiveChart.SetSourceData source, PlotBy:=xlColumns

Any suggestions appreciated!!

Kind Regards,

David Cooper