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
Similar Messages
-
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 -
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 -
Do_handle_data vs do_handle_event
Hi experts ,
can we explain differences b/w Do_handle_data vs do_handle_eventDO_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 -
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 -
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 -
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 -
Step by step bapi for purchase order
hi friends,
i am very new to bapi i have requiremet to upload purchase order
using bapi can any one tell me how to use bapi_po_create
which parameter i hvae to pass .plz do the need ful.
regards
sonuHi Sir,
I am sending you the code in which i have implemented bapi pocreate.Please go through the FM ,you will easily understand it.
Plz do reward if useful.
Thankx.
method do_handle_event.
*CALL METHOD SUPER->DO_HANDLE_EVENT
EXPORTING
EVENT =
HTMLB_EVENT =
HTMLB_EVENT_EX =
GLOBAL_MESSAGES =
RECEIVING
GLOBAL_EVENT =
data: event_id type string.
data zpr_num1 type banfn.
data zreturn type zsn_bapiret2.
data ret type bapireturn-type.
data message type bapi_msg.
data returnval type bapimepoheader-po_number.
data: r_view type ref to if_bsp_page.
data: crt_view type ref to if_bsp_page.
data po_num_head type bapimepoheader.
data zpoheader_it type zbapimepoheader_tab.
data zpoheaderx_it type zbapimepoheaderx_tab.
to add a new item to list
if htmlb_event is bound and htmlb_event->server_event = 'onadd'.
zpr_num = request->get_form_field( 'PRNo' ) .
data: zpr_num3 type banfn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num3.
zpr_num = zpr_num3.
data: temp_tab1 type zrmheader.
delete from zrmheader.
zpoheader-vendor = request->get_form_field( 'Vendor' ) .
zpoheader-purch_org = request->get_form_field( 'POrg' ).
zpoheader-pur_group = request->get_form_field( 'PGrp' ).
zpoheader-doc_type = 'NB'.
zpoheader-item_intvl = request->get_form_field( 'Item' ).
zpoheader-comp_code = request->get_form_field( 'CCode' ).
zpoheader-doc_date = request->get_form_field( 'DocDate' ).
delivdate_new = request->get_form_field( 'DelivDate' ).
temp_tab1-vendor = request->get_form_field( 'Vendor' ) .
temp_tab1-purch_org = request->get_form_field( 'POrg' ).
temp_tab1-pur_group = request->get_form_field( 'PGrp' ).
temp_tab1-doc_type = 'NB'.
temp_tab1-item_intvl = request->get_form_field( 'Item' ).
temp_tab1-comp_code = request->get_form_field( 'CCode' ).
temp_tab1-doc_date = request->get_form_field( 'DocDate' ).
data: temp_tabx1 type zrmheaderx.
delete from zrmheaderx.
temp_tabx1-vendor = 'x'.
temp_tabx1-purch_org = 'x'.
temp_tabx1-pur_group = 'x'.
temp_tabx1-doc_type = 'x'.
temp_tabx1-comp_code = 'x'.
temp_tabx1-doc_date = 'x'.
insert into zrmheader values temp_tab1.
insert into zrmheaderx values temp_tabx1.
data: temp_tab type zrmitem .
data: temp_tabx type zrmitemx.
zitem1-acctasscat = request->get_form_field( 'A' ).
temp_tab-acctasscat = request->get_form_field( 'A' ).
zitem1-item_cat = request->get_form_field( 'I' ).
temp_tab-item_cat = request->get_form_field( 'I' ).
zitem1-material = request->get_form_field( 'Material' ).
temp_tab-material = request->get_form_field( 'Material' ).
zitem1-quantity = request->get_form_field( 'POQuantity' ).
temp_tab-quantity = request->get_form_field( 'POQuantity' ).
zitem1-po_unit = request->get_form_field( 'OUN' ).
temp_tab-po_unit = request->get_form_field( 'OUN' ).
zitem1-net_price = request->get_form_field( 'NetPrice' ).
temp_tab-net_price = request->get_form_field( 'NetPrice' ).
zitem1-plant = request->get_form_field( 'Plnt' ).
temp_tab-plant = request->get_form_field( 'Plnt' ).
zitem1-po_item = request->get_form_field( 'Item' ).
temp_tab-po_item = request->get_form_field( 'Item' ).
zitem1-stge_loc = request->get_form_field( 'Sloc' ).
temp_tab-stge_loc = request->get_form_field( 'Sloc' ).
zitem1-customer = request->get_form_field( 'Customer' ).
temp_tab-customer = request->get_form_field( 'Customer' ).
zitem1-incoterms2 = 'XDFGRT'.
temp_tab-incoterms2 = 'XDFGRT'.
append zitem1 to zitem.
insert into zrmitem values temp_tab.
zitemx1-acctasscat = 'x'.
zitemx1-item_cat = 'x'.
zitemx1-material = 'x'.
zitemx1-quantity = 'x'.
zitemx1-net_price = 'x'.
zitemx1-plant = 'x'.
zitemx1-po_item = 00010.
zitemx1-po_itemx = 'x'.
zitemx1-stge_loc = 'x'.
zitemx1-customer = 'x'.
zitemx1-incoterms2 = 'x'.
append zitemx1 to zitemx.
temp_tabx-acctasscat = 'x'.
temp_tabx-item_cat = 'x'.
temp_tabx-material = 'x'.
temp_tabx-quantity = 'x'.
temp_tabx-net_price = 'x'.
temp_tabx-plant = 'x'.
temp_tabx-po_item = 00010.
temp_tabx-po_itemx = 'x'.
temp_tabx-stge_loc = 'x'.
temp_tabx-customer = 'x'.
temp_tabx-incoterms2 = 'x'.
insert into zrmitemx values temp_tabx.
select * from zrmitem into corresponding fields of table zitem.
zpr_num = request->get_form_field( 'PRNo' ) .
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num1.
LEN =
call function 'BAPI_REQUISITION_GETDETAIL'
exporting
number = zpr_num1
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXTS = ' '
SERVICES = ' '
SERVICE_TEXTS = ' '
tables
requisition_items = item_tab
REQUISITION_ACCOUNT_ASSIGNMENT =
REQUISITION_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SERVICES_TEXTS =
REQUISITION_SRV_ACCASS_VALUES =
RETURN =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
*IMPORTING
*RETURN = i_return
to save the item details and generate a PO number
elseif htmlb_event is bound and htmlb_event->server_event = 'onsave'.
zpr_num = request->get_form_field( 'PRNo' ) .
data: zpr_num4 type banfn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num4.
zpr_num = zpr_num4.
data: temp_t2 type zrmsched,
count2 type n,
a2 type n value 1.
data:temp_t type zrmitem,
count type n,
a type n value 1.
select * from zrmitem into corresponding fields of table data_tab.
count = sy-dbcnt.
do count times.
read table data_tab into temp_t index a.
a = a + 1.
zitem1-po_item = temp_t-po_item.
zitem1-acctasscat = temp_t-acctasscat.
zitem1-item_cat = temp_t-item_cat.
zitem1-material = temp_t-material.
zitem1-quantity = temp_t-quantity.
zitem1-po_unit = temp_t-po_unit.
zitem1-net_price = temp_t-net_price.
zitem1-plant = temp_t-plant.
zitem1-stge_loc = temp_t-stge_loc.
zitem1-customer = temp_t-customer.
zitem1-incoterms2 = temp_t-incoterms2.
append zitem1 to zitem.
zitemx1-acctasscat = 'x'.
zitemx1-item_cat = 'x'.
zitemx1-material = 'x'.
zitemx1-quantity = 'x'.
zitemx1-net_price = 'x'.
zitemx1-plant = 'x'.
zitemx1-po_item = temp_t-po_item.
zitemx1-po_itemx = 'x'.
zitemx1-stge_loc = 'x'.
zitemx1-customer = 'x'.
zitemx1-incoterms2 = 'x'.
append zitemx1 to zitemx.
enddo.
count2 = sy-dbcnt.
zpoheader-vendor = request->get_form_field( 'Vendor' ) .
zpoheader-purch_org = request->get_form_field( 'POrg' ).
zpoheader-pur_group = request->get_form_field( 'PGrp' ).
zpoheader-doc_type = 'NB'.
zpoheader-item_intvl = request->get_form_field( 'Item' ).
zpoheader-comp_code = request->get_form_field( 'CCode' ).
zpoheader-doc_date = request->get_form_field( 'DocDate' ).
delivdate_new = request->get_form_field( 'DelivDate' ).
zpoheaderx-vendor = 'x'.
zpoheaderx-purch_org = 'x'.
zpoheaderx-pur_group = 'x'.
zpoheaderx-doc_type = 'x'.
zpoheaderx-comp_code = 'x'.
zpoheaderx-doc_date = 'x'.
data: zpovendor type elifn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpoheader-vendor
importing
output = zpovendor.
zpoheader-vendor = zpovendor.
call function 'BAPI_PO_CREATE1'
exporting
poheader = zpoheader
poheaderx = zpoheaderx
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
importing
exppurchaseorder = po_num
EXPHEADER = PO_NUM_HEAD
EXPPOEXPIMPHEADER =
tables
RETURN = zreturn
poitem = zitem
poitemx = zitemx
POADDRDELIVERY =
POSCHEDULE = zposched
POSCHEDULEX = zposchedx
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'
IMPORTING
RETURN =
delete from zrmitem.
delete from zrmitemx.
select * from zrmitem into corresponding fields of table zitem.
if po_num = ' '.
po_num = 'Try Again'.
endif.
to store po_num and corresponding pr number
data: temp_tt type zpo_pr_nums.
temp_tt-pr_num = zpr_num.
temp_tt-po_num = po_num.
insert into zpo_pr_nums values temp_tt.
to store po num and corresponding delivery date
data: wa11 type zpo_delivdate.
wa11-po_number = po_num.
wa11-deliv_date = delivdate_new.
insert into zpo_delivdate values wa11.
zpoheader-vendor = ' '.
zpoheader-purch_org = ' '.
zpoheader-pur_group = ' '.
zpoheader-doc_type = ' '.
zpoheader-item_intvl = ' '.
zpoheader-comp_code = ' '.
zpoheader-doc_date = ' '.
delivdate_new = ' '.
to enter a PR Number
elseif htmlb_event is bound and htmlb_event->server_event = 'onenter'.
delete from zrmitem.
delete from zrmitemx.
select * from zrmitem into corresponding fields of table zitem.
zpr_num = request->get_form_field( 'PRNo' ) .
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num1.
LEN =
call function 'BAPI_REQUISITION_GETDETAIL'
exporting
number = zpr_num1
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXTS = ' '
SERVICES = ' '
SERVICE_TEXTS = ' '
tables
requisition_items = item_tab
REQUISITION_ACCOUNT_ASSIGNMENT =
REQUISITION_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SERVICES_TEXTS =
REQUISITION_SRV_ACCASS_VALUES =
RETURN =
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
*IMPORTING
*RETURN = i_return
to select an item from drop down item menu
elseif htmlb_event is bound and htmlb_event->server_event = 'select'.
data: zselection2 type bnfpo.
data: data type ref to cl_htmlb_dropdownlistbox.
zpr_num = request->get_form_field( 'PRNo' ) .
data: zpr_num2 type banfn.
call function 'ZCONVERT_ALPHA'
exporting
input = zpr_num
importing
output = zpr_num2.
data ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'dropdownlistbox'
id = 'ItemSel'
if data is not initial.
zselection2 = data->selection.
endif.
zpoheader-vendor = request->get_form_field( 'Vendor' ) .
zpoheader-purch_org = request->get_form_field( 'POrg' ).
zpoheader-pur_group = request->get_form_field( 'PGrp' ).
zpoheader-doc_type = 'NB'.
zpoheader-item_intvl = request->get_form_field( 'Item' ).
zpoheader-comp_code = request->get_form_field( 'CCode' ).
zpoheader-doc_date = request->get_form_field( 'DocDate' ).
call function 'BAPI_REQUISITION_GETDETAIL'
exporting
number = zpr_num2
ACCOUNT_ASSIGNMENT = ' '
ITEM_TEXTS = ' '
SERVICES = ' '
SERVICE_TEXTS = ' '
tables
requisition_items = item_tab
REQUISITION_ACCOUNT_ASSIGNMENT =
REQUISITION_TEXT =
REQUISITION_LIMITS =
REQUISITION_CONTRACT_LIMITS =
REQUISITION_SERVICES =
REQUISITION_SERVICES_TEXTS =
REQUISITION_SRV_ACCASS_VALUES =
RETURN =
data wa1 type bapieban.
loop at item_tab into wa1.
if wa1-preq_item = zselection2.
item_new = wa1-preq_item.
material_new = wa1-material.
plant_new = wa1-plant.
quantity_new = wa1-quantity.
unit_new = wa1-unit.
delivdate_new = wa1-deliv_date.
endif.
endloop.
endif. -
Get values of table in tableview
Hello,
I have a tableview - which has a table and out of all the columns only 2 are user input - one is an amount field and other is a currency key. I dont have multiselct option in the tableview. I want to read the table in DO_HANDLE_EVENT which has amount >0 for a row.
Can I do this without multiselect option - i dont want the users to select row and then enter money..I just should be able to process only rows with no 0s.
Please advice..
Thanks
ThilothamaHi,
you should implement DO_HANDLE_DATA,
CALL METHOD super->do_handle_data
EXPORTING
form_fields = form_fields
global_messages = global_messages.
LOOP AT form_fields INTO l_fields WHERE name CA 'table_id'.
SPLIT l_fields-name AT '_' INTO w_table w_row_index w_column_index.
CASE w_column_index.
WHEN '2'.
if formfields-value > 0.
endif.
WHEN '3'.
if formfields-value > 0.
endif.
ENDCASE.
ENDLOOP.
given column 2 and 3 are the ones you want to check
grtz
Koen -
Controller request to another one which is in another bsp appl. + attrib.
Hi everybody,
how can I call a controller from another controller which is in a separate BSP-application and how can I get some of its controller attributes? I've split the whole application in two seperate one in order not to lose the overview.
Shouldn't be that complicated, or?
Thanks for any help.
Jens
Edited by: Jens Griesinger on Apr 25, 2008 8:58 PMHi,
For Example u take first application znavigation in that controller do_request u write
method DO_REQUEST.
*CALL METHOD SUPER->DO_REQUEST
data: r_view type ref to if_bsp_page.
dispatch_input( ).
r_view = create_view( view_name = 'app1.htm' ).
r_view->set_attribute( name = 'first' value = input1 ).
r_view->set_attribute( name = 'second' value = input2 ).
call_view( r_view ).
endmethod.
and do_handler_event()
method DO_HANDLE_EVENT.
*CALL METHOD SUPER->DO_HANDLE_EVENT
EXPORTING
EVENT =
HTMLB_EVENT =
HTMLB_EVENT_EX =
GLOBAL_MESSAGES =
RECEIVING
GLOBAL_EVENT =
DATA: button_event TYPE REF TO cl_htmlb_event_button.
DATA: V_TARGET_URL TYPE STRING,
W_APP_NAME TYPE STRING.
IF htmlb_event IS BOUND AND htmlb_event->name = 'button'.
button_event ?= htmlb_event.
ENDIF.
DATA: data_input TYPE REF TO cl_htmlb_inputfield.
IF button_event->server_event = 'submit'.
data_input ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'inputfield'
id = 'InputName1' ).
IF data_input IS NOT INITIAL.
input1 = data_input->value.
ENDIF.
data_input ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'inputfield'
id = 'InputName2' ).
IF data_input IS NOT INITIAL.
input2 = data_input->value.
ENDIF.
Construct the Target URL
CALL METHOD RUNTIME->CONSTRUCT_BSP_URL
EXPORTING
IN_PROTOCOL = 'http'
IN_APPLICATION_NS = RUNTIME->APPLICATION_NAMESPACE
IN_APPLICATION = RUNTIME->APPLICATION_NAME
IN_PAGE = '**/znavigation1/zsecondappl.do'
IMPORTING
OUT_ABS_URL = V_TARGET_URL.
CONCATENATE RUNTIME->APPLICATION_NAME '/**/' INTO W_APP_NAME.
REPLACE W_APP_NAME IN V_TARGET_URL WITH SPACE.
Pass the input1 and input2 via URL
CONCATENATE V_TARGET_URL '?input1=' input1 INTO V_TARGET_URL.
CONCATENATE V_TARGET_URL '&input2=' input2 INTO V_TARGET_URL.
NAVIGATION->GOTO_PAGE( V_TARGET_URL ).
ENDIF.
endmethod.
Activate the first application.
second bsp application:
do_request();
METHOD DO_REQUEST.
data: r_view type ref to if_bsp_page.
dispatch_input( ).
Get the values from source BSP Application which was set via URL
input1 = REQUEST->GET_FORM_FIELD( 'input1' ).
input2 = REQUEST->GET_FORM_FIELD( 'input2' ).
*IF r_view IS BOUND.
r_view = create_view( view_name = 'secondappl.htm' ).
r_view->set_attribute( name = 'input1' value = input1 ).
r_view->set_attribute( name = 'input2' value = input2 ).
call_view( r_view ).
ENDIF.
ENDMETHOD.
do_handler_event:
METHOD DO_HANDLE_EVENT.
DATA: button_event TYPE REF TO cl_htmlb_event_button.
DATA: V_TARGET_URL TYPE STRING,
W_APP_NAME TYPE STRING.
IF htmlb_event IS BOUND AND htmlb_event->name = 'button'.
button_event ?= htmlb_event.
ENDIF.
DATA: data_input TYPE REF TO cl_htmlb_inputfield.
IF button_event->server_event = 'back'.
CALL METHOD RUNTIME->CONSTRUCT_BSP_URL
EXPORTING
IN_PROTOCOL = 'http'
IN_APPLICATION_NS = RUNTIME->APPLICATION_NAMESPACE
IN_APPLICATION = RUNTIME->APPLICATION_NAME
IN_PAGE = '**/znavigation/zapplication1.do'
IMPORTING
OUT_ABS_URL = V_TARGET_URL.
CONCATENATE RUNTIME->APPLICATION_NAME '/**/' INTO W_APP_NAME.
REPLACE W_APP_NAME IN V_TARGET_URL WITH SPACE.
NAVIGATION->GOTO_PAGE( V_TARGET_URL ).
ENDIF.
ENDMETHOD.
activate the second application.
display the input1 and input2 in the second application view.
try this if u have any error please let me know.
Award me. -
How to validate new added fields in CRM UI 5.1
Hello Experts,
Actually I am new to SAP CRM 5.1 recently We have added one New tab at Item level with new fields which are existing in CRM Gui, now i want to validate the fields
EX : 3 text boxes are there
1. shift Hrs 1
2. shift Hrs 2
3. shift Hrs 3
all these are numeric type
and next below one field is there
4. Estimated Annual running Hours
this should have the values of
Multiplication of all above 3 field values and should be displayed in the 4 th one.
please suggest me how to write the code, where to write the code.
very very very urgent.
sunil.Hi Sunil,
Upon pressing enter, 'submitonenter' event is fired. So, in DO_HANDLE_EVENT of your view controller class add following piece of code and ur logic:
CASE htmlb_event_ex->event_server_name.
WHEN 'submitonenter'.
Add directly multiplication logic or define a method in view controller class and call that method here.
WHEN OTHERS.
CALL METHOD SUPER->DO_HANDLE_EVENT
EXPORTING
EVENT = EVENT
HTMLB_EVENT = HTMLB_EVENT
HTMLB_EVENT_EX = HTMLB_EVENT_EX
GLOBAL_MESSAGES = GLOBAL_MESSAGES
RECEIVING
GLOBAL_EVENT = GLOBAL_EVENT
ENDCASE.
Note: if DO_HANDLE_EVENT is not redefined, please do define again.
Cheers,
Prasad -
MVC sub controller event handling for tabStrip
Hi all,
This is my first time on SDN so please forgive any procedural errors. I am developing an application for several dealer functions and use tabstrip and MVC. My main controller / view contains the tabstrip items and I call a seperate sub controller from the main view for each of the tabstrip items.
(<bsp:call comp_id="track"/> where comp_id is a sub controller created in method do_init of the controller.) The sub controller classes were created using the MVC design pattern, each with a view and a model.
Problem: When I am in any of the called sub controller views / tab items and I enter some data for the specific tab item, the do_handle_event method for that specific view / tab item sub controller is not activated. Processing goes directly to the do_handle_event of the main controller.
My understanding of the process is that the do_handle_event for a sub controller will be activated first before processing return to the parent controller. This will allow me to use the tab items as independent views with the processing logic being handled by the relevant model. Am I correct in this assumption? I have read the forums on the handling of tabstrips and have looked at the sample applications but somehow I am missing a bit of the logic. Can someone please help?
Regards,
Jan van der SpuyHello Bernhard/Shiva,
I have changed the comp-id and debugged the DO_REQUEST event for main controller in more detail.
The field values are
htmlbevt_t<htmlb:button:click:null
hmlbevt_f<htmlb_form_1
htmlbevt_o<htmlb_button_1
htmlbevt_i<onTracking
htmlbevt_c<0
onInputPro<htmlb
tracking_t<9346100P&A
tracking_t<1010
|
m_subcontrollers[1]-INSTANCE
METHOD DISPATCH INPUT
Call registered controllers with form fields
Call all registered controllers, even if no form_fields for them are r
LOOP AT m_subcontrollers ASSIGNING <controller> where hide = ''.
CHECK <controller>-fields[] IS NOT INITIAL.
<controller>-instance->fill_values(
form_fields = <controller>-fields
global_messages = component_messages ).
IF_BSP_CONTROLLER_FILL_VALUES(IF_BSP_CONTROLLER)
performance shortcut if no subcontroller is present
if m_subcontrollers is intial.
do_handle_data(
form_fields = form_fields
global_messages = global_messages ).
return.
endif.
From here it goes to the DO_HANDLE_DATA method of the subcontroller and returns.
A bit further in the logic of DISPATCH_INPUT() is where things go wrong.
<b>* Dispatch event to controller</b>
if event_value is not initial.
if event_comp_index = 0.
component_event = do_handle_event(
event = event_value
htmlb_event = request_event
htmlb_event_ex = event_data
global_messages = component_messages ).
And the values are as follows:
component_event <b>(NO VALUE) IS THIS THE PROBLEM?</b>
request_event
event_data
component_messages -
*******Kindly Clarify*********
global_event = do_handle_event(
event = event
htmlb_event = htmlb_event
htmlb_event_ex = htmlb_event_ex
global_messages = global_messages
The various values are as follows:
EVENT srms2_create
HTMLB_EVENT
HTMLB_EVENT_EX
GLOBAL_MESSAGES
After this code is executed the method DO_HANDLE_EVENT of the class CL_CRM_BSP_FRAME_MULTISELECT gets selected.
But I want the method DO_HANDLE_EVENT of the class "CL_CRM_BSP_FRAME_SRES" to get called.
Kindly guide me how to accompliosh the above.
Please reply.
Regards,
Vijaypost this in BSP forum for quicker response.
Raja -
MVC tableView /selectedRows
Hello All,
I use the <b>MVC Logic</b> and I try know to read the selectedRows from TableView, when I push a Button "<b>myButton</b>".
Thank's in Advance.
dav.Hello Sreekanth .
Sorry!! but I need your Help!!
when I use your Code work perfect, but if I expand it, then does not work.
I mean if I call the controller(zsk_temp1.do ) from a View (default.htm).
My Aplication has 2 Controllers and 2 views:
<u><b>Controller:</b></u>
- default.do
- zsk_temp1.do
<u><b>View:</b></u>
-default.htm
-First.htm
Have you any Idea why can i not get know the selected Rows???
I think is somting with "<u>dispatch_input( )."</u>
Thank's
Regards.
dav.
<b><u>View: First.htm</u></b>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title="First page " >
<htmlb:form>
<htmlb:textView text = "Hello World!"
design = "EMPHASIZED" />
<htmlb:button text = "Press Me"
onClick = "myClickHandler" />
<htmlb:group id = "rate_zwei"
design = "sapcolor" >
<htmlb:groupHeader>
<htmlb:textView id = "testgroup2"
text = "Test group"
textColor = "black"
layout = "PARAGRAPH"
width = "400" />
</htmlb:groupHeader>
<htmlb:groupBody>
<htmlb:tableView id = "tv1"
width = "100%"
visibleRowCount = "8"
design = "ALTERNATING"
footerVisible = "TRUE"
selectionMode = "MULTISELECT"
table = "<%= controller->itab_flight %>"
selectedRowIndexTable = "<%= controller->TABLE %>"
selectedRowIndex = "<%= controller->v_index %>" >
</htmlb:tableView>
<p>
<htmlb:button id = "test"
onClick = "test"
text = "test" />
</htmlb:groupBody>
</htmlb:group>
</htmlb:form>
</htmlb:page>
</htmlb:content>
<u><b>View : default.htm</b></u>
<%@extension name="bsp" prefix="bsp" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="phtmlb" prefix="phtmlb" %>
<htmlb:content id = "ComponentTest"
design = "CLASSIC+DESIGN2002+DESIGN2003" >
<htmlb:page title="TEST" >
<htmlb:form id = "myFormId"
method = "post"
encodingType = "multipart/form-data" >
<htmlb:tray id = "tray1"
title = "Merkmale "
design = "form"
width = "100%"
isCollapsed = "false" >
<b><bsp:call url = "zsk_temp1.do"
comp_id = "zsk" ></b> </bsp:call>
</htmlb:tray>
</htmlb:form>
</htmlb:page>
</htmlb:content>
<u><b>Controller: default.do</b></u>
method DO_REQUEST.
DATA: main_view TYPE REF TO if_bsp_page.
dispatch_input( ).
main_view = create_view( view_name = 'default.htm' ).
call_view( main_view ).
endmethod.
<u><b>Controller: zsk_temp1.do</b></u>
ZCL_SREE_FIRST
Controller Class for zsk_temp1
INHERITED FROM:CL_BSP_CONTROLLER2
CLASS IMPLEMENTAION
" local class implementation for public class
" use this source file for the implementation part of
" local helper classes
CLASS TYPES
" use this source file for any type declarations (class
" definitions, interfaces or data types) you need for method
" implementation or private method's signature
CLASS MACROS
" use this source file for any macro definitions you need
" in the implementation part of the class
ATTRIBUTES
ITAB_FLIGHT INSTANCE ATTRIBUTE PUBLIC TYPE ZSFLIGHT sflight
INDEX INSTANCE ATTRIBUTE PUBLIC TYPE S_INDEX
TABLE INSTANCE ATTRIBUTE PUBLIC TYPE INT4_TABLE Standard Table of INT4
V_INDEX INSTANCE ATTRIBUTE PUBLIC TYPE SY-INDEX Loops, Current Loop Pass
METHODS
method do_handle_data.
*CALL METHOD SUPER->DO_HANDLE_DATA
EXPORTING
FORM_FIELDS =
GLOBAL_MESSAGES =
data: it_formfields type ihttpnvp.
read table form_fields into it_formfields with key name = 'tv1'.
endmethod.
method do_handle_event.
data:
table_event type ref to cl_htmlb_event_tableview,
table type ref to cl_htmlb_tableview ,
selectedrows type selectedrows.
case event.
when 'test'.
table ?= cl_htmlb_manager=>get_data( request = request
name = 'tableView'
id = 'tv1' ).
table_event ?= table->data.
call method table_event->get_rows_selected
receiving
selected_rows = selectedrows.
endcase.
endmethod.
method do_init.
*CALL METHOD SUPER->DO_INIT
select mandt
carrid
connid
fldate
price
currency
planetype
seatsmax
seatsocc
paymentsum
seatsmax_b
seatsocc_b
seatsmax_f
seatsocc_f
up to 10 rows
from sflight
into table itab_flight.
endmethod.
method do_request.
*CALL METHOD SUPER->DO_REQUEST
*write( '<html><body> ' ).
write( 'This is my very first controller' ).
write( '</body></html>' ).
data: myview type ref to if_bsp_page.
dispatch_input( ).
myview = create_view( view_name = 'First.htm' ).
call_view( myview ).
endmethod.
EVENTS
TYPE-GROUPS
INTERNAL TYPES
S_INDEX PUBLIC
Maybe you are looking for
-
BW Query in CRM Account Fact Sheet : Error
When selecting a BW query in the account fact sheet : the following error message is shown : "Query can not be loaded (Data Provider "DP_1" : No service-implementation is available)" Do we need to create a web service for this ?
-
How do I backup my iTunes library to an external drive?
Hi there, Is there any way of backing up my itunes library direct to a backup device such as an external hard drive or online back up software? The only option I can see is to back up to disc but that will take 50 discs!
-
Custom generic-column layout for entire workspace
Hi, Currently, I use a generic-column layout (XSL-FO) for PDF printing in one of my applications. Is it possible to publish it so that it will be available to all applications in the same workspace? I use Apex 3.2.0.00.27. Also, I found that the same
-
Where is BusinessObjects Enterprise Java SDK jars located(BO XI3.1)?
We need to import Business Objects Enterprise Java SDK's jar files. However, there is no document or forum post that have the directory for version BOXI3.1. By searching for the cecore.jar file, we find a directory that contains many Business Objects
-
Unicode in Labels, Buttons,...
Hi, I want to use unicode in my applet. I know that I can use unicode characters by drawString() method of Graphics class but I want to use unicode characters in Label, Button,... components. I tried to use bellow command to show \ufe78 th character