get BSP URL parameters – page redirector

Background: I had to write these BSP’s a few times. Once was for a plain vanilla redirector  that got its values pushed from another application and a different time  is when I needed to create a RESTful web service.

What: BSP application ZBSP_REDIR (SAPlink nugget)

How to use:

Under the Event Handler tab within your BSP. Select the “OnRequest” method.

[ABAP]

“For this example, we will be pushing in appname
”  then we will use our make believe business logic
”  and generate a redirection URL based off the
”  appname.

”     Name value pair’s
DATA: lt_HTTPNVP TYPE TIHTTPNVP,
      ls_HTTPNVP TYPE IHTTPNVP.

“Get the URL variables and save them into the table.
runtime->server->request->GET_FORM_FIELDS( CHANGING FIELDS = lt_HTTPNVP ).

“Get the variable from the table
READ TABLE lt_HTTPNVP INTO ls_HTTPNVP WITH TABLE KEY NAME = ‘appname’.

“Save to the Page Attribute which will hold the redirection URL
CASE ls_HTTPNVP-VALUE.
  WHEN ‘redirect_example’.
     redirection_url = ‘http://markszcz.net/get-bsp-url-parameters-page-redirector’.
  WHEN OTHERS.
    redirection_url = ‘http://markszcz.net/’.
ENDCASE.

[/ABAP]

The URL I used to test the was http://***/sap/bc/bsp/sap/zbsp_redir/index.htm?appname=redirect_example

Leave a Reply

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


eight × 3 =