Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

call http url in Abap -> Should not open Browser

Former Member
0 Kudos
678

Hi Friends,

I have a requirement where i need to check whether a perticular http service is running or not. For that i need a some code to call http url from abap and it should not open the browser. If that perticular url is not found or time out then i should know that in program...

Is there any way to do that..

12 REPLIES 12

athavanraja
Active Contributor
0 Kudos
98

answered a similar question in this thread with code sample.

Regards

Raja

0 Kudos
98

Hi,

I have gone through the link. And i have pasted it in Abap program.One problem got solved(No Broeser).But still i am missing something in that code.I am not getting any exception even the url is invalid. I wonder how can i differentiate the valid URL and invalid URL in the Abap code.

Ex: Valid URL:-- http://www.google.com

Invalid URL:- http://172.25.1.118/index.html --> Here the Server is not running so i will get Page can't be displayed error if i open it in Browser...

I hope u understood my requirement... If not please let me know i will explain it in more detail....

0 Kudos
98

you would get the error for invalid url in this portion of the code

http_client->response->get_status(

IMPORTING

code = code

reason = err_string

).

what do you get for code and err_string when its a valid url and when its not?

Regards

Raja

0 Kudos
98

and also in the linked code

if code is initial .

CLEAR result .

result = http_client->response->get_cdata( ).

endif .

comment if code is initial check and just have

CLEAR result .

result = http_client->response->get_cdata( ).

what do you get in result in case of invalid url and in case of valid url

Regards

Raja

0 Kudos
98

Hi Raja,

Here sending the results for both Valid & Invalid URLs

Valid URL: code = 404

response = not found

result = ' ' (Nothing is there)

Invalid URL: Same as Above....

I thought that in send step itself we will get exception if it is invalid URL. Is it so ??????

0 Kudos
98

not after the send step.

so you are saying for both valid and invalid url you are getting 404 error.

right?

when you normally call a internet site from browser, do you have to provide proxy authentication? or any other authentication?

Regards

Raja

0 Kudos
98

Hi Raja,

We don't need to provide any authentication. Any how here i atried to use intranet sites also. but i get the same response for both valid and invalid intranet links....

0 Kudos
98

surprising, it works for me very well.

which version of R/3 are yu using?

Regards

Raja

0 Kudos
98

Hi Raja,

Even it doesn't work for me..

It is giving same error for me also..

Please throw some light on it..

cheers,

Simha.

0 Kudos
98

for this to work ICM (internet communication manager) should have been configured and running.

can you do the following .

go to transaction SICF and expand the tree

defaults_host->sap->public and right click on the node ping and click test. it should open the browser and what do you see in the browser?

Regards

Raja

0 Kudos
98

Hi Raja,

I tried to do the same u said. But when i right click on ping i can't find test. Is there any other way to test ....

0 Kudos
98

just run the following url (after changing the values for host,etc) from browser

http://<abaphost>.<domain>.com:<port>/sap/public/ping

to get the values for http://<abaphost>.<domain>.com:<port>; just go to transaction se80 and choose bsp application option and choose any existing bsp application and then doubl click on a page. on the right side click on the attributes tab and at the end you can find the url

Regards

Raja