Code: Alles auswählen.
loop at it_data .....
......
......
CALL METHOD cl_http_ext_webapp=>create_url_for_bsp_application
EXPORTING
bsp_application = iv_app
bsp_start_page = iv_page
bsp_start_parameters = lt_params
IMPORTING
abs_url = lv_url.
* Create internal http client
CALL METHOD cl_http_client=>create_internal
IMPORTING
client = lr_http_client
EXCEPTIONS
plugin_not_active = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ev_error = abap_true.
RETURN.
ENDIF.
cl_http_utility=>set_request_uri( request = lr_http_client->request
uri = lv_url ).
lr_http_client->request->set_header_field( name = '~request_method'
value = 'GET' ).
lr_http_client->request->set_header_field( name = 'user-agent'
value = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)' ).
* Send and recieve
lr_http_client->send(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5
).
IF sy-subrc = 0.
lr_http_client->receive(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4
).
ENDIF.
IF sy-subrc <> 0.
CALL METHOD lr_http_client->get_last_error
IMPORTING
code = lv_rc
message = lv_message.
ev_error = abap_true.
RETURN.
ENDIF.
lr_http_client->response->get_status( IMPORTING code = lv_rc
reason = lv_reason ).
IF lv_rc = 200.
ev_html = lr_http_client->response->get_cdata( ).
ELSE.
ev_error = abap_true.
RETURN.
ENDIF.
lr_http_client->close( ).
endloop.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
mhsoftware