cancel
Showing results for 
Search instead for 
Did you mean: 

Capturing WD_EVENT from SAP-GUI

Former Member
0 Kudos

Hi gurus,

I've developed an application that works in the browser, separately of the R/3 system.

Now I want embedd it into a control (no problem), and capture some events that user can do. For this reason, I open the wd application with a cl_gui_wdr_viewer, and I've defined an event handler:

CREATE OBJECT wdr_html_viewer

EXPORTING

parent = wdp_html_container.

CREATE OBJECT wdr_inplace_handler.

SET HANDLER wdr_inplace_handler->on_wd_event

FOR wdr_html_viewer.

CLASS cl_wdr_inplace_handler DEFINITION.

PUBLIC SECTION.

METHODS: on_wd_event

FOR EVENT wd_event OF cl_gui_wdr_viewer

IMPORTING action parameters. "#EC NEEDED

ENDCLASS. "cl_wdr_inplace_handler DEFINITION

CLASS cl_wdr_inplace_handler IMPLEMENTATION.

METHOD on_wd_event.

CASE action.

WHEN 'WDR_CLOSE'.

PERFORM leave_wdr_html_viewer.

LEAVE TO SCREEN 0.

WHEN 'WDR_START_TRANSACTION'.

(...)

ENDMETHOD. "on_wd_event

ENDCLASS. "cl_wdr_inplace

But I don't understand what means this ACTION of the case... an action in the main view? But WDR_START_TRANSACTION' is too long...

Thanks inadvance...

Alejandra Fernández

Accepted Solutions (0)

Answers (2)

Answers (2)

TomVanDoo
Active Contributor
0 Kudos

Maybe I'm a bit late with this, but still worth answering.

I was facing the same issue today, but I managed to figure it out.

In the webdynpro, you have to fire an event, but it's not a typical webdynpro event.

You have to fire it from the SAPGUI manager. (which is a WDA api)

wd_comp_controller->wd_get_api( )->get_sapgui_manager( )->fire(

                   name        = 'blah'

                   parameters  = lt_param

).


In the SAP screen, you embed the webdynpro using the CL_GUI_WDR_VIEWER class and you register an event handler for the WD_EVENT.

go_wdr->LOAD_APPLICATION(

  PROTOCOL    = 'http'

  APPLICATION = 'ZTVDO_MATLIST'

).

SET HANDLER lcl_eventhandler=>on_event FOR go_wdr.

in the handler you can then evaluate the event name and parameters

Now I'm pretty sure that I can also get the eventing from gui to WDA working as well. Back to the code!

edit: bingo!

on you WD view, you need to define an action and implement your handler logic there.

in the on_init of the component controller, you have to permit SAPGUI event handling.

wd_this->wd_get_api( )->get_sapgui_manager( )->SUBSCRIBE_EVENTS( abap_true ).

in your SAPGUI application, you can then fire an event to WDA:

     go_wdr->fire_event( WDR_ACTION = 'SET_DATA'

                         parameters = lt_param ).

edit2: however, I should note that, apparently, SAP no longer supports the CL_GUI_WDR_VIEWER.

so, yay for a funky solution, but booh for it not being allowed

Former Member
0 Kudos

Hi Tom,

i can't find the Statement of SAP that  CL_GUI_WDR_VIEWER is no longer supported.

SAP uses it in Transaction WDYID and the calss itself seems not to be deprecated.

best regards,

Michael

TomVanDoo
Active Contributor
0 Kudos

After 2 years, I can't remember where I got the information from

But after a bit of googling, I came across a reply of Thomas Jung (product owner of WDA at the time)

Former Member
0 Kudos

Hi

Check the SAP demo program DEMO_GUI_WDR_VIEWER1 to know how to integrate WD ABAP application in an SAP Container and capture events.

Regards,

Trikanth Basetty

Former Member
0 Kudos

Thanks for your answer,

but this program is not in my system. Could be it come with EnhPackage1, it's not still installed on my system.

I will become crazy, I think it must not be so difficult!! I need only understand how the wd component fire the wd_event of the class CL_GUI_WDR_VIEWER.

thanks again,

Alejandra Fernández