‎2012 Mar 10 2:42 PM
Hi all,
we have a web address pointing to an excel file. Now I want to create program where I give the web address. Program should download the excel file, open it, take the data from different sheets and store them in customer tables.
I think I could open the downloaded excel via desktop office integration and get the data an store them. The missing link is the automatic download from web.
Any good ideas and/or code samples for this purpose?
Warmly welcome!
Regards
Clemens
‎2012 Mar 10 10:20 PM
Hi Clemens Li,
Sound like a pretty cool project, can't say I did anything like this before. However, a little research shows that abap has an 'HTTP_GET' function you could try as well as a few others.
I suppose you could store the Excel file on the web server and do the FTP that way. I think then ABAP has ability to read these excel files as data sets. Anyways, let us know how it goes.
goodluck!
Regards,
sifter
‎2012 Mar 10 10:20 PM
Hi Clemens Li,
Sound like a pretty cool project, can't say I did anything like this before. However, a little research shows that abap has an 'HTTP_GET' function you could try as well as a few others.
I suppose you could store the Excel file on the web server and do the FTP that way. I think then ABAP has ability to read these excel files as data sets. Anyways, let us know how it goes.
goodluck!
Regards,
sifter
‎2012 Mar 13 7:56 PM
Bonjour,
an answer given to me by a friend:
cl_http_client=>create_by_url( EXPORTING url = URL
IMPORTING client = http_client
EXCEPTIONS argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4 ).
http_client->request->set_header_field( name = '~request_method'
value = 'GET' ).
* Use CALL METHOD http_client->request->set_header_field to set header pairs of
* attributes and values
"STEP-3 : SEND HTTP REQUEST
CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
* Reterive the result
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
DATA: http_status_code TYPE i,
status_text TYPE string.
"STEP-5 : Read HTTP RETURN CODE
" Use HTTP return code to make sure data exchange was successful
CALL METHOD http_client->response->get_status
IMPORTING
code = http_status_code
reason = status_text.
"STEP-6 : READ RESPONSE DATA (BINARY MODE)
content = http_client->response->get_data( ).
"STEP-7 : CLOSE HTTP CONNECTION
http_client->close( ).
Cordialement,
Chaouki
‎2012 Mar 13 9:10 PM
.. still extremely buggy this site.
Bonjour Chaouki,
Thanky you for the valuable input. Though I have to admit that I came to a similar solution after some time of googling. Another problem comes up: Obviously the SAP server has restricted internet access so that this access method fails for all pages except INTRANET addresses.
I tried the cl_gui_html_viewer which worked better
‎2012 Mar 13 9:11 PM
Sorry the site logs me off too frequently.
The cl_gui_html_viewe control has my personal local rights but it pops up a 'save local file" dialog. How to avoid this? (Can I set a fixed (local) downloaf path?
Regards,
Clemens
‎2012 Mar 15 10:30 PM
... so more specific the question: Is there a way use a GUI control html class to do the download using the rights of the client?
I could not find a useful way through CL_GUI_HTML_VIEWER.
Regards
Clemens
P.S. Can I reduce the line spacing here?