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

Upload excel- multiple sheets

Former Member
0 Likes
1,247

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.

5 REPLIES 5
Read only

Former Member
0 Likes
946

U can use OLE to do that.

awrd points if useful

Bhupal

Read only

0 Likes
946

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.

Read only

Former Member
0 Likes
946

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.

Read only

0 Likes
946

Hi Runal,

Can u send a code for this...?

Regards,

Dharmesh

Read only

Former Member
0 Likes
946

Hi,

Check the following link:http://www.sap-img.com/abap/uploading-multiple-multitab-excel-sheets-or-ranges.htm

Regards,

Bhaskar