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: 

Get file from a URL using ABAP

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

7 REPLIES 7

former_member205763
Active Contributor
0 Kudos

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.

0 Kudos

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

saravanan_a
Active Participant
0 Kudos

This message was moderated.

Former Member
0 Kudos

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.

0 Kudos

Hello

I don't know the the path, i only have the url

I have to download the document by this url....

thanks

Naoufel

0 Kudos

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

0 Kudos

Hi eacezar !!

It's Perfect !

Thank you very much !!!

Naoufel