2012 Jan 26 5:00 PM
Hi ,
Is it possible to donwload a file from a URL (ex: http://logosworld.com/www7/books/IDocBook/IDocBook.pdf) into an ABAP program?
If yes, please suggest as to how it can be done.
I tried by FM HTTP_GET_FILE.... but unsuccess....
Thanks,
Naoufel
2012 Jan 27 3:14 PM
Hello:
Do you know the filenames that you are trying to retrieve and the logical path? If so, you can try using function module FILE_GET_NAME_USING_PATH. Singly, pass the filename and the logical path into the corresponding fields of the function module. The export parameter(file_name_with_path) will generate your URL path.
IF you don't know the file names and just have the URL already, you can call CALL_BROWSER with the new_window checked and that will generate a browser session.
Hi ,
Is it possible to donwload a file from a URL (ex: http://logosworld.com/www7/books/IDocBook/IDocBook.pdf) into an ABAP program?
If yes, please suggest as to how it can be done.
I tried by FM HTTP_GET_FILE.... but unsuccess....
Thanks,
Naoufel
2012 Jan 26 5:39 PM
i dont know of a way to do it through abap, so wait for other reponses.
but one alternative is to use unix commands, and calling the unix command in your abap code to invoke the unix command.
unfortunatly even unix doent give you this functionality by default,
so you need wget an utility designed to download files from internet for unix, so your unix adminitrators of you sap ssystem need to install this utility and thn you can invoke this from your program.
2012 Jan 26 6:08 PM
Hi,
Check the below link.
<removed by moderator>
Cheers,
Raja.D
Moderator message: please do not post just links, explain why it is relevant when posting one.
Edited by: Thomas Zloch on Jan 27, 2012
2012 Jan 27 9:19 AM
2012 Jan 27 3:14 PM
Hello:
Do you know the filenames that you are trying to retrieve and the logical path? If so, you can try using function module FILE_GET_NAME_USING_PATH. Singly, pass the filename and the logical path into the corresponding fields of the function module. The export parameter(file_name_with_path) will generate your URL path.
IF you don't know the file names and just have the URL already, you can call CALL_BROWSER with the new_window checked and that will generate a browser session.
2012 Jan 30 9:07 AM
Hello
I don't know the the path, i only have the url
I have to download the document by this url....
thanks
Naoufel
2012 Jan 30 4:48 PM
Hi,
Try the code bellow.
If your server connects to URL through a proxy server then you need to specify the proxy settings
If your URL is protect by user name and password you need to fill USER and PASSWORD parameters.
DATA: lv_docid(80).
lv_docid = 'C:\my_file.pdf'.
CALL FUNCTION 'HTTP_GET_FILE'
EXPORTING
absolute_uri = 'http://logosworld.com/www7/books/IDocBook/IDocBook.pdf'
* RFC_DESTINATION = 'SAPHTTP'
" proxy = 'proxyserver:proxyport'
" proxy_user = 'proxy_username'
" proxy_password = 'proxy_password'
* USER =
* PASSWORD =
document_path = lv_docid
* TIMEOUT =
IMPORTING
status_code = lv_code
status_text = lv_code_text
* TABLES
* REQUEST_HEADERS =
* RESPONSE_HEADERS =
EXCEPTIONS
connect_failed = 1
timeout = 2
internal_error = 3
document_error = 4
tcpip_error = 5
system_failure = 6
communication_failure = 7
OTHERS = 8
2012 Jan 30 5:20 PM