cancel
Showing results for 
Search instead for 
Did you mean: 

Communication JavaScript - Web Dynpro

Former Member
0 Kudos

Hey there

Im currently tryng to create dynamic html / javascript in a web dynpro component using a Iframe to display the final html/js result.

Now im tryng to achiev something different:

I have a input field (WD component) that i want to fill using a javascript function from the iframe how can i do this?

I already implemented one button where i can do a "top.window.close()" in javascript and he will actually close the window.

Is it possible to reach the input field with DOM and change its value? how can i do this?

There should be a way because if i view the source code while testing i can see the Input field id and events

thanks

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Is it possible to reach the input field with DOM and change its value? how can i do this?

First of all I would highly recommend that you NOT do this. The WD Framework is not designed for direct scripting by outside code. This is NOT supported by SAP. Web Dynpro uses a complex delta handling mechanism and direct access to the HTML DOM will not necessarily trigger a proper update to the context on the backend.

Second you have the problem of security of cross frame scripting. This sort of thing is very restricted within the browser for security reasons.

The SAP recommendation in this situation is to use two separate iViews in a single Portal Page. You would have your WD in one iView and your custom HTML/JavaScript (perhaps as a BSP) in a separate iView. The two iViews can then communicate using Portal Eventing.

Former Member
0 Kudos

unfortunately im not able to usep BSP or Portal Eventing , this seems to be a scripting challenge..

Has anyone done anything similar in the past or can show me the place i can gather the information about it?

Thanks

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

> this seems to be a scripting challenge..

I can not stress strongly enough that you should NOT attempt this approach. Even if you could get it to work (which I have some serious doubts about), this approach is strictly against the design of Web Dynpro. It could break at anytime SAP changes something in the internal rendering of Web Dynpro. It would NOT be supported at all by SAP.

Former Member
0 Kudos

As Jung said before, you should not do this, it's not 'supported' by SAP.

But despite this, you seem to be in the way. I'm not too sure how WDA works (I assume not too different from WDJ), but you will have more work to adapt and create an effective way to process and intercept WD Events in JS than the injection itself.

And once again, SAP will release an upgrade, you kinda have to "re-run" all your Selenium to see if everything you created is still valid.

It's fun for testing purposes, you can make WD be a bit more fancy, but you will suffer a lot to have that... 😃

Hope it helps,

Daniel

Answers (0)