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

Get input from JavaScript to Webdynpro Context

All,

I've been working with the HTML island UI element to execute JavaScript and have been following the Web Dynpro HTMLIsland & HTMLContainer guide. In the guide it described how to send data from the context into the JavaScript and then display JavaScript alert messages with the content of the context. Is it possible to bring a value from JavaScript back into the context of WebDynpro?

Thanks!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Apr 21, 2014 at 03:20 AM

    Hi Johnson,

    Yes, its possible to bring data from java-script file to WD via callback event.

    callback.fireEvent('myEvent','dataString');

    The above method signature has the parameter DATA of type string, through which the data of java script can be passed back to web dynpro.

    You need to create an event in web dynpro for HTML element and use DATA parameter to bind back to context node.


    Please refer page 20 to find out the details of callback function in Web Dynpro HTMLIsland & HTMLContainer

    Hope this helps you.

    Regards,

    Rama

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 27, 2015 at 10:02 AM

    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-edd4e63d9814?overridelayout=t…

    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

    Add a comment
    10|10000 characters needed characters exceeded

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.