Encode and Decode URL in ABAP

By | February 23, 2012 | Web Objects | 7,608 | 0

CL_HTTP_UTILITY is an utility class which provides several functions related to URL manipulations. There are many methods available in it, the one which I would like to share here is IF_HTTP_UTILITY~ESCAPE_URL and IF_HTTP_UTILITY~UNESCAPE_URL.

The method ESCAPE_URL does the URL encoding and the method UNESCAPE_URL does the URL Decoding as mentioned below:

URL Encoding & Decoding

 
 
Report YURL.
DATA:v_unescaped TYPE string,
     v_escaped   TYPE string,
     v_return_code TYPE i.
 
START-OF-SELECTION.
***********Example for URL encoding
  v_unescaped = 'HTTP://ZEVOLVING.COM/'.
  v_escaped = cl_http_utility=>escape_url(
                unescaped = v_unescaped ).
  v_return_code = cl_http_utility=>get_last_error( ).
  IF v_return_code = 0.
    WRITE: 'Encoded URL-',v_escaped.
    SKIP 1.
  ENDIF.
 
***********Example for URL decoding
  CLEAR:v_unescaped.
  v_unescaped = cl_http_utility=>unescape_url(
                  escaped   = v_escaped ).
  v_return_code = cl_http_utility=>get_last_error( ).
  IF v_return_code = 0.
    WRITE: 'Decoded URL-',v_unescaped.
    SKIP 1.
  ENDIF.
 
 

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Kesavadas Thekkillath{3 articles}

Working with AtoS as Systems Analyst. I love coding in ABAP & OO ABAP. Top Contributor in SCN Community Network

Explore all of his 3 articles.

Load comments

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.