Application Development 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: 

Methods and Property of OLE objects

Former Member
0 Kudos

Hi,

How do I get to know the Methods(CALL METHOD) and Property ( SET/ GET PROPERTY ) associated with the Various elements of OLE Automation.

Thanks in Advance,

Arunava

1 ACCEPTED SOLUTION

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Suppose if you want to find methods for word,Open a word document->Tools->Macro->Visual Basic Editor->Then a window will open.

After that press F2[or view->Object Browser]->Choose the methods you want.It will give an Hyperlink with parameters of the methods.

check the below link for reference.

http://help.sap.com/saphelp_46c/helpdata/en/59/ae3f2e488f11d189490000e829fbbd/frameset.htm

There is an example of an excel sheet in the documentation.

Hope it would be of some help to you.Kindly reward points by clicking the star on the left of reply,if it helps.

5 REPLIES 5

Former Member
0 Kudos

Hi,

An easy reference for ole automation.

<u>https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c1d54348-0601-0010-3e98-bd2a2dcd9e6c</u>

Also Check this sample code.

REPORT CHAP2801.

  • Including OLE types

INCLUDE OLE2INCL.

  • Tables and variables for later use

TABLES: CUSTOMERS.

DATA: APPLICATION TYPE OLE2_OBJECT,

WORKBOOK TYPE OLE2_OBJECT,

SHEET TYPE OLE2_OBJECT,

CELLS TYPE OLE2_OBJECT.

  • Creating an object

CREATE OBJECT APPLICATION 'excel.application'.

IF SY-SUBRC NE 0.

WRITE: / 'Error when opening excel.application', SY-MSGLI.

ENDIF.

  • Setting properties

SET PROPERTY OF APPLICATION 'Visible' = 1.

  • Calling methods

CALL METHOD OF APPLICATION 'Workbooks' = WORKBOOK.

PERFORM ERRORS.

CALL METHOD OF WORKBOOK 'Add'.

PERFORM ERRORS.

CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.

PERFORM ERRORS.

CALL METHOD OF SHEET 'Activate'.

PERFORM ERRORS.

PERFORM FILL_SHEET.

  • Subroutine for filling the spread sheet

FORM FILL_SHEET.

DATA: ROW_MAX TYPE I VALUE 256,

INDEX TYPE I.

FIELD-SYMBOLS: <NAME>.

SELECT * FROM CUSTOMERS.

INDEX = ROW_MAX * ( SY-DBCNT - 1 ) + 1.

DO 4 TIMES.

ASSIGN COMPONENT SY-INDEX OF STRUCTURE CUSTOMERS TO <NAME>.

CALL METHOD OF SHEET 'Cells' = CELLS

EXPORTING #1 = INDEX.

SET PROPERTY OF CELLS 'Value' = <NAME>.

ADD 1 TO INDEX.

ENDDO.

ENDSELECT.

ENDFORM.

  • Subroutine for error handling

FORM ERRORS.

IF SY-SUBRC NE 0.

WRITE: / 'Error in OLE call', SY-MSGLI.

EXIT.

ENDIF.

ENDFORM.

Kindly reward points if u find it useful.

Thanks&Regards,

Ruthra

Former Member
0 Kudos

hi, I think that you want to know how to search out the method and property of an OLE object.

I think if it is a OLE object offer from third-partner, normally they will offer you the document about how to use the OLE and the information about the method and property, for example http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrgrfexcelapplicatio...

this is a link about excel object offered by microsoft.

And if you have the fundamental conception of OLE in ABAP, you can quickly use the OLE through that document.

And there is also some tools for OLE object, when you don't have manual document. If you install Microsoft Visual Studio, there is a tools name 'OLE View', you can use it open all of the OLE object in PC, and it will list the method, property and other information for you.

hope it will be helpful

thanks

0 Kudos

i use VB6 object broswser and sometime microsoft activex control pad to ge these details.

Regards

Raja

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Suppose if you want to find methods for word,Open a word document->Tools->Macro->Visual Basic Editor->Then a window will open.

After that press F2[or view->Object Browser]->Choose the methods you want.It will give an Hyperlink with parameters of the methods.

check the below link for reference.

http://help.sap.com/saphelp_46c/helpdata/en/59/ae3f2e488f11d189490000e829fbbd/frameset.htm

There is an example of an excel sheet in the documentation.

Hope it would be of some help to you.Kindly reward points by clicking the star on the left of reply,if it helps.