07-03-2015 9:30 PM
hi,
is it somehow possible via function module or class/method to check if a given URL is valid ?
Problem is:
in MSS i display photos of employees from intranet-server of customer:
for example:http://www.intranetserver.com/Employees/12345678.jpg -> 12345678 stands for the personnell number.
Some employees don't have a photo, so the url can't be found as there is no photo on intranet-server. When put the URL into browser i get error 404 (page not found) back.
but how can i check if this URL is valid inside abap-coding ? i have to do some other coding when url does not exist, and i need this before.
br Martin
07-04-2015 7:57 AM
try using cl_http_client, something like the following ABAP code should do the trick,
DATA: li_client TYPE REF TO if_http_client.
DATA: lv_code TYPE i.
cl_http_client=>create_by_url(
EXPORTING
url = 'http://www.intranetserver.com/Employees/12345678.jpg'
IMPORTING
client = li_client ).
li_client->send( ).
li_client->receive( ).
li_client->response->get_status(
IMPORTING
code = lv_code ).