Skip to Content
Author's profile photo DJ Adams

BSP: Mangled URL Decoder

The BSP mangles URLs. Deep down. In a BSP In-Depth: URL Mangling, Brian McKellar did a splendid job of both feeding hunger for information and increasing one’s appetite. He mentioned the BSP application ‘decode_url’ which shows you what the gunk in the rewritten (mangled) URL actually is. Unfortunately, my free trial WAS system is at release 6.10 and doesn’t contain ‘decode_url’.

“Shame”, I thought, first of all. Then: “Great!”. A perfect excuse to have a rummage around in the BSP’s guts. I was curious as to how this particular thing worked, and spent a pleasant hour or so in my favourite tool, the trusty ABAP debugger (kudos to the debugger team at SAP time and time again!). My aim was to write my own version of ‘decode_url’.

I found a clue in CL_BSP_RUNTIME – I knew it had to be somewhere in the BSP classes, and noticed that ON_CHECK_REWRITE called the suspiciously named CL_HTTP_UTILITY=>FIELDS_TO_STRING. Following the trail, I eventually landed on CL_HTTP_UTILITY=>STRING_TO_FIELDS (well, it *had* to exist, hadn’t it ;-).

After that it was all downhill.

I created a very simple BSP page ‘decode_url.htm‘ which does the job. Not as pretty as the BSP team’s original ‘decode_url’ I’m sure, but hey, it’s only for me.

This is what it looks like in action:

screenshot of decode_url in a browser

Thanks to Brian, I took a small stroll through some of the BSP’s guts, and learnt stuff on the way. I’ve always said the best way to broaden your R/3 and Basis skills is to spend an hour debugging an area that interests you, and this time was no exception. So get out your tools and off you go!

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Brian McKellar
      Brian McKellar
      Hallo DJ,

      Very impressive work! Yes, the best tool has always been a (ABAP:) debugger. And the best man one who can wield that hammer! You have earned a lot of respect with this work (even if it was only to satisfy your curiosity:). This I honour!

      As for the mangling: correct that it is just a ;-separated string of name/value pairs that are base64 encoded.

      As for 620 CD: at this late stage one should consider to wait for 640. It gives a good BSP runtime (with rendering libraries and MVC), plus Web Dynpro ABAP.

      You asked about things learned in ABAP. The two most useful tricks for HTML rendering (learned from the ABAP language group) are:
      (*) The difference between "CONCATENATE s1 ' ' s2 ..." and "CONCATENATE s1 ` ` s2 ...".

      This two things are especially interesting when building JavaScript into a string.

      CONCATENATE `function ` name `() {` CL_ABAP_CHAR_UTILITIES=>CR_LF
      INTO js.

      regards, brian