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: 

SAP OLE to Excel - Record miss problem

Former Member
0 Kudos

Hi Experts

I am using SAP OLE to transfer records from SAP to multiple sheets of Excel.

Everything is going fine, except that randomly some records get missed while transferring to MS-Excel. This is the problem. However, the same program works pretty smoothly without any hitch when using Open Source platform like WPS Office. If there was any problem with the SAP code, nothing would have got transferred.

Is there anything amiss?

Many thanks

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Did you manage the sy-subrc value in each and every call of an OLE method in your code, would be you first step to analyze the problem. Which options did you use in automation methods, some NO FLUSH or QUEUE-ONLY, did you use FM FLUSH, etc.

You should really provide more information. Alas the assertion that if it works with a product like open office then it should work with another as MS Office is often false, also often false with different versions of the same product. So the try, check, correct loops are required, and collection of error code is required in the code.

8 REPLIES 8

Sandra_Rossi
Active Contributor
0 Kudos

There was no such issue with OLE in SAP for decades, so I would first blame a bug in your program. If there would be a bug in SAP standard, then you should reproduce/identify clearly where the error is, and contact the SAP support.

0 Kudos

Hi. Thanks for your answer. In case there is a bug indeed, how is the same program providing seemingly okay output with no records missing with WPS Office.

And the problem is appearing in random record, with no clear pattern appearing.

Edit: The value of sy-subrc is 3 in such cases where record gets missed.

Regards

Dinesh

0 Kudos

Hi. In addition, something strange is happening, the problem shows up when I keep excel file opened while the report is running or I click somewhere on the screen. Other than that, it runs fine in excel as well.

Regards

Dinesh

0 Kudos

sorry, it's impossible to answer the question "why is there sy-subrc = 3 in OLE with Excel ?" Please give more information. Differently said, if you answer my question "why does my function module Z_GET_DATA returns value 'C' ?", then you're a magician!

0 Kudos

Hi..

My apologies for the incomplete information. I am bit closer to the solution, though. I am running the SAP OLE to excel function in background mode and it works till the save part. Probably something missing in my code.

Regards

0 Kudos

SAP background job? how is it possible to make OLE work in background as the frontend cannot be connected to SAP in such a mode?

raymond_giuseppi
Active Contributor
0 Kudos

Did you manage the sy-subrc value in each and every call of an OLE method in your code, would be you first step to analyze the problem. Which options did you use in automation methods, some NO FLUSH or QUEUE-ONLY, did you use FM FLUSH, etc.

You should really provide more information. Alas the assertion that if it works with a product like open office then it should work with another as MS Office is often false, also often false with different versions of the same product. So the try, check, correct loops are required, and collection of error code is required in the code.

0 Kudos

Hi.. your statement that "it works with a product like open office then it should work with another as MS Office is often false" was spot on. There was something missing in my code, which I resolved. Now stuck at something different though 🙂