This website has been archived, it is working in read-only mode.

This website has been archived, it is working in read-only mode.

In the SICF transaction we configure a mapping between URLs and handlers. When rendering an application URL it would be practical to get it from ICF based on the handler name. Is there any function of object call to return the URLs configured to handlers?

asked 19 Sep '11, 12:15

pedrolima's gravatar image

pedrolima ♦♦
1.1k232840
accept rate: 32%

edited 20 Sep '11, 04:41


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.
permanent link

answered 19 Sep '11, 12:17

pedrolima's gravatar image

pedrolima ♦♦
1.1k232840
accept rate: 32%

edited 19 Sep '11, 12:25

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×28
×6
×2

question asked: 19 Sep '11, 12:15

question was seen: 43,636 times

last updated: 20 Sep '11, 04:41