Application Development and Automation 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: 
Read only

Error during function call in SAPgui.

Former Member
0 Likes
904

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.

3 REPLIES 3
Read only

Former Member
0 Likes
555

Sajith,

Which version of SAP realease are you in? And what is your SAPGUI version?

Regards,

Sougata.

Read only

0 Likes
555

SAP Version is 4.7.

SAP GUI is 640.

Read only

0 Likes
555

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.