For various needs using http requests could be a life saver. Here is a simple code snippet.
data : lv_value type string.
data : http_client type ref to if_http_client .data : lv_url type string.data : return type string.
data : lv_err_string type string ,lv_ret_code type sy-subrc .
* Build Url
lv_valueinto lv_url.* Create Clientcall method cl_http_client=>create_by_urlexportingurl = lv_urlimportingclient = http_client.* Sendcall method http_client->sendexceptionshttp_communication_failure = 1http_invalid_state = 2.* Receivecall method http_client->receiveexceptionshttp_communication_failure = 1http_invalid_state = 2http_processing_failed = 3.if sy-subrc ne 0.http_client->response->get_status(importingcode = lv_ret_codereason = lv_err_string).message lv_err_string type 'I'.endif.* Now we have the response , parse , display* do what you likereturn = http_client->response->get_cdata( ).
I get the error "http_communication_failure" after calling the method http_client->receive..
ReplyDeleteAny idea about how to solve this problem?
Thank you
Andrea
Hi Andrea ,
DeleteI think, SAP Server that you're working on has no internet connection. You can check it by running any demo browser report (such as SAPHTML_DEMO1) .
Hi,
DeleteI am also facing the same issue. when I run the report SAPHTML_DEMO1, I am successful in opening any webpage.
Jashua
Thanks you! Thank you!!!!!
ReplyDelete