2014 Mar 25 1:11 PM
Hey Experts,
i got a requirement where i have to check if an URL is available.
I alredy used
CL_GUI_FRONTEND_SERVICES=>EXECUTE
CL_GUI_FRONTEND_SERVICES=>FILE_EXIS
CL_GUI_CFW=>FLUSH
but without any success....
p.s. it is no problem to open the file, but to check if the URL is there...!
Any Idea?
Thanks,..
Hi Luis,
You are almost there. The returncode value is coming as 0 in both cases but sy-subrc comes as 1 in case URL is wrong.
You can use sy-subrc value and proceed.
BR.
2014 Mar 25 1:57 PM
2014 Mar 25 2:06 PM
2014 Mar 25 6:05 PM
Hello Luis,
Use the class CL_HTTP_CLIENT to create URL, SEND and receive the return code.based on the return code you can confirm on the URL existence. Check below links for reference.
http://scn.sap.com/thread/3213468
http://scn.sap.com/thread/1903058
Regards,
TP
2014 Mar 26 7:39 AM
2014 Mar 28 7:49 AM
Hi Ankit,
i tryed it now.
But it dosent matter if i type www.google.de or www.googlekjdjsjkjdk.de
The one Url exists the other one not. But i all time get the same returncode.
data: client type ref to if_http_client,
url type string,
returncode TYPE sy-subrc.
url = 'http://www.google.de'.
****Create the HTTP client
call method cl_http_client=>create_by_url
exporting
url = url
* ssl_id = page_srv-ssl_id for https
importing
client = client
exceptions
others = 1.
sy-subrc = returncode.
****Make the call
client->send( ).
call method client->receive
exceptions
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
write:/ returncode, sy-subrc.
2014 Mar 28 7:54 AM
Hi Luis,
You are almost there. The returncode value is coming as 0 in both cases but sy-subrc comes as 1 in case URL is wrong.
You can use sy-subrc value and proceed.
BR.
2014 Mar 28 8:20 AM
Sorry? I dont understand what you mean.... 🙂
My returncode here
call method cl_http_client=>create_by_ur
is always 0.
And my returncode here
call method client->receive
is always 1.
If i put a wrong or a right url, all the same...
What do you mean with ''You can use sy-subrc value and proceed''?.
2014 Mar 28 8:28 AM
Hi Luis,
Using wrong URL like - url = 'http://www.googleq1.com'.
Output is -
and using correct URL like url = 'http://www.google.com'.
Output is -
Since Sy-subrc value is changing you can use the same in further logic.
BR.
2014 Mar 28 8:33 AM
I am Sorry, but not with my Code. But it is exact the same as yours.
Maybe the Problem is somewhere als, like the Browser or javascript?
2014 Mar 28 8:37 AM
2014 Mar 28 8:41 AM
Hello Luis,
Did you refer to the links which I have provided where Thomas has explained it clearly.
Regards,
TP
2014 Mar 28 8:44 AM
2014 Mar 28 8:50 AM
Yes, i took his Code.
He also was writing thet WebAS 610 and higher is needed.
Whrere can i proof if i got this level of WebAS?
2014 Mar 28 10:02 AM
Hi,
i created a RFC. But thats not the Problem.
So i dont know what to try next...
Any Idea?
2014 Mar 28 10:05 AM
Hi Luis,
I am short of reasons, wait for other mentors to answer.
BR.
2014 Mar 31 7:15 AM
2014 Mar 31 7:20 AM
2014 Mar 31 7:34 AM
To your Code:
Sorry, but i get this when i test with a right URL ore wrong. No Diffrence.
To cl_http_client:
I alredy work with this CL.
I think the problem is the interface between http and SAP.
Thanks
2014 Apr 01 2:54 PM
Ok, now i got an answer of an sap basis administrator.
Oure SAP System does not allow URL Requests.
So I have to work with an Method where i give the IP, Port and URL with.
Is there a Method for this requirements?
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |