ABAP escape functions

The escape function is used in IT systems to indicate a real value of a character in stead of the control function of the character. Example is the < character which means smaller than, but in HTML is also a control character. For more background read wikipedia.

In ABAP code you sometimes need to set a URL with these characters, or build a HTML text. Then you really need to use these rules.

Documentation of the Esacpe function in ABAP can be found in this URL.

Example is the following code:

cl_demo_output=>display(
  escape( val    = 'IF a < b.'
          format = cl_abap_format=>e_xml_text ) ).

The result will be IF a &lt; b. < is in xml replaced by escape character &lt;.

Demo program

A full list can be found in ABAP program DEMO_ESCAPE. Start the program and select the type you want to check (do select the Show Differences tick box):

Output is now show for the diverse characters:

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.