10-18-2005 11:27 PM
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
10-19-2005 7: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.
10-19-2005 4:46 AM
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
10-19-2005 4:55 AM
10-19-2005 6: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/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
10-19-2005 6:56 AM
i use VB6 object broswser and sometime microsoft activex control pad to ge these details.
Regards
Raja
10-19-2005 7: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.