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

reading data from excel file

0 Likes
802

Hi everybody,

I have to read some data from an excel file in the ABAP code. This excel file is attached to a business partner (BP).

I can get the document from the BP using the method GET_DOCUMENT of the class CL_CRM_DOCUMENTS, but this gets me only the ascii data (or binary data, which is even worse).

I've read that OLE could be used, but I don't know how to pass the document to the excel instance. A possibility would be to download the file into the disk and pass that path+filename to the excel, but I don't think much of this solution.

Another idea i had is to get the URL of the document, and pass it on to the excel, but the URL I get looks like SAPR3://etc, also not use.

Does anyone have any ideas? Thank you in advance.

Regards,

Joaquin

4 REPLIES 4
Read only

Former Member
0 Likes
763

why don't you save you're excel to a text file with tab delimited and use the function gui_upload to read the file ??

kind regards

arthur de smidt

Read only

0 Likes
763

Hi Arthur,

thanks for the quick answer.

I cannot do that because the customer is the one who attaches the excel file to the BP, therefore I can't save the excel into a different format.

Regards,

Joaquin

Read only

Former Member
0 Likes
763

You could use the OLE to pass data into Excel using Cell, Range, Sheet objects specifically. Or just paste into each sheet from the windows clipboard.

This may help fill in some blanks with OLE and ABAP

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/204d1bb8-489d-2910-d0b5-cdddb322...

Read only

0 Likes
763

Hi Kev,

thanks for the answer.

I already knew about this document, and I think that's the way to work with excel within the ABAP environment, but as I said in my post, I do not know how to pass the file to the excel instance.

The file is attached to the BP, so that means I cannot just open an excel instance and execute the method open, because I don't know which filename I should give. Maybe I could previously download the file, but this would be executed in the server-side, and I can't know which Operative System is being used, etc

Any other ideas?

Regards,

Joaquin