‎2005 Apr 25 11:18 AM
Hi,
I am getting sy-subrc = 2 when I am executing FREE OBJECT command for OLE objects. SAP help says sy-subrc is set to 2 when there is an error during function call in SAPgui. But I couldnt find out what I am doing wrong in the program. Can someone help me out.
Regards,
Sajith.
‎2005 Apr 25 11:22 AM
Sajith,
Which version of SAP realease are you in? And what is your SAPGUI version?
Regards,
Sougata.
‎2005 Apr 25 11:27 AM
‎2005 Apr 25 12:46 PM
SAP documentation says:
<b>The OLE function modules are only implemented under Windows.</b>
So make sure you are working with a windows object like Excel or WinWord for example. The FREE OBJECT will only work for Windows applications.
SAP Doco. (Example)
FREE OBJECT belongs to a group of key words that allows you to process external objects with ABAP. At present, only the object model OLE2 is supported, i.e. all objects must be of type OLE2_OBJECT. This type and other necessary data are defined in the INCLUDE module OLE2INCL.
Release an EXCEL object:
<b>
INCLUDE OLE2INCL.
DATA: EXCEL TYPE OLE2_OBJECT.
CREATE OBJECT EXCEL 'Excel.Application'.
FREE OBJECT EXCEL.
</b>
Regards,
Sougata.