CALL METHOD - Call a method of an external object


Basic form

CALL METHOD OF obj m.

Additions



1. ... = f
2. ... EXPORTING p1 = f1 ... pn = fn
3. ... NO FLUSH

Effect

Calls the method m of the object obj . m can be a literal or a variable.
CALL METHOD

Addition 1

... = f

Effect

Stores the return value of the method in the variable f . The return value can also be of type OLE2_OBJECT . This addition must always come before other additions.

Addition 2

... EXPORTING p1 = f1 ... pn = fn

Effect

EXPORTING passes values of fields to the parameters of the method. p1 , p2 , ... are either key word parameters or position parameters. If assignment of parameters is by sequence, p1 , p2 , ... must begin with "#", followed by the position number of the parameter. At present, only position parameters are supported. The export parameters always come at the end of the statement.

Addition 3

... NO FLUSH

Example

Open an EXCEL file with the method 'Open'.
INCLUDE OLE2INCL. DATA EXCEL TYPE OLE2_OBJECT. DATA WORKBOOK TYPE OLE2_OBJECT. CREATE OBJECT EXCEL 'Excel.Application'. CALL METHOD OF EXCEL 'Workbooks' = WORKBOOK. CALL METHOD OF WORKBOOK 'Open' EXPORTING #1 = 'C:\EX1.XLS'.

Related SET PROPERTY
GET PROPERTY
CREATE OBJECT
FREE OBJECT

Index
© SAP AG 1996