on 2019 Jan 25 4:51 AM
How to Disable/ Greyout END button of CRM WEB UI for a Particular View in EDIT Mode
Request clarification before answering.
Hello Ligin,
you can do it like this:
1 Create new Javascript File in MIME-Repository
Here is the js-function to disable the end-button. The path for the file is like this: SAP->BC->BSP->(your namespace)->PUBLIC
The script:
function disableTheEndButton(setDisabled){
// deactivate end button
var endButton = parent.frames["HeaderFrame"].$("a[id$='End']");
endButton.removeClass("th-bt-text").addClass("th-bt-text-dis");
endButton.removeProp("onclick");
endButton.removeProp("onmousedown");
endButton.removeAttr("onclick");
endButton.removeAttr("onmousedown");
// you need to distinguish by the variable 'setDisabled' to toggle!!
// you need to remember the onclick and onmousedown event handler content to set it later again - here might exist a more elegant solution, let me know if you find one
}2 Add your JS File to customizing
SPRO->CRM->UI Framework->Define Path for JS Files
3 Create a method on your view controller that is public which returns if view is in edit mode
4 Create AJAX Callback Class
Create a new class that implements interface IF_CRM_WEB_CALLBACK. In method IF_CRM_WEB_CALLBACK~HANDLE_REQUEST you will get your controller where you can call your public method of step 3.
You can return 'X'/' ' like this:
" set text in response object
ir_server->response->set_cdata( lv_editable ).5 Add ABAP/Javascript to your view
DATA:
lv_page_context TYPE REF TO cl_bsp_page_context.
lv_page_context ?= me->_m_page_context.
<script>
function checkIfEditable(){
<%
cl_crm_web_utility=>create_service_script(
iv_handler_class_name = '<AJAX_CABA_CLASS>'
iv_controller_id = lv_page_context->m_page_id
iv_js_callback_function = 'setEndButtonEnabled' ).
%>
}
function setEndButtonEnabled(reqObj){
var setDisabled = reqObj.request.responseText;
window.parent.frames[0].disableTheEndButton(setDisabled);
// poll again after one second
setTimeout(checkIfEditable, 1000);
}
checkIfEditable();
</script>
Please reward if helpful...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.