Skip to Content

CL_GUI_HTML_VIEWER JavaScript problem

Hello, experts.

I faced a weird problem. Inside of CL_GUI_HTML_VIEWER I use the following JavaScript code to raise POST SAPEVENT:

var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "sapevent:foobar");
  
var field = document.createElement("input");
field.setAttribute("name", "foo");
field.setAttribute("value", "bar");
form.appendChild(field);
document.body.appendChild(form);
form.submit();

In SAP GUI for Windows this works fine. But when I use SAP GUI for Java both POSTDATA and QUERY_TABLE are empty. What could be the problem? And how can it be solved?

UPDATE:

It seems to be some security issue. Once form's action is changed with JavaScript, the form fields are no longer sent to the backend wit SAPEVENT. This happens only in SAP GUI for Java. In SAP GUI for Windows everything works fine. Any ideas how to fix it?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 13 at 09:45 AM

    Hi,

    I did some research a while ago, see https://github.com/larshp/abapGit/issues/1319

    Judging from the changelogs and looking into the JAR file, SAP GUI for Java uses the JavaFX WebView component based on webkit, which has some quirks. I'm not sure how to figure out what is supported, and the exact versions.

    For the above code to work, I guess SAP has to update the GUI, or the Java version has to be updated along with webkit.

    I suggest you consider workarounds, one solution could be to make a BSP page with the code and expose it, but it depends on your exact use case.

    Add comment
    10|10000 characters needed characters exceeded