cancel
Showing results for 
Search instead for 
Did you mean: 

How solve problem with HTLM Island and event for return value?

Former Member
0 Kudos

Hi

I would like create function (who return value) in Web DynPro Abap using JavaScript. I found option using HTML Island.

My step are by web site

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9071424e-3724-3010-9b81-edd4e63d9...

site 20-21.

I create script MyHTMLIsland.js who contains

var MyHTMLIsland = {

addCallback: function (callback) {

callback.fireEvent('Event','Hello Web Dynpro'); } };

In WDDOMODIFYVIEW i have

DATA: lo_html_island TYPE REF TO cl_wd_html_island.
        IF first_time EQ abap_true.
            lo_html_island ?= view->get_element( 'HTML_ISLAND' ).
lo_html_island->add_script_call( cl_wd_html_script_call=>new_call( )->variable( 'MyHTMLIsland' )->function( 'addCallback' )->add_callback_api( ) ).
       ENDIF.


I have HTML_ISLAND under this is HTMLEVENT and HTMLSCRIPT

HTMLEVENT have name EVENT and onAction HTML_ISLAND_EVENT

In ONACTIONHTML_ISLAND_EVENT

wd_comp_controller->wd_get_api( )->get_message_manager( )->report_success( data ).


HTMLSCRIPT have only source MyHTMLIsland.js


Why this not working? What I have wrong?


Thank you

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

I create copy from WDR_HTML_ISLAND_TUTORIAL.

When I change on MIME file "wdr_html_island_tutorial.js" and append some string e.g. "callback.fireEvent('Event','My test - hello');" and use save change.

When I use test this EVENT - event work, but still write "Hello Web Dynpro" instead "My test - hello".

Why change on js file are dismissed? (When I look to MIME file "wdr_html_island_tutorial.js" - I see change)

Thank you

johannes_konings
Participant
0 Kudos

Hi,

I have adjusted the way you described. For me it works.


These were my steps:

save the file with the Shortcut CTRL + S.

Have you done anything else?

regards,

Johannes

Former Member
0 Kudos

Hi Johannes Konings

Thank you very much for your answer.

I make all thing as you show, but change dismiss.

I use:

righ click - and select CHANGE

then I create change in js file

then I save file (CTRL + S)

then I close file (ALT + F4)

but still not working

I must remove js file. In notepad create new file - but different name. And then import file with different name as before and then working.

Maybe problem in system setting? or problem because I create program in other language (not in english)? or because I use TMP package?

And second but very important problem is with event because not return event.

When I create own web dynpro application (not copy from demo) and import only "wdr_html_island_tutorial.js", use all method and setting like in WDR_HTML_ISLAND_TUTORIAL, program working partly.

Function saySomething working, but function addCallback not working.

When I call function addCallbak then cursor still runing (turn blue ring) - but not want finish - not jump to event action "HTML_ISLAND_EVENT"

Than you

Former Member
0 Kudos

Hi

I try make change again. My last logon was a 17.4.

When I logon 20.4. and make change 1 time - it works like you write.

When I make change 2 time (and next time) - did not work

Why change work only in first time? I must clear some buffer or...?

Thank you

Former Member
0 Kudos

Hi

Solution was very simple. I must set up this.

When I make change, change show immediate.

Best regards

Answers (0)