Do_handle_data vs do_handle_event
Hi experts ,
can we explain differences b/w Do_handle_data vs do_handle_event
DO_HANDLE_DATA => This is the very first method that the runtime would come to after user has made inputs on the view or a user action has been triggered. This method has an importing parameter called FORM_FIELDS. You can check this see which field have been changed on the view.
DO_HANDLE_EVENT=> This is the event handler of the controller. From here the controller is routed to the different event handler methods depending on the user actions triggered.
Regards
Kavindra
Similar Messages
-
/SAPDII/DWB - Dealer Workbench
Hi
Im interested to know whether anyone has made any changes to SAPs standard BSPs for the DWB.
I would appreciate any pointers in doing this.
Thanks
FaaiezHi Faaiez,
You can check the online documentation for the dealer portal of which DWB is a subcomponent at :
http://kwhelp.sap.com/SAPIKS/S0cfecba46cae4ce68ce31bb75ee4c46d/KW/IWB_STRUCTE8EFB83BEB837443E10000000A11402F/IWB_EXTHLP361B6D3E40753F7CE10000000A114084/?LANGUAGE=EN&RELEASE=50_2003_Q2&IWB_INDUSTRY=EP_CONTENT&IWB_COUNTRY=&TMP_IWB_TASK=DISPLAY
In general though, enhancing the bsp application for dwb and other applications within the dealer portal is hassle free.
1.Copy the application to your own namespace.This copies views, pages with flow logic and controller but points to the the original controller and application classes so the business logic is unchanged and untouched.
2.After this you can make the changes you require to the ui.
3.Naturally if you add new interface elements you will have to ensure that the do_handle_data and do_handle_event menthods of the controllers have the necessary code to receive data and handle events triggered by the new elements. But there are BADI's in place in the respective methods for this.
4. Call the application with the new url in the main controller.You'll notice it contains the new application name in the url.
Footnote:If creating new views in the SAP namespace is an option, its also possbile to replace one view in the application with another using transaction /SAPDII/T_CCOMPID and /SAPDII/T_CCOMPSET.
There is a customizing cookook available which can be made avaiable to you on request. But I would recommend creating a low priority oss message for this on the component IS-A-DP-VMS so that its tracked and picked up by the original developer.
Regards,
Rana -
Input processing in Sub-Controllers ?
Hi All,
I am working on a BSP using MVC, the app has main_CTRL which calls a main_view ->
which is a htm page with three frames F1, F2, F3.
F1 and F2 have header details and menu items.
When user clicks on the menu item on F2, it opens the corresponding view on F3.
The view for F3 is opened using SUB_CTRL3
F3 takes input from the user and on clicking a button, should post the data into SAP.
The issue is that the dispatch_input ( ), calls do_handle_data and do_handle_event
only for the main_CTRL and not for sub controllers?
Is there a way in which you can invoke do_handle_data and do_handle_event at
sub controller level - SUB_CTRL3?Hello Chen,
You need to make the changes in your code logic to activate the Sub-controller active . I think In your current application you are making only the main controller as a active controller.
Hope this helps.
Thnaks,
Greetson -
Pop Up Error using MVC method after Validation in DO_HANDLE_EVENT Method
Hi Experts,.
I am rather new to BSP applications and I am working using MVC at the moment. I have a requirement which apparently is simple, but am yet to get that done successfully.
I have a couple of buttons on my BSP View screen, on click of these buttons, the User Name would be verified with entries in a Custom table and if the User Name is not found, an error message would pop up stating, "You are not Authorized to use this option".
On click of the button, the event which is triggered is handled in the DO_HANDLE_EVENT Method of the Controller for the view.
The check is performed in that method. Thereafter the method DO_REQUEST follows automatically which loads the view yet again. I want to throw a pop up error message at this instance if the User Name was not the authorized one.
I have used Java Script to throw pop up message but only in case of field content validation where I did not need to navigate away from the view for the validations. But how do I bo about for this example.
Any help would be highly appreciated.
Regards,
SubhrangsuHi
1. You can call the view in pop-up because you will be calling the controller using open.window.
Here is the sample code:
method DO_REQUEST .
data:
li_vw type ref to if_bsp_page,
lv_form_field type string,
li_md type ref to zcl_model01.
dispatch_input( ).
li_md ?= get_model( 'm01' ).
lv_form_field = request->get_form_field( 'invoice_create' ).
if lv_form_field is initial.
*------ Request to display main page
li_vw = create_view( view_name = 'main.htm' ).
li_vw->set_attribute( name = 'model' value = li_md ).
call_view( li_vw ).
elseif lv_form_field eq 'true'.
*------ Request to display Invoice page in pop-up
li_vw = create_view( view_name = 'invoice.htm' ).
li_vw->set_attribute( name = 'model' value = li_md ).
call_view( li_vw ).
endif.
endmethod.
Layout :
function do_Invoice()
{ var s=0; r=1; w=300; h=300; x=screen.width/2;
x=x-w/2;
var y=screen.height/4;
y=y-h/2;
popUp=window.open('main.do?invoice_create=true','win','width='+ w
+',height='+ h +', left=' + x +',top='+ y +');
Regards,
G. Nikhil Kumar -
hi Experts,
i have writen a select query on the event of button click in do_handle_event.but ,it gets activated,but while executing it gives me an exception error on select query line.....
so where should i write the select query....
IF EVENT_ID EQ 'submit'.
select single fldate seatsocc into it_air from sflight
where CONNID = '0017'. " a_code.
navigation->goto_page('cont2.do').
plz suggest sumthng....
Message was edited by:
vaishali ranaHi Vaishali,
Check the below code.
TYPES: BEGIN OF T_FLIGHT,
FLDATE TYPE SFLIGHT-FLDATE,
SEATSOCC TYPE SFLIGHT-SEATSOCC,
END OF T_FLIGHT.
DATA: X_AIR TYPE T_FLIGHT.
SELECT SINGLE FLDATE
SEATSOCC
INTO X_AIR
FROM SFLIGHT
WHERE CONNID = '0017'.
In your code IT_AIR must not be an internal table. It should be a structure or a work area. Because you are selecting a single record.
Your structure must have only two fields( FLDATE and SEATSOCC ) if you are selecting in the above mentioned way.
Please make sure that your structure is in propper format.
Please close the post if it solves your problem.
Thanks,
Sreekanth Gollamudi -
Dear Experts,
when changing the field CONC_KEY-BTN in view BTSHeader in component ICCMP_BTSHEAD (Interaction Record Component)
the method DO_HANDLE_EVENT of the view controller is called.
The standard coding of the method is:
method DO_HANDLE_EVENT.
* Eventhandler dispatching
CASE htmlb_event_ex->event_server_name.
WHEN others.
global_event = super->do_handle_event( event = event
htmlb_event = htmlb_event
htmlb_event_ex = htmlb_event_ex
global_messages = global_messages ).
ENDCASE.
endmethod.
The component ICCMP_BTSHEAD is used in component ICCMP_BT_INR. Also visible in component ICCMP_BT_INR is the component ICCMP_BT_FOUP (View:CREATEFOLLOWUP) used to create Follow-Up Documents like Service Tickets.
What I want to is that, if the value of the field CONC_KEY-BTN is '1', the fields of the view CREATEFOLLOWUP follow-up-document have to be not modifiable. If the value of field CONC_KEY-BTN is '2' the fields are modifiable and it is possible to create a Follow-Up Document. That is my basic requierement. Better would be if the view CREATEFOLLOWUP would not visible if the value of the field CONC_KEY-BTN is '1'. But that would be more difficult I think?
To make the fields not modifiable, I think I have to modify the Get and Set Methods of the specific Atributes. But my problem is how can I modify the above mentioned method 'DO_HANDLE_EVENT' (View: BTSHeader) so that the event 'DO_HANDLE_EVENT' of the view controller of view CREATEFOLLOWUP is called at the same time (The problem is that the 'DO_HANDLE_METHOD of view CREATEFOLLOWUP is not called when changing the field CONC_KEY-BTN of the view BTSHeader ).
Best Regards
OliverHi Oliver,
In my opinion, the logic is not to be controlled at the do_handle_event level. ICCMP_BT_FOUP is created as a component usage right? So in the component ICCMP_BT_INR, there will be a navigation link defined with source as outbound plug of ICCMP_BT_INR and target as inbound plug of ICCMP_BT_FOUP. In this outbound plug, you can fill the param IV_DATA_COLLECTION as follows:
data: lr_current type ref to if_bol_bo_property_access,
lr_col type ref to if_bol_bo_col.
lr_current = me->typed_context->YOUR CONTEXT NODE->collection_wrapper->get_current( ).
check lr_current is bound.
create object lr_col
type
cl_crm_bol_bo_col.
check lr_col is bound.
lr_col->add( lr_current ).
Now pass this collection to the target inbound plug.
In the inbound plug of the target, you can control the logic based on the value of the attribute field in the collection.
I think this should work.
Regards,
Nisha -
Prevent save with the DO_HANDLE_DATA methode
Hiii,
I want to check some input values with the methode DO_HANDLE_DATA method. After pushing the save button, I check the input values and if the input values does not match certain criteria, I throw an error message with the following code:
global_messages->add_message(
condition = co_cancel_event_prefix
message = TEXT-010
severity = cl_bsp_messages=>co_severity_error ).
dummy = me->component_id ).
At the first time, It is possible to prevent save the input values but if I push the save button again, the input values are saved. The method DO_HANDLE_DATA is not invoked again.
I have not the possiblitiy to redefine an event like EH_ONSAVE, that will be invoked every time when pushing the save button.
Could anyone explain me, how to solve my problem? Should I use a different method instead of DO_HANDLE_DATA?
Kind Regards,
JohnHi Harris,
Although the DO_PREPARE_OUTPUT would be triggered, normally we dont code the before save logic there. Its recommended to put the logic in EH_OnSave or other such event handlers.
I am not aware of your exact scenario but normally you can get an instance of your context node in Eh_OnSave using the following template if the eventhandler is at the view controller impl class.
me->typed_context-><<Context Node>>->collection_wrapper->get_collection( )
Otherwise if your context nodes are bound to custom controller,you can get to the typed context node via custom controller instance
lr_cuco TYPE REF TO <<CustomController Impl class>>
lr_cuco ?= get_custom_controller( '<<Name of CuCo>>' ).
lr_entity ?= lr_cuco->typed_context-><<Your Context Node>>->collection_wrapper->get_current( ).
Hope this helps.
Regards,
Nisha -
Global_message in do_handle_event
Hi experts,
I think I have a pretty easy question:
I use the global_message parameter in the do_handle_event of my controller.
My question is:
How can I access my messages in my views to put out error messages or systemmessages?
I tried it with:
1) page->messages->assert_message ...
2) passing attribute messages of controller to view sideattribute ...
but both did not work.
Any suggestions?
Best regards Volker
**do_handle_event**
* error handling
if lv_errmsg is not initial.
data lv_errmsg2 type string.
concatenate 'Fehler:' htmlb_event->name ';' htmlb_event->server_event '; Nachricht:' lv_errmsg into lv_errmsg2 separated by space.
global_messages->add_message( condition = 'user'
message = lv_errmsg2
severity = 1 ).
endif.
**user_view**
<htmlb:textView text = "<%= <b>page-></b>messages->assert_message( 'user' ) %>"
encode = "true"
textColor = "red" />Hi Volker,
I always use the MESSAGE attribute of the controller - that is automatically known in the page:
me->message->add_message( condition = 'user'
message = lv_errmsg2
severity = 1 ).
I never used the methods parameter but I would guess you can share messages between subcontroller whereas subcontrollers all point the same instance as main controller's attribute MESSAGE.
Regards,
Sebastian -
MVC: DO_HANDLE_EVENT
Ok this is a silly one and I'm just too close to it I think.
I have a View/Controller: header.htm/header.do and one View/Controller: admin.htm/admin.do
In my header I put a dropdownlist and I call header from inside my admin.do
<bsp:call url="header.do" comp_id="hd" />
But the DO_HANDLE_EVENT for header.do never activates when I select from the dropdownlist only DO_REQUEST, dispatch_input( ) never goes into DO_HANDLE_EVENT??
What am I doing wrong?OK I am calling ADMIN.DO via the URL
ADMIN.DO loads the VIEW "admin/default.htm" which has a BSP call
<%@page language="abap" %>
<%@extension name="bsp" prefix="bsp" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title="Solution Central" >
<htmlb:form method = "POST"
id = "frmDetail" >
<bsp:call comp_id = "hd" />
<htmlb:group id = "myG"
design = "sapcolor"
tooltip = "Input selection"
width = "100%" >
<htmlb:groupHeader>
<htmlb:textView text = "Administration Tasks"
design = "HEADER1" />
</htmlb:groupHeader>
<htmlb:groupBody>
</htmlb:groupBody>
</htmlb:group>
<xhtmlb:protectDoubleSubmit text = "Loading..."
active = "true"
title = "Please Wait" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
The DO_INIT of ADMIN.DO (ZCL_C_ADMIN)
model ?= create_model( class_name = 'ZSC_CL_M_MAIN'
model_id = 'mf' ).
header_controller ?= create_controller( controller_name = 'header.do'
controller_id = 'hd' ).
DO_REQUEST (ADMIN.DO)
* Object definitions
data: iterator TYPE REF TO ZSC_TABLE_ITERATOR_SYSTEMS.
* Create objects
CREATE OBJECT iterator TYPE ZSC_TABLE_ITERATOR_SYSTEMS.
* Create pointer to model
model ?= get_model( 'mf' ).
* Data definitions
data: default_view type ref to if_bsp_page.
* Start event handling
dispatch_input( ).
* Create view
default_view = create_view( view_name = 'admin/default.htm' ).
* Call view
call_view( default_view ).
DO_REQUEST (HEADER.DO)
* Data definitions
data: default_view type ref to if_bsp_page.
* Create view
default_view = create_view( view_name = 'header.htm' ).
* Set Attributes
default_view->set_attribute( name = 'lv_name'
value = m_usrname ).
default_view->set_attribute( name = 'lv_fullname'
value = m_usrfullname ).
default_view->set_attribute( name = 'lv_lang'
value = m_usrlang ).
default_view->set_attribute( name = 'lv_lang_graphic'
value = m_usrlang_graphic ).
default_view->set_attribute( name = 'lv_id'
value = m_usrid ).
default_view->set_attribute( name = 'lv_dept'
value = m_usrdept ).
default_view->set_attribute( name = 'lv_global_menu'
value = m_global_menu ).
* Call view
call_view( default_view ).
My page displays wonderfully and I see everything with all my data.
It's just not jumping in to process that dropdownlistBox
<phtmlb:comboBox id = "MyGlobalMenu"
table = "<%= lv_global_menu %>"
nameOfKeyColumn = "menu_id"
nameOfValueColumn = "menu_img"
nameOfValue2Column = "menu_text"
onSelect = "MyGlobalMenuSelect" />
Here the code is ComboBox but either way. The DO_HANDLE_EVENT just doesn't fire. -
Trigger DO_HANDLE_EVENT
All,
I have 2 BSP appl, one with flow logic say ZFL & another one MVC say ZMVC. When I execute the ZFL, I wanted to navigate to ZMVC & trigger particular event(DO_HANDLE_EVENT) of ZMVC & control should remain in ZMVC.
Hope this is clear. How to achieve this?
Pls guide me..
Regards,
BMDurai Raj,
without any user action in ZFL/page ? --->Yes
do you want to show the ZMVC page to user or automatically the ZMVC page should trigger DO_HANDLE_EVENT upon loading ZMVC page? --> I wanted to trigger the DO_HANDLE_EVENT automatically and outcome will be shown to user.
And one more, I dont wanted to show any page from ZFL.
Regards,
BM -
Hi ,
In my DO_REQUEST i tried to modify the tableview sort...but its not getting triggered....
UPDATE SORTING
DATA: lv_id TYPE string.
DATA: lr_table_view TYPE REF TO cl_htmlb_tableview.
DATA: lr_tbl_view_event TYPE REF TO cl_htmlb_event_tableview.
lv_id = me->get_element_id( 'tp' ).
lr_table_view ?= cl_htmlb_manager=>get_data( request = request
name = 'tableview'
id = lv_id ).
IF lr_table_view IS BOUND.
lr_tbl_view_event ?= lr_table_view->data.
lr_tbl_view_event->column_key = mr_model_assign_sb_list->mv_column_key.
lr_tbl_view_event->sortcolumntype = mr_model_assign_sb_list->mv_sortcolumntype.
ENDIF.
Thanks and Regards,
BindiyaHi,
The easiest way to modify the screens in the Std transactions using ITS is to modify the ITS templates corresponding to that transaction.
E.g In you case,there will be a ITS service corresponding to the ESS transaction.This ITS service will have number of HTML templates which will actually correspond to the diffrent screens in the Trascn.What you need to do is find out the HTML template in the ITS service which corresponds to the screen(which you want to modify) in the STd transacn.To do this ,the easiest way is to right click on that Web page and say VIEW SOURCE.It will show you a HTML code with the ITS service name and the template which is being used for that particular screen.
So after you find out the correct HTML template to be modified,you can simply hide the fields by putting the HTML code lines in between the symbols
<! and -->
BR,
Disha.
<b>Pls reward points for useful answers.</b> -
On press enter what function should call for DO_HANDLE_EVENT
hi
I want to do operations on press enter so wat is the
code for press enter?
And how i get this event in ONINPUTPROCESSING .
and i m using HTMLB
ThnksHi Prashant,
What kind of operations..is it for an inputfield?If yes then you can use the attribute SubmitOnEnter of inputfield.
or you can handle the enter key event using javascript.
Have a look at
[this thread|Re: Hitting the "Enter" Key] and [this thread|How to submit the page on hitting the enter key]
Serach forum , there are lots of threads on this.
Regards,
Anubhav -
Issue with tableview data storing
Hi,
We are using MVC model, it has view-model-main controller and sub controller. I am displaying
4 columns on the tableview where 2 columns are editable. when i click update button on the screen
i have called do_handle_event method on sub controller, when i debug the code i am getting
table as initial always. I am not sure what am i missing here..can any one help me ?
Here is code
method DO_HANDLE_EVENT
data: o_event type ref to cl_htmlb_event,
visible_row type int4,
visible_last_row type int4,
visrow_count type int4 value 10,
it_osha like line of it_mfgprf_osha,
wa_osha type zpp1_mfgprf_osha,
o_app type ref to zcl_mfg_perf.
o_event = cl_htmlb_manager=>get_event( request ).
if o_event is not initial.
if o_event->id = 'osha_update'.
data: tv type ref to cl_htmlb_tableview.
tv ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'tableView'
id = 'it_osha_history' ).
if tv is not initial.
data: tv_data type ref to cl_htmlb_event_tableview.
tv_data = tv->data.
if it_mfgprf_osha is not initial.
visible_row = tv_data->visiblefirstrowindex.
visible_last_row = visrow_count + visible_row - 1.
loop at it_mfgprf_osha into it_osha
from visible_row to visible_last_row.
it_osha-zosha_ytd = tv_data->get_cell_value(
row_index = sy-tabix column_index = 3 ).
endloop.
endif.
endif.
endif.
endif.
view
<htmlb:tableView id = "it_osha_history"
table = "<%=o_app->it_mfgprf_osha%>"
iterator = "<%=o_cont->osha_iterator%>"
headerText = "OSHA History"
headerVisible = "True"
sort = "SERVER"
onHeaderClick = "sort"
visibleRowCount = "10"
width = "100%"
design = "ALTERNATING"
allRowsEditable = "<%=o_app->ALLOW_RECORD_EDIT%>" />
Thanks!
LakshmikandhHi Guys,
Thanks for valuable suggestion. Let me give you over view of application. We have sub-controller
for all views, one controller and one model for those sub controllers and views.
Hi Sebastian,
Are you suggesting to use new model for all table view iterator ?
If i use iterator on that one model i can't use
that for other table view iterator..right ?
Hi raju,
If i get all the values on 'do_handle_data' method in the controller class, can i use that
for other table view iterator if i create a new table view iterator? can i have some
outline(example coding) of passing those values to sub controller ?
Thanks in advance.
Lakshmikandh -
Data validation at the UI level
Hi
I have a requirement like i need to validate the input data at the UI level.
If the data is valid ,only then it should be allowed to be saved.
If someone knows how to do the same.
I have seen a method DO_VALIDATE_INPUT method in View controller (IMPL) class.No clue on how it is being used.
Regards
LeonHi Leon,
Are you talking about the Webclient as UI or something else??
There are 2 options:
1) You use the Get and Set methods of your context node attributes (The ...CN01 etc classes) (to be found under your IMPL class --> attributes TYPED_CONTEXT(...CTXT class) and in there you should have some ...CN01, CN02, etc. classes. Here are all the GET and SET methods. (you could also go via the views' attributes, this is the shortest way).
Within the Get (put the value in the model) and Set (get the value from the model)methods you could do some checks and show an error.
2) Use the Do_handle_data method of your IMPL class. Once data is entered in the screen, this method is always called when another action is performed (pressing a button). Here you can easily check the content of fields.
3) Use the Do_handle_event method of your IMPL class. This method is called when there is an event that is being triggered (save button is pressed). You can redefine this method and before really saving the data you can perform your checks.
Hope this helps.
Kind regards,
Micha -
Event handling in zranges custom tag
Hi,
I am using the tutorials by Thomas Jung on the ranges. I am faces a very strange problem. I have created that extension. My application framework is like bsp_model application. I have one main controller and two sub controller. when ever I chose any option,
An event is generated and do_Handle_event of main controller is called but ideally the do_handle_event of right controller should be called .Any Explanation about this behavior.
regards
AshishHi Dezso,
> <i>the event handler of the main controller is always called</i>
As far as I know the Do_Handle_Event is called only for the controller in which event has been triggered it may be any sub-controllor or main controllor.
You are right that we dispatch the event through calling method Dispatch_input( ) in the Do_Request( ) method of main controller. Dispatch_Input do the followings...
1. First it calls Do_Handle_Data of sub-controllor's in the same order as they are instansiated in the main controllor and then finally Do_Handle_Data of main controllor is called.
2. Now Do_Handle_Event is called only for the controllor where event is triggered.
3 Now Do_Finish_Input is called in same sequence as Do_Handle_Data .
Correct me if I am wrong somewhare till now.
Now let me explaine my problem in detail...
I am using custom tag zranges in a view which is registered to a sub-controllor, I want to trap the event triggered when any option is selected but I am unable to do that. Please suggest me some solution to this prblem.
Thanks and Regards,
Ashish
Maybe you are looking for
-
Phantom Recurring Event on Desktop 6.2.2
I have a recurring weekday event that I deleted a month ago. The original event was back in April 2009. But it still pops up on my Palm Desktop v6.2.2. The alert doesn't occur on my Palm Treo 755. When I click on "Go to Event" it just takes me to tod
-
Installing XP using boot camp with partitiion drive?
I recently re-installed Leopard on my mac, and i decided to partition the drive. Then, when I went to install XP using boot camp it said that it only works with 1 partition! Is there any way round this without re-partitioning my drive? I also have an
-
Logic Express to Pro Tools for mixdown
Hi! Really sorry if this topic has been covered before, but all I can find on the various Logic boards I know of are ways of doing this in Logic Pro that aren't available in Express. My band recorded an EP in Logic Express, which was great, but the e
-
I have an issue with Japanese characters. We have an application that was using NVARCHAR in Oracle 8.1.6 on Windows NT 4.0. There was no problem getting the data from the database. Then we upgraded from NT4.0 to Windows 2000. Under both Operating sys
-
N95 bluetooth services, and firmware
Phone: N95 Firmware: 10.0.018 Nokia PC Suite: 6.81.13.0 Problem: - I am trying to use N95 as a bluetooth control for my PC. There is a Java software (Moccatroller) that has server/PC Java application and client/phone applcation. However, I can not es