Application Development 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: 

OLE Multi Sheet Excel Upload

Former Member
0 Kudos

Hello Friends,

I am working on a Service Contract Creation program to upload data from multiple sheets of an excel file.

I had referred this code

http://wiki.sdn.sap.com/wiki/display/Snippets/Multiple+sheet+Excel+Document+from+SAP+using+OLE

The code works fine as expected but the problem is somtimes it takes only partial data ie Out of 3 sheets data for only two sheets are getting populated and the third internal table remains blank as a result incomplete data gets uploaded in the database.

Can you please let me know why I am facing this problem is there any issue with excel sheet or something else??

Thanks & Regards,

Nishit Shah 

7 REPLIES 7

Former Member

Former Member
0 Kudos

0 Kudos

Hi Smruti,

I am already having the code for multiple sheet upload the problem I am facing is some times the data from the excel sheet is not getting captured in the internal table , the program is not behaving in a consistent manner

http://wiki.sdn.sap.com/wiki/display/Snippets/Multiple+sheet+Excel+Document+from+SAP+using+OLE

Kindly refer the above link

Thanks & Regards,

Nishit Shah

0 Kudos

Hi Nishit,

As per the link which is u Refer it is download the data into Excel sheet into three different Worksheet .

but you asking for Uploading the data into Database from Excel sheet (is it right ?)

"Service Contract Creation program to upload data from multiple sheets of an excel file."

Regard's

Smruti

0 Kudos

0 Kudos

Yeah Nishit,

i already provided dis link to u , my above conversation . , and also test dat code working f9..no issue..

Regard's

Smruti

Former Member
0 Kudos

Hi Nishit,

I'm not sure about your initial problem. Do you miss Sheet3? If this is the case, you should know the following:

In the sample you referred to (MULTIEXCEL) the comment "* Create second Excel sheet" do not mean that a new sheet is created. It's only activating an already existing sheet.

In that example all 3 sheets are created by the command "CALL METHOD OF workbook 'Add'.". In this case it's creating the number of sheets, specified als default in Excel Options. If the number of sheets is set to 2, you'll only get 2 sheets and the third one is missing. You can change this by either using

  SET PROPERTY OF application 'SheetsInNewWorkbook' = 3. "(ATTENTION: This will change the default setting in Excel !)

before you add the workbook by "CALL METHOD OF workbook 'Add'.", or use the

  CALL METHOD OF application 'Add'.

to add additional (missing) sheets.

If you want save the current setting for SheetsInNewWorkbook, you should retrieve the current value by GET PROPERTY and reset it to the origional value after your "CALL METHOD OF workbook 'Add'.".

I hope this helps.

Regards

Detlev