ABAP code to call URL

In ABAP code you might need to reach out to a browser.

The code to call a URL is pretty simple:

DATA ld_url(1000).

ld_url = 'https://www.saptechnicalguru.com'.

CALL FUNCTION 'CALL_BROWSER'
  EXPORTING
    url = ld_url.

Simply construct your URL and use function “CALL_BROWSER”.

For a webdynpro to run in browser use this code:

CALL FUNCTION 'WDY_EXECUTE_IN_BROWSER'
   EXPORTING
     application         = 'ESH_SEARCH_RESULTS_UI'
EXCEPTIONS
     invalid_application = 1
     browser_not_started = 2
     action_cancelled    = 3
OTHERS              = 4.
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING execution_error.
ENDIF.

Application ESH_SEARCH_RESULTS_UI is an example here of a web dynpro.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.