cancel
Showing results for 
Search instead for 
Did you mean: 

MVC Creating (Custom-/Fake-HTMLB) Event for SubController

vritzau
Participant
0 Kudos

Hi experts,

I have the following requirement:

I want to create in main controller an event that triggers the same action like a mouse click on a htmlb_link. So that while going through the normal dispatch_event( ) an event for subcontroller_2 is created and followed like a normal link event in htmlb.

BSP Application like this

creating

Maincontroller -> subcontroller_1

-> subcontroller_2

calling calling

Maincontroller -> index.bsp -> list_view

-> content_view

I'm reading a URL-Paramter in MainController (like: product=XYZ) and I want to react in subcontroller_2 with getting some data and displaying the appropriate view, which I normally get, when I click a link on another page in subcontroller_1 which is an htmlb_event, type link which says show_XYZ.

So when I get the URL Param, I can prepare the data for displaying but I cannot trigger the same event like "htmlb_event:link:click:null" , like it is triggered when the link is clicked by user and processed the normal way in dispatching through dispatch_input() in maincontroller and do_handle_data, do_handle_event, do_finish_input in sub_controller.

Hope the situation is somehow clear.

Here my questions:

1) Is it possible to create an htmlb_like event without user interaction?

2) If 1 is not possible how can I create an custom_event which is triggered in dispatch_input() of maincontroller (inheriting from cl_bsp_controller2)? Because now maincontroller is leaving while checking for events ...

CL_BSP_CONTROLLER2->dispatch_input().


*  do nothing, if no event is found
  if request->get_form_field( event_name ) is initial.
    return.
  endif.

Thank you for any advice.

Best regards

Volker

Edited by: Volker Ritzau on Aug 5, 2009 12:47 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

athavanraja
Active Contributor
0 Kudos

1. yes. you can do using <bsp:htmlbEvent tag.

Refer this blog for more details

[BSP In-Depth: Using the HTMLB Event System|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/634] [original link is broken] [original link is broken] [original link is broken];

vritzau
Participant
0 Kudos

Thanks for your reply,

I read through the blog before and it is not exactly what I thought wanted to do, but it is probably the right way?

I thought I can trigger event from maincontroller with a standard method like event_initialize ... or something.

But when I understand the Blog correct and the underlying htmlb_events, I just have to fire the <bsp:htmlbEvent> in a view which i call instead of my normal views. Then the event should be triggered.

So I read the URL-Param, call_view new_event_view, fire bsp:htmlb:event and in the next request the event will be processed in normal dispatch_input().

But what remains as question is, how can I fire the bsp:htmlbEvent automatically? Is it enough to do a navigation->goto_page()?

I will go and try it out.

Best regards.

Volker

Edited by: Volker Ritzau on Aug 5, 2009 3:24 PM

Edited by: Volker Ritzau on Aug 5, 2009 3:26 PM