Skip to Content
author's profile photo Former Member
Former Member

Triggering data transfer when leaving a page


I want to control a bsp-application (running in a browser in the GUI) from the program which started the application.

1) The control information can be transferred to the bsp via parameters in an url to the same bsp (or is there a better way?)

2) When an new 'control-url' is sent to the bsp the data in the view is not transferred to the corresponding fields in the model. How can I force the data transfer? Do I need an 'onUnLoad'-event which triggers the 'normal' methods of the controller? And if so, in which bsp-extension tag can I register this handler?

Regards, Martin

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Sep 16, 2003 at 02:53 PM

    Hallo Martin,

    First, allow me to answer with an ALL UPPERCASE WARNING: the SAPGUI keeps one session on the backend. If you should now run a BSP application inside the HTML control in the SAPGUI, this BSP application will ALWAYS run in another session. This means that you will have two sessions open on the backend. (If the BSP application is stateless, it is not so bad.) It is not easy to exchange information between the two sessions. You can either do it at the front-end, or at the backend via shared memory. (In WebAS 640 you could consider ABAP shared objects.)

    You write: "I want to control a bsp-application (running in a browser in the GUI) from the program which started the application.". I would like to reformulate this sentence: "I want to control a web application (running in a browser in the GUI) from the program which started it." This is not because I would like to remove responsibility away from BSP. But more, I suspect that some documentation reading work is required. Once you understand how the HTML control in the SAP GUI works, and have a working example, we can at what it would take to do the same in BSP.

    Some things you can look at:

    (*) Transaction SE38, program SAPHTML_EVENTS_DEMO.

    (*) Transaction SE80, menu Environment --> Reuse Library. In the tree on the left, look at Controls --> HTML Viewer.

    From your append, points (1) and (2) I don't really understand. The reason is probably that I have never before worked with the HTML control.

    Nevertheless, allow me to write a few comments. You write that you wish the SAPGUI application and the BSP application to interact. I suspect that this will not really be possible. When we look at the above listed examples, we can see that it is easily possible for the browser application to fire information into the SAPGUI program. How is this done? We look at the source (right mouse, View Source), and see this interesting piece of code:

    First Name

    Last Name

    The interesting part here is the "action" for the form. This defines a new type of URI, that seems to be picked up by the SAPGUI.

    Why I think BSP will not work here? The BSP runtime is 100% build on top of the HTTP framework provided by the ICM and ICF. It expects an incoming HTTP request to process, and expects to be running in the HTTP context. However, with the above action, the data is transfered to the SAPGUI, and lands at the backend via the DIAG channel. No HTTP context :(.

    (Of course, you could consider to make a HTTP client request on the backend with these form data back into BSP runtime, but I don't even want to hear about this.)

    So what is still possible? Probably could write you SAPGUI application standalone, and BSP application standalone. If you wish to communicate from BSP application to SAPGUI, just add a second form. Use some clever JavaScript to place all information into hidden input fields in this form, and set the action to SAPEVENT. Submit the form against the SAPGUI.

    Important: I have never done this before, and am moving here on slightly thin ice. If you should build a small test program, we could consider to look at it once more.

    bye, brian

    Add a comment
    10|10000 characters needed characters exceeded

    • A summary for the exchanges behind the scenes, in case someone would wish to do this later.

      The question was, how to tie a save button in the SAPGUI to submit the page in the browser.

      When running in a normal browser, it is very easy to execute JavaScript via URL. Just enter in URL field something such as javascrpt:code;

      However, this is not supported by the HTML viewer control in SAPGUI.

      But there are interesting methods SET_SCRIPT and EXECUTE_SCRIPT on the class CL_GUI_HTML_VIEWER. These allow one to define dynamically a script and execute it in the browser. The script will be something to submit the form.

      Example program: SAPHTML_SCRIPT_DEMO.

      One small hurdle. These methods are protected (don't ask me!), and can not be directly used. You must first define a new class that derive from this class, and then you have access to these methods.


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.