Skip to Content
author's profile photo Former Member
Former Member

Methods and Property of OLE objects

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Oct 19, 2005 at 06:10 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 03:46 AM

    Hi,

    An easy reference for ole automation.

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

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 03:55 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 19, 2005 at 05:45 AM

    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/wrgrfexcelapplicationobject.asp

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.