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

Excel OLE PlotBy

Former Member
0 Likes
722

Hi,

I'm creating a chart in Excel from ABAP.

My problem is, that I want to change the series to columns (swapping the axis). As far as I know this can be done i VBA with the statement PlotBy:=xlColumns.

In my ABAP I have the following code (after setting the range):

CALL METHOD OF chart 'SetSourceData' EXPORTING #1 = range #2 = 1.

Can I somehow add the PlotBy, so I can swop the axis?

Regards,

Vibeke

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
677

CALL METHOD OF chart 'SetSourceData'

EXPORTING #1 = range "Range

#2 = 2. "Plot by

Const xlRows = 1

Const xlColumns = 2

4 REPLIES 4
Read only

Former Member
0 Likes
677

Check the following example


REPORT  ZGRAPH.

DATA: BEGIN OF ITAB_DATA OCCURS 0,
DATANAME(15),
QUANTITY1 TYPE I,
QUANTITY2 TYPE I,
QUANTITY3 TYPE I,
END OF ITAB_DATA,

BEGIN OF ITAB_OPTIONS OCCURS 0,
OPTION(20),
END OF ITAB_OPTIONS.

ITAB_DATA-DATANAME = 'Rice'.
ITAB_DATA-QUANTITY1 = 55.
ITAB_DATA-QUANTITY2 = 62.
ITAB_DATA-QUANTITY3 = 59.
APPEND ITAB_DATA.

ITAB_DATA-DATANAME = 'Wheat'.
ITAB_DATA-QUANTITY1 = 35.
ITAB_DATA-QUANTITY2 = 52.
ITAB_DATA-QUANTITY3 = 44.
APPEND ITAB_DATA.

ITAB_DATA-DATANAME = 'Sugar'.
ITAB_DATA-QUANTITY1 = 18.
ITAB_DATA-QUANTITY2 = 22.
ITAB_DATA-QUANTITY3 = 19.
APPEND ITAB_DATA.

CALL FUNCTION 'GRAPH_MATRIX_3D'
EXPORTING
COL1 = 'Jan'
COL2 = 'Feb'
COL3 = 'Mar'
TITL = 'Quantity Consumed In KG.'
TABLES
DATA = ITAB_DATA
OPTS = ITAB_OPTIONS
EXCEPTIONS
OTHERS = 1.

Read only

0 Likes
677

I'm using OLE creating Excel.

Regards,

Vibeke

Read only

Former Member
0 Likes
678

CALL METHOD OF chart 'SetSourceData'

EXPORTING #1 = range "Range

#2 = 2. "Plot by

Const xlRows = 1

Const xlColumns = 2

Read only

0 Likes
677

So that's what that second parameter is for 🐵

Absolutely brilliant. Problem solved.

Many thanks GTREN!

Regards,

Vibeke