SAP Function Modules

HTTP_GET_FILE SAP Function module - HTTP Get File







HTTP_GET_FILE is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name HTTP_GET_FILE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SFTP
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM HTTP_GET_FILE - HTTP GET FILE





CALL FUNCTION 'HTTP_GET_FILE' "HTTP Get File
  EXPORTING
    absolute_uri =              " c
*   rfc_destination = 'SAPHTTP'  " rfcdes-rfcdest  RFC Destination
*   proxy =                     " thttp-proxy
*   proxy_user =                " thttp-puser
*   proxy_password =            " thttp-ppassword
*   user =                      " c
*   password =                  " c
    document_path =             " c
*   timeout =                   " i
  IMPORTING
    status_code =               " c
    status_text =               " c             Text for status code
* 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   "
    .  "  HTTP_GET_FILE

ABAP code example for Function Module HTTP_GET_FILE





The ABAP code below is a full code listing to execute function module HTTP_GET_FILE including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_status_code  TYPE C ,
ld_status_text  TYPE C ,
it_request_headers  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_request_headers  LIKE LINE OF it_request_headers ,
it_response_headers  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_response_headers  LIKE LINE OF it_response_headers .

DATA(ld_absolute_uri) = 'Check type of data required'.

SELECT single RFCDEST
FROM RFCDES
INTO @DATA(ld_rfc_destination).


SELECT single PROXY
FROM THTTP
INTO @DATA(ld_proxy).


SELECT single PUSER
FROM THTTP
INTO @DATA(ld_proxy_user).


SELECT single PPASSWORD
FROM THTTP
INTO @DATA(ld_proxy_password).

DATA(ld_user) = 'Check type of data required'.
DATA(ld_password) = 'Check type of data required'.
DATA(ld_document_path) = 'Check type of data required'.
DATA(ld_timeout) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_request_headers to it_request_headers.

"populate fields of struture and append to itab
append wa_response_headers to it_response_headers. . CALL FUNCTION 'HTTP_GET_FILE' EXPORTING absolute_uri = ld_absolute_uri * rfc_destination = ld_rfc_destination * proxy = ld_proxy * proxy_user = ld_proxy_user * proxy_password = ld_proxy_password * user = ld_user * password = ld_password document_path = ld_document_path * timeout = ld_timeout IMPORTING status_code = ld_status_code status_text = ld_status_text * TABLES * request_headers = it_request_headers * response_headers = it_response_headers EXCEPTIONS CONNECT_FAILED = 1 TIMEOUT = 2 INTERNAL_ERROR = 3 DOCUMENT_ERROR = 4 TCPIP_ERROR = 5 SYSTEM_FAILURE = 6 COMMUNICATION_FAILURE = 7 . " HTTP_GET_FILE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_status_code  TYPE C ,
ld_absolute_uri  TYPE C ,
it_request_headers  TYPE STANDARD TABLE OF STRING ,
wa_request_headers  LIKE LINE OF it_request_headers,
ld_status_text  TYPE C ,
ld_rfc_destination  TYPE RFCDES-RFCDEST ,
it_response_headers  TYPE STANDARD TABLE OF STRING ,
wa_response_headers  LIKE LINE OF it_response_headers,
ld_proxy  TYPE THTTP-PROXY ,
ld_proxy_user  TYPE THTTP-PUSER ,
ld_proxy_password  TYPE THTTP-PPASSWORD ,
ld_user  TYPE C ,
ld_password  TYPE C ,
ld_document_path  TYPE C ,
ld_timeout  TYPE I .

ld_absolute_uri = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_request_headers to it_request_headers.

SELECT single RFCDEST
FROM RFCDES
INTO ld_rfc_destination.


"populate fields of struture and append to itab
append wa_response_headers to it_response_headers.

SELECT single PROXY
FROM THTTP
INTO ld_proxy.


SELECT single PUSER
FROM THTTP
INTO ld_proxy_user.


SELECT single PPASSWORD
FROM THTTP
INTO ld_proxy_password.

ld_user = 'Check type of data required'.
ld_password = 'Check type of data required'.
ld_document_path = 'Check type of data required'.
ld_timeout = 'Check type of data required'.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name HTTP_GET_FILE or its description.