cancel
Showing results for 
Search instead for 
Did you mean: 

Excel in Webdynpro for abap

Former Member
0 Kudos

Hi Experts,

I have excel file (example "http://xxxx/test.xls") with contents. I want to incorporate this excel file into my web dynpro application. For this I used Officecontrol UI element and set the following properties for Officecontrol

1. datasource : binding with context attribute DATAS(xstring)

2. document type : ms_excel

Please suggest how to display excel with contents in view of my application.

Can any one help me.....

Thanks & Regards

Sridhar

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

solved

Former Member
0 Kudos

Hi

go through this link it will solve your query.

http://www.saptechnical.com/Tutorials/WebDynproABAP/Export/toexcel.htm

Edited by: anand prakash rai on Oct 23, 2008 10:58 AM

Former Member
0 Kudos

Please use the web dynpro component IOS_TEST_HELLOWORLD_MS as example.

Former Member
0 Kudos

Please check this forum thread

thanks

Suman

Former Member
0 Kudos

Thank you. Here I'm not using "FileUpload UI element".

I'm Using OfficeControl UI element.

Please any one help me, what are the step to do it.

Thanks & Regards

Sridhar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you want to use the OfficeIntegration UI element, you are going to have to get the binary content from the remote URL into ABAP memory. If this is really a URL, then I would suggest using the CL_HTTP_CLIENT class to retrieve the content.

Former Member
0 Kudos

Hi Thomas,

Thanks for your time. How to retreive contents from excel using CL_HTTP_CLIENT. Please help me out.

Thanks

Sridhar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

CL_HTTP_CLIENT is pretty easy to use. Its functionality mimics a Web Browser. You can find an example of it in this web log:

Former Member
0 Kudos

Hi Thomas,

I have a file 'https://sap.com/.../test.xls', this file is opening through web browser. I need to convert the excel contents to binary format. Please tell me the step to do.

required the following values from excel:

Input length , file line, last line, binary format

Please help me...

Thanks

Sridhar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi Thomas,

>

> I have a file 'https://sap.com/.../test.xls', this file is opening through web browser. I need to convert the excel contents to binary format. Please tell me the step to do.

>

> required the following values from excel:

> Input length , file line, last line, binary format

>

> Please help me...

>

> Thanks

> Sridhar

I fail to see how this is connected and I believe that the question has strayed pretty far from the Web Dynpro ABAP topic.

>I need to convert the excel contents to binary format

Excel already is binary format. What exactly are you trying to do here?

>> Input length , file line, last line, binary format

Not sure what you mean by this. Once you have the content in a binary string you can just do a xstrlen command on it to get the input length. Why do you you need the file line and last line? What do you even mean by binary format?

Former Member
0 Kudos

Hi Thomas,

Thanks for your time. Here my requirement is ..

I have an excel file "http://sdn.sap.com/test.xls" , I can open this file through web browser without any authorizations ( i.e open to all).

I need to show this excel file in web dynpro application, for this I used officecontrol UI element. Please suggest the right way...

I saw few web dynpro applications like "IOS_TEST_SPREADSHEET_MS", but here excel file is available in MIME repository. so the following code is used

mime_repository = cl_mime_repository_api=>get_api( ).

CALL METHOD mime_repository->get

EXPORTING

i_url = url

IMPORTING

e_content = content.

Instead of this code what I have to do...

Please help me.....

Thanks

Sridhar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I have already given a suggestion for a solution to this exact problem that you described. Instead of using mime_repository->get to read the binary content from the MIME repository you would use the CL_HTTP_CLIENT class to read the content from the remote URL. Once you have read the content all the remaining processing is the same.

Former Member
0 Kudos

Hi Thomas,

Even I used the method...cl_http_client=>create_by_url and I'm getting content value is null.

Thanks

Sridhar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi Thomas,

>

> Even I used the method...cl_http_client=>create_by_url and I'm getting content value is null.

>

> Thanks

> Sridhar

I'm not sure what you want. This class does work and when used correctly will retrive the file content from the Remote URL if the URL truely requires no authentication. I would have to assume that you are doing something wrong.

Former Member
0 Kudos

Hi Thomas,

Please correct me, If I did wrong coding

CALL METHOD cl_http_client=>create_by_url

EXPORTING

url = url

IMPORTING

client = client.

  • here client value is getting

client->request->set_header_field( name = '~request_uri'

value = url ).

client->request->set_header_field( name = '~request_method'

value = 'GET' ).

  • here content is null getting

content = client->response->get_data( ).

Thanks

Sridhar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The coding looks like you are missing the client->send( ). command. You have to issue this before you can call the response->get_data. You are never actually performing the HTTP GET.

If problems persist after this correction you can trace the HTTP connection and see if you are getting an error. Make sure that proxy settings (which would already be maintained in your browser, but generally aren't set in transaction SICF in most ABAP systems) aren't needed to access the URL. Also you may find that some authentication is actually needed.

Former Member
0 Kudos

Hi Thomas,

CALL METHOD cl_http_client=>create_by_url

EXPORTING

url = url

IMPORTING

client = client.

*here client value is getting

client->request->set_header_field( name = '~request_uri'

value = url ).

client->request->set_header_field( name = '~request_method'

value = 'GET' ).

ALL METHOD CLIENT->SEND

EXCEPTIONS

HTTP_COMMUNICATION_FAILURE = 1

HTTP_INVALID_STATE = 2.

CALL METHOD CLIENT->RECEIVE

EXCEPTIONS

HTTP_COMMUNICATION_FAILURE = 1

HTTP_INVALID_STATE = 2

HTTP_PROCESSING_FAILED = 3.

content = client->response->get_data( ).

After execution of client->receive method .. raising http_communication_failure exception.

Please help me out..

Thanks

Sridhar

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

As I said in my previous post, check the HTTP trace logs for more details. An HTTP communication failure would seem to indicate either your URL is incorrect, authentication is needed, or proxy settings are needed. You will have to look at the logs to see more details as to the cause of the exception.

Former Member
0 Kudos

Hi Thomas,

Thanks for your information. but please let me know, how (and where) I can trace HTTP log.

Thanks

Sridhar

Former Member
0 Kudos

Hi Thomas,

i need great help from u, that is i have an excel sheet containing data (suppose 2 fields) and i need to upload it to an internal table using webdynpro abap.can u help me by giving an example.

Have a nice day.

waiting for your reply

thanks.

raja reddy

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi Thomas,

>

> i need great help from u, that is i have an excel sheet containing data (suppose 2 fields) and i need to upload it to an internal table using webdynpro abap.can u help me by giving an example.

>

> Have a nice day.

> waiting for your reply

> thanks.

> raja reddy

First of all it is against the SCN Forum rules of engagment to post new unrelated questions into an existing thread. Your question is for uploading a Excel sheet and this forum post was for displaying an Excel sheet within WDA - two very different things. You should post your question as a new thread. However before you do that, you should search SCN and this forum for solutions, as this question has been asked and answered several times already.

kmoore007
Active Contributor
0 Kudos

What if the file is not an URL, but on my C:\ drive? Will cl_http_client work for a file on the C:\ drive?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> What if the file is not an URL, but on my C:\ drive? Will cl_http_client work for a file on the C:\ drive?

Nope, not unless you are running a webserver on your desktop. The CL_HTTP_CLIENT connects using HTTP or HTTPS from the ABAP-AS to a remote server.

kmoore007
Active Contributor
0 Kudos

Thanks for the reply, Thomas. Soooo, can you throw me a bone? I want to upload the file from a local drive or intranet folder and display it in the office_control. (I'm new to ABAP Web Dynpro...guess you can tell). I could not find an example for doing this combination. Most examples seem to deal with the MIME repository.

Thanks.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It sounds like you need to use the FileUpload UI element. This will upload the content of the file into an XSTRING in memory. From that point forward the process is the same as the examples that used the content from the MIME repository. I guess I'm not sure where your problem lies.

kmoore007
Active Contributor
0 Kudos

Thanks. I will try to piece the two examples together. The problem lies with me being a newbie to ABAP Web Dynpro and ABAP OO and that there is no example of this combo. I am trying to learn...really.

Thanks again.