Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CL_GUI_HTML_VIEWER JavaScript problem

maxim_schibnev
Explorer
0 Kudos
819

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?

1 ACCEPTED SOLUTION

larshp
Active Contributor
0 Kudos
202

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.

2 REPLIES 2

larshp
Active Contributor
0 Kudos
203

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.

0 Kudos
202

Thanks for your answer. I think predefined form with fixed action value and dynamic input set will work for me.