Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP OLE2 code issue with chart development

Former Member
0 Likes
608

Hi Experts,

The below ABAP OLE2 code isn't working for me:

* Making the Series lines with no Markers

GET PROPERTY OF h_excel 'ActiveChart' = h_chart3.

CALL METHOD OF      h_chart3    

'SeriesCollection' = h_series  

EXPORTING      #1       = c_maxinv. "Name of the Series

*  CALL METHOD OF

*    h_chart3

*    'SeriesCollection(1)' = h_series.

CALL METHOD OF      h_series      'Select'. 

GET PROPERTY OF h_series 'Border' = h_series. 

SET PROPERTY OF h_series 'MarkerStyle' = '-4142'. " None

for the below VBA:

ActiveChart.SeriesCollection(2).Select

    With Selection.Border

        .ColorIndex = 3

        .Weight = xlThin

        .LineStyle = xlContinuous

    End With

    With Selection

        .MarkerBackgroundColorIndex = xlAutomatic

        .MarkerForegroundColorIndex = xlAutomatic

        .MarkerStyle = xlNone

        .Smooth = False

        .MarkerSize = 5

        .Shadow = False

    End With

End Sub

-------------------------------

This one is also not working

* Making the Horizontal Axis Label to display in the bottom

CALL METHOD OF      h_chart3      'Axes'   = h_axis  

EXPORTING      #1       = 3.   "xlTimeScale

SET PROPERTY OF h_axis 'HasAxis' = 1. 

CALL METHOD OF      h_axis      'Select'. 

SET PROPERTY OF h_axis 'TickLabelPosition' = '-4134'. "xlLow

-------------

* Making the Max Inv / Min Inv lines - Red Color

*  CALL METHOD OF

*      h_chart3

*      'SeriesCollection(1)' = h_series. 

CALL METHOD OF      h_chart3      'SeriesCollection' = h_series    EXPORTING      #1                 = c_maxinv. 

CALL METHOD OF      h_series      'Select'. 

GET PROPERTY OF h_series 'Border' = h_series. 

SET PROPERTY OF h_series 'ColorIndex' = '3'.      " Red colored Line 

SET PROPERTY OF h_series 'LineStyle' = '-4115'.   " Dashed Line 

SET PROPERTY OF h_series 'MarkerStyle' = '-4142'. " None

Can someone help me in this issue? Where did I go wrong in the above code?

Thanks & Regards,

Sowmya

1 ACCEPTED SOLUTION
Read only

Kartik2
Contributor
0 Likes
558

Hi,

I think the problem is in passing the value of XlDash from abap to excel. Have a look at the follwoing code :

  CALL METHOD OF h_chart4 'SeriesCollection' = series
    EXPORTING
    #1 = 'Required'. " Here required is my series name, in you case c_maxinv

  GET PROPERTY OF series 'Border' = gv_border.

  SET PROPERTY OF gv_border 'ColorIndex' = '3'.


*  SET PROPERTY OF gv_border 'LineStyle' = '4'."'&HFFFFEFED'."'-4115'.

It works fine to change the color of the selected line and also to change the line style to XlDashDot. Even i am having problems in changing the linestyle to XlDash.

Thanks and regards,

kartik

2 REPLIES 2
Read only

Kartik2
Contributor
0 Likes
559

Hi,

I think the problem is in passing the value of XlDash from abap to excel. Have a look at the follwoing code :

  CALL METHOD OF h_chart4 'SeriesCollection' = series
    EXPORTING
    #1 = 'Required'. " Here required is my series name, in you case c_maxinv

  GET PROPERTY OF series 'Border' = gv_border.

  SET PROPERTY OF gv_border 'ColorIndex' = '3'.


*  SET PROPERTY OF gv_border 'LineStyle' = '4'."'&HFFFFEFED'."'-4115'.

It works fine to change the color of the selected line and also to change the line style to XlDashDot. Even i am having problems in changing the linestyle to XlDash.

Thanks and regards,

kartik

Read only

0 Likes
558

Hi,

As of the line marker, I think in your coding you have mentioned the chart type as XlLineMarkers '65'. Instead give it as XlLine '4'. you will not get the marker.

Thanks and regards,
kartik