cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to implement a "logical" URL?

Former Member
0 Kudos

Does SAP provide any equivalent of the FILE transaction and logical file names for URLs?

My BSP application needs to link to different URLs depending on whether its running in development, QA, or production.

I would like to do this in the most flexible way possible -- no code changes when URLs change, no custom tables to store URLs, ...

Best Regards,

Shawn Searcy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Shawn,

I think I understood your problem. I also have ABAP apps where it send an email to the user that has BSP apps link, which can be differ from each system.

What i did is call the following method:

CALL METHOD cl_http_ext_webapp=>create_url_for_bsp_application

EXPORTING

bsp_application = <your BSP app name>

bsp_start_page = <your start page>

bsp_start_parameters = <your start params if any>

IMPORTING

ABS_URL = <your link>.

hope that helps.

Answers (2)

Answers (2)

former_member181879
Active Contributor
0 Kudos

Use transaction SM59 and just define the logical URLs that you want. You can associate with the name the complete destination, port, paths, etc.

In your BSP application just read the data from SM59 and build your URL. Or if you are using the http_client, it can automatically work against SM59 names.

The last part of the puzzle you have been missing: CALL FUNCTION 'RFC_READ_HTTP_DESTINATION'

Former Member
0 Kudos

Not sure I follow, I use all relative links and the BSP is transported from one environment to the other and everything goes with it therefore since everything is relative no concern over what system.

Former Member
0 Kudos

Craig,

My application must link to another application that runs on a different server. For example,

MyApp in development links to http://otherdev/App.aspx

MyApp in QA links to http://otherqa/App.aspx

MyApp in production links to http://otherprod/App.aspx

Logical file names will work, but I was curious as to whether or not there was a more appropriate solution.

Thanks,

Shawn Searcy

Former Member
0 Kudos

I understand what you are wanting but with BSP's you normally only use relative links and therefore never have to worry about what server you are running on.

Or perhaps we are not on the same page so can you give more details?

maximilian_schaufler
Active Contributor
0 Kudos

Hi Shawn,

I don't know exactly what you want to achieve, but maybe this small example to solve a similar task will give you some ideas.

In our system landscape there is a standalone WebAS next to a 4.6B R/3 system, both being present as development and production system.

The WebAS uses RFC to call some programs/function modules on the respective R/3 system. Of course the development WebAS can only access the development R/3, same goes for the productive pendants.

I solved this by simply using a model variable in my application, which I initialize in the beginning, checking which system the application is currently executing on and therefore setting the model variable to the name of the Trusted RFC connection for this system.

Former Member
0 Kudos

Thanks for the replies.

I will try to be more specific in what I am doing (if you promise not to ask why ;-).

My BSP application must link (e.g. via hyperlink or redirect) to an ASP.NET web application running in a completely different landscape of non-SAP servers.

When my BSP application is running in development, I want it to link to the ASP.NET application on the development server in the other landscape.

When my BSP application is running in QA, I want it to link to the ASP.NET application on the QA server in the other landscape.

And so on...

My solution at this point is the following:


<%
        data logical_url  type FILENAME-FILEINTERN.
        data physical_url type FILENAME-FILEEXTERN.
        data redirect_url type string.

        concatenate 'ZEXTERNAL_APP_' sy-sysid into logical_url.

        call function 'FILE_GET_NAME'
            exporting
                logical_filename  = logical_url
            importing
                file_name         = physical_url
            exceptions
                file_not_found    = 1
                others            = 2 .

        if sy-subrc = 0.
            redirect_url = physical_url.
            response->redirect( redirect_url ).
        .
        .
        .

This works fine. The target URL is 1) determined based on the current SAP system ID, and 2) completely externalized from application code.

The purpose of my initial message was to find out if SAP had a "new and improved", and possibly more appropriate, mechanism for accomplishing this.

Regards,

Shawn

Former Member
0 Kudos

OK Shawn, I've got what you are asking now. Max's solution would work a whole let better for you or even simply storing the variables inside of a CLASS by itself if you are not using MVC would save alot of your time.