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

The problems of interface SAP-Excel: method select_sheet

Former Member
0 Likes
2,602

Hello experts!

I made an ABAP report that reads and writes data from Excel files, imported into SAP with T. OAOR. Each Excel file has cca twenty of the sheets. Everything works fine .... better to say almost everything, because the method select_sheet on certain sheets works well, on the others sheets does not work. The bad thing is that the return code of the method select_sheet says that went well, but the sheet you want is not selected. In this case the method get_active_sheet returns the previous sheet and not one that should be selected.

I am working with SAP ECC 6.0, SAP GUI 720, MS Excel 2007, the method returns the version 5 version.

Have any of you had a similar experience? I have the impression that it is the incompatibility between the versions.

Best regards,

Mio

1 ACCEPTED SOLUTION
Read only

romit_raina
Active Participant
0 Likes
2,436

Hey Mio,

See below thread of wiki, hope this will hep you for reading & writing in excel :-

http://wiki.scn.sap.com/wiki/display/Snippets/Read+multiple+sheets+of+an+Excel+file+into+SAP+through...

Thanks

Romit Raina

9 REPLIES 9
Read only

Former Member
0 Likes
2,436

Hi Mio,

I ask you some additional information.

Are you using abap2xlsx.org? If so in which class is the method select_sheet?

KR,

Alessandra

Read only

0 Likes
2,436

Hi Alessandra,

Do not use abap2xlsx.org.

I am using the method select_sheet of SAP intrface I_OI_SPREADSHEET.

Ciao,

Mio

Read only

romit_raina
Active Participant
0 Likes
2,437

Hey Mio,

See below thread of wiki, hope this will hep you for reading & writing in excel :-

http://wiki.scn.sap.com/wiki/display/Snippets/Read+multiple+sheets+of+an+Excel+file+into+SAP+through...

Thanks

Romit Raina

Read only

0 Likes
2,436

Thanks Romit.

This is a nice article, but I've already read.

Best regards,

Mio

Read only

0 Likes
2,436

hi Mio,

I am facing similar issue in my project now.

Can you tell ,how did u solved this.

Regards

Pallavi

Read only

0 Likes
2,436

refer to the link provided by . If it reads all your worksheets, then you've got a bug in your program.

Read only

0 Likes
2,436

Hi Sandra,

Thanks for your reply.

I have already referred the link.:)

I am trying to understand,

" If it reads all your worksheets, then you've got a bug in your program." 

That means reading all sheets is a bug...??

My program actually reads all the sheets data as required.

But recently during testing we realized a issue, this happens only while closing the excel with Sheet10 as active ( i.e last working sheet is sheet10 just before saving the file ).

Then in the program during method call

Loop at it_sheets ( all the sheets say Sheet1 to Sheet 10)

first loop pass

call method i_oi_spreadsheet->SELECT_SHEET

exporting

name = sheet1.   -->>>> This is not changing the active sheet to sheet1 from sheet10.

so sheet10 data is uploaded into internal table. Which is inconsistent.

second loop pass

call method i_oi_spreadsheet->SELECT_SHEET

exporting

name = sheet2.   -->>>> This is changing the active sheet to sheet2 from sheet10.

in 10th loop pass

call method i_oi_spreadsheet->SELECT_SHEET

exporting

name = sheet10.   -->>>> This is changing the active sheet to sheet9 from sheet10.

so the issue is in first loop pass method SELECT_SHEET is not able to change the active sheet10 to sheet1.

To all the surprise, if excel is saved with Sheet1 as active before uploading, then all is well.

Not sure what is missing in case of activating sheet1,If anyone of you faced similar issue, Kindly help suggest on this.

Regards

Pallavi

Read only

0 Likes
2,436

No, I mean: run the program provided in the link provided by Romit Raina. This program loops at all the sheets, and writes the contents. Does it loop correctly at all sheets of your workbook? it should work. If so, then you have a bug in your program!

Read only

0 Likes
2,270

Hello, can you provide your program?

[email protected]