I could not find any function to return a URL for a given handler. Bellow is a quickly coded function for this reverse URL mapping, but please post if you know some better way to do it.
function y_http_get_url_from_handler.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_HANDLER) TYPE ICF_HAND
*" EXPORTING
*" REFERENCE(ET_URL) TYPE RSR_T_URL
*"----------------------------------------------------------------------
* From the handler name returns a list of configured URLs in ICF for
* that handler.
*"----------------------------------------------------------------------
data: lv_protocol type string,
lv_hostname type icmhostnam2,
lv_port type icmservice,
lv_path type icfurlbuf,
ls_url type rsr_s_url,
ls_service type icfservice,
lt_serverlist type table of icm_sinfo2,
lt_icfhandler type table of icfhandler,
lt_icfservice type table of icfservice.
field-symbols: <ls_server> type icm_sinfo2.
* find the servername and port
call function 'ICM_GET_INFO2'
tables
servlist = lt_serverlist
exceptions
icm_error = 1
icm_timeout = 2
others = 3.
* first choose http protocol
read table lt_serverlist assigning <ls_server>
with key protocol = '1' active = 'X'.
if sy-subrc = 0.
lv_protocol = 'http://'.
lv_hostname = <ls_server>-hostname.
lv_port = <ls_server>-service.
else.
* check if available in https
read table lt_serverlist assigning <ls_server>
with key protocol = '2' active = 'X'.
if sy-subrc = 0.
lv_protocol = 'https://'.
lv_hostname = <ls_server>-hostname.
lv_port = <ls_server>-service.
endif.
endif.
* read the configured services in ICF for the given handler
select * from icfhandler
into table lt_icfhandler
where icfhandler = iv_handler.
if lt_icfhandler[] is not initial.
select * from icfservice
into table lt_icfservice
for all entries in lt_icfhandler
where icf_name = lt_icfhandler-icf_name
and icfparguid = lt_icfhandler-icfparguid.
loop at lt_icfservice into ls_service.
clear: lv_path, ls_url.
call function 'HTTP_GET_URL_FROM_NODGUID'
exporting
nodguid = ls_service-icfnodguid
importing
url = lv_path
exceptions
icf_inconst = 1
others = 2.
if sy-subrc = 0.
concatenate lv_protocol lv_hostname ':' lv_port lv_path
'?sap-client=' sy-mandt into ls_url-url.
endif.
append ls_url to et_url.
endloop.
endif.
endfunction.
answered
19 Sep '11, 12:17
pedrolima ♦♦
1.1k●23●28●40
accept rate:
32%