‎2008 Mar 06 9:14 AM
Hi All,
Is it possible to read data into SAP from an excel with multiple sheets?
I have a scenario wherein I need to upload data from multiple sheets(say 3) in an excel. Is there any way to achieve this? Are there any function modules available?
Thanks in advance.
‎2008 Mar 06 9:23 AM
‎2008 Mar 06 9:32 AM
Hi Bhupal,
I know we can download multiple sheets using OLE.
But is it possible to upload also?
If yes, could you please explain how?
Thanks.
‎2008 Mar 06 9:34 AM
hi,
Through its Open Object Interface, ABAP supports the OLE2 Automation technique. Desktop applications that provide their functionality in the form of an OLE2 Automation Server (such as Excel or WinWord) can be thus be integrated into R/3.
All applications controlled by ABAP must be registered in R/3.
The following ABAP key words control the applications:
CREATE OBJECT
SET PROPERTY
GET PROPERTY
CALL METHOD
FREE OBJECT
When called from an ABAP program, the SAPGUI acts as OLE client, and the desktop application as the OLE server.
Implementation
Communication between the applications server and the frontend is via the RFC interface. The SAPGUI contains special OLE functions which you can address from ABAP programs with normal RFC calls (destination SAPGUI).
The implementation is realized by means of the ABAP keywords CREATE OBJECT and FREE OBJECT (which call the function modules CREATE_OBJECT and FREE_OBJECT) and C functions which are written as RFC Server programs.
In CREATE OBJECT , the ABAP processor reads the relevant entry in the table TOLE and uses the found OLE class-ID to call the function OLE_CREATE_OBJECT at the frontend via
RFC. Then the functions that are necessary for generating an OLE object are called from the Windows OLE library and an object handle is returned to the ABAP processor.
From an OLE point of view, the SAPGUI represents the actual OLE client.
The commands CALL METHOD GET PROPERTY and SET PROPERTY are bundled on the application server and passed to the SAPGUI function OLE_FLUSH_CALL in the form of an internal table.
FREE OBJECT calls the SAPGUI function OLE_RELEASE_OBJECT which, besides
the OLE call, also releases all resources retrieved for this object at the frontend.
Reading the Typeinfo is also implemented via an RFC call to the SAPGUI.
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'.
Hope this helps, Do reward.
‎2008 Mar 24 11:02 AM
‎2008 Mar 24 11:17 AM
Hi,
Check the following link:http://www.sap-img.com/abap/uploading-multiple-multitab-excel-sheets-or-ranges.htm
Regards,
Bhaskar