cancel
Showing results for 
Search instead for 
Did you mean: 

~~~~~~ Non Editable Notes ~~~~~~~

Former Member
0 Kudos

Hi Experts,

Currently in Web UI 2007 when a Task is assigned to an Employee with certain Notes attached,the employee assigned is able to edit or change the Notes contents.

My requirement is to restrict the edit option of the Notes to the assigned employee. In transaction Task Notes should be non editable to the assigned employee.

Please let me know how can i restrict this.

Answers will be rewarded.

Regards...

Arup

Accepted Solutions (1)

Accepted Solutions (1)

xavier_dehairs2
Active Participant
0 Kudos

Hi, did you tried to remove the "Actions" from the UI configuration of GSTEXT/List view using the UI Config tool ? This should remove the edit & delete icons. That would be my first attempt and the easiest of course.

Regards,

Xavier

Former Member
0 Kudos

Hi Xavier,

Could you please explain more on this?

Scenario I hope I have explained clearly(As below) :-

Manager assign a task to Employee with some text written in NOTES Tab.

When employee opens the Task from "My Open Task" he should only be able to View the Text in the Notes Tab no modifications would be allowed.

Regards

Arup

xavier_dehairs2
Active Participant
0 Kudos

Hi,

When you open a task, in the Notes assignment block (tab is not the appropriate word, in CRM 2007 we call these "assignment blocks", just FYI) there are 2 possible actions: Edit or Delete, which are represented by small icons.

If you remove those Actions via transactions BSP_WD_CMPWB then the user should not be able to modify the note anymore. Do you know how the UI Configuration tool works ? If not, there are plenty of posts that explain that already, and that is the basic of CRM 2007 UI configuration that everyone should know when starting a project .

Hope you understood more clearly what I meant.

Xavier

Former Member
0 Kudos

Hi Xavier,

Could you explain little bit more, how to disable edit button for the following :

Component = BT125H_TASK

View = Task Details

Context Node = CHTMLB

Where exactly, you delete or disable the edit button...

Cheers,

Peter J.

suchita_phulkar
Active Contributor
0 Kudos

Hi,

I am confused is it Arup or Peter seeking for solution ? Anyways,

Well, when we open the task, ViewSet BT125H_TASK/TaskDetailsViewSet1 comes into picture which has two view areas, One that display task General Data and other that display's Notes.

Case 1 ) If we want to restrict the employee from complete edition access i.e. Do not allow him to edit General data as well as Notes, then the best solution for this is to Hide the Edit button for employee.

This can be done as follows :

Redefine DO_PREPARE_OUTPUT of task viewset Implementation Class CL_BT125H_T_TASKDETAILSV1_IMPL ( this is in BT125H_TASK/TaskDetailsViewSet1 under views ), Now determine the business role assigned to employee.

data: LV_PROFILE type ref to IF_CRM_UI_PROFILE.

data: LV_ROLE type string.

LV_PROFILE = CL_CRM_UI_PROFILE=>GET_INSTANCE( ).

if LV_PROFILE is bound.

LV_ROLE = LV_PROFILE->GET_PROFILE( ).

endif.

Now, the LV_ROLE will contain the ID of the Business Role.

now check for employee role as

IF LV_ROLE = 'Your Emploee role name here'

" Do nothing ***

ELSE.

super->do_prepare_output( ).

ENDIF.

      • Remember, we redefined the DO_PREPARE_OUTPUT. The original implementation is in superclass which has the coding for addition of EDIT button . We are simply bypassing this so that EDIT button will not be added only for employee while it will be there for all roles OTHER than employee role.

CASE 2 ) We want to restrict employee from editing the notes part only while he can edit the genereral data part.

Redefine the EH_ONEDIT of task viewset Implementation Class CL_BT125H_T_TASKDETAILSV1_IMPL ( this is in BT125H_TASK/TaskDetailsViewSet1 under views ), And use following code

data:

lr_ent type ref to cl_crm_bol_entity,

lr_vgc type ref to if_bsp_wd_view_group_context,

lr_coco type ref to cl_bt125h_t_bspwdcomponen_impl.

data :

ls_viewarea TYPE LTYPE_VA_CONTENT,

lv_viewarea_content TYPE BSP_WD_VA_CONTENT_SINGLE,

lv_view_controller TYPE REF TO CL_BSP_WD_VIEW_CONTROLLER,

LV_PROFILE type ref to IF_CRM_UI_PROFILE,

LV_ROLE type string,

lv_view_name TYPE string .

lr_coco ?= me->comp_controller.

lr_ent ?= lr_coco->typed_context->btadminh->collection_wrapper->get_current( ).

check lr_ent is bound.

if lr_ent->lock( ) = abap_true.

"Detremine employee role :

LV_PROFILE = CL_CRM_UI_PROFILE=>GET_INSTANCE( ).

if LV_PROFILE is bound.

LV_ROLE = LV_PROFILE->GET_PROFILE( ).

endif.

IF LV_ROLE = 'ZSALESPRO' . " i am giving just an example role

" Enable Details viewarea only

lv_view_name = me->GET_VIEWAREA_CONTENT( 'TaskDetailsViewArea' ).

lv_view_controller ?= me->GET_SUBCONTROLLER_BY_VIEWNAME( lv_view_name ) .

CHECK lv_view_controller IS BOUND.

me->view_group_context->set_view_editable( lv_view_controller ) .

ELSE.

me->view_group_context->set_all_editable( ) .

ENDIF.

endif.

and we are done with it.

Thanks & Regards,

Suchita

Edited by: suchita P on Sep 24, 2008 11:41 AM

Former Member
0 Kudos

Hi Suchita,

I did asked to eloborate more, so that I can fit into one of my requirements - disable edit button on empployee details screen (Account Mngt -> Search Account -> Click on Employee Responsible -> should display employee detail only, user should not change the details (currently it is possible to edit the employee details)). Please note that I am not a programmer to understand the logic very quickly as you all.

Kindly note that the following code is there in DO_PREPARE_OUT method under Implementation Class CL_BT125H_T_TASKDETAILSV1_IMPL

method DO_PREPARE_OUTPUT.

*CALL METHOD SUPER->DO_PREPARE_OUTPUT

    • exporting

    • iv_first_time = ABAP_FALSE

  • .

DATA ls_button TYPE crmt_thtmlb_button.

CLEAR gt_button.

  • --- EDIT button

ls_button-type = cl_thtmlb_util=>gc_icon_edit.

ls_button-text = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/EDIT' )."#EC NOTEXT

ls_button-on_click = 'EDIT'. "#EC NOTEXT

ls_button-enabled = me->view_group_context->is_view_in_display_mode( me ).

INSERT ls_button INTO TABLE gt_button.

endmethod.

As you mentioned in case 1 - should I replace your code with the existing code or add your code to acheive the results???

Thank you very much for your kind help...

Cheers,

Peter J.

suchita_phulkar
Active Contributor
0 Kudos

Hi Peter,

Note that We are callling super->do_prepare_output( ) when its not Emloyee, so it will call the code that you pasted in reply to my thread . This code is in Parent's do_prepare_output( ) .

I had already pointed that out in my reply explaining why we are calling super->do_repare_output.

Just follow my thread and you will be done with your requirement.

Thanks & Regards,

Suchita

Former Member
0 Kudos

Hi Suchita,

I don't have progarmming knowledge but i will take the help of my colleague and get back to you with results.

Thanks for the reply. Hope this will resolve my issue.2nd Case mentioned by you is appilcable in my scenario.

Regards

Arup

xavier_dehairs2
Active Participant
0 Kudos

Arup, did you tried what I suggested for your requirement ? This is simply done through the UI Config Tool and does not require any programming knowledge, in opposition to what Suchita kindly suggested to Peter.

Regards,

Xavier

PS: Don't forget to give points to people that try helping you, it takes some time to post those answers Especially answers like the one of Suchita should take him/her quite some time !

Former Member
0 Kudos

Hi Xavier,

I will be trying the suggestion provided by you and also will reply you if i could do it or not.

I always ensure rewarding for the correct reply i get. I will do the same with the reply which will also help you in future replies.Thanks for reminding.

Thanks & Regds...

Arup

suchita_phulkar
Active Contributor
0 Kudos

Hi Arup,

If you are also into 2nd case, then go ahead and just copy paste my code....I have personally implemented this solution .

It was a pleasure to help .

Thanks and Regards,

Suchita

suchita_phulkar
Active Contributor
0 Kudos

Hi Xavier,

What you suggested is also an approch. But if Arup, removes the ACTION column from configuration, he can stop edit and delete but he will have to set Role_config_key and do that for employee role only .

( This is because MANAGER can edit. )

Also Your solution will not work if the HOME PAGE has TASKs work center.( which is the default case)

By default, on Home page , tasks get displayed. This , when on home page, is not OV kinda view nor Assignment Block . So when you click the task, you directly go to task details page, where in Viewset, the EDIT button is present so employee then can still edit the task.

Hence i feel the programming solution will give more control to restric the EMPLOYEES in all scenarios.

Thanks & Regards,

Suchita

Former Member
0 Kudos

Hi Suchita,

Thanks for the reply.

Your answer perfectly right to what i was looking for . full points to you.

Now the problem is, there is an Assignment Block "Notes" and if I edit there then on top Notes field also text gets changed.

In my scenario Employees needs to give his remarks before setting this Task to completed.

How can that be achieved? If I remove the Actions ot make the Notes field display only then that will not allow the employee to give his remarks otherwise edit in Notes AB also changes the text.

Regards

Arup

Former Member
0 Kudos

Hi Suchita,

Sorry to bug you, but the following code added to do_prepare_output does not shows any effect on the WEB UI - still user is able to edit the task:

data: LV_PROFILE type ref to IF_CRM_UI_PROFILE.

data: LV_ROLE type string.

LV_PROFILE = CL_CRM_UI_PROFILE=>GET_INSTANCE( ).

if LV_PROFILE is bound.

LV_ROLE = LV_PROFILE->GET_PROFILE( ).

endif.

Now, the LV_ROLE will contain the ID of the Business Role.

now check for employee role as

IF LV_ROLE = 'BUP003'

" Do nothing ***

ELSE.

super->do_prepare_output( ).

ENDIF.

I just copied your above code into the do_prepare_output method, checked code consistence and re-activated the method. This does not have any effect on the WEB UI, still user can modify....

Could you kindly let me know - is this approach is correct or not??

Does this code work for any-other component or screen's edit button disablement??

Thanks in advance for your valuable time and guidence...

Cheers,

Peter J.

suchita_phulkar
Active Contributor
0 Kudos

Hi Arup,

Thanks for the appreciation.

I understood your problem. You mean,

1.when manager will assign the task, he will make some notes which the employee whom task is assign should be able to READ only and not edit.

2. Howvever , employee can put a remark through Notes AB via creating new notes., but these notes also get displayed for the task notes.

Then the best way to get arround this is to use "Attachment facility"

you can add CUBT125HTASK comp. usage for Attachment AB , raidily available in the component.

Let either manager or Employee upload there remarks as an attachment .( Employee should be better to have his remarks as attachment...Manager can view them when he want to read.

If you still want it to be in notes only then there will be A LOT of programming required as you have to handle it and for which first thing would be to know the massage by Manager. then you can trip it from notes part, it in a string variable when employee is the editing person and when employee hits save, again append the manager's message that we kept in a string variable to the string entered by employee.

so in display mode :

AAAAAAAAAAAAa

bbbbbbbbbbbbbbbbbbbbb

where AAAAAAAAAAAAAAAAA would be messge by manager and

bbbbbbbbbbbbbbbbbbbb would be messgae by employee

and in edit mode :

it will be just

bbbbbbbbbbbbbbbbbbbbbbb

and AAAAAAAAAAAAAAAA will be saved in a string variable that you will use on click of save button

This is just an idea...

Regards,

Suchita

suchita_phulkar
Active Contributor
0 Kudos

Hi Arup,

It reminded me one thing...

In one of my project, we actually removed NOTES view area only from the task and kept the notes AB present.

If your do this, then even manager's Notes will be available in the NOTE AB and with his username ( by using created by field as a column of NOTEs AB ).

Then you can easily restrict employee from editing or deleting manager's noted by checking created by filed..

for example :

in case block in EH_ONONE_CLICK_ACTION,

WHEN 'EDIT'.

lv_user = current->get_property_as_value( 'CREATED_BY').

if lv_user NE sy-uname.

" give error message as 'You dont have authorization to edit this note' etc.

else.

"code

endif.

Regards,

Suchita

Former Member
0 Kudos

Hi Suchita,

Thanks for the reply.

I have removed the Notes AB and assigned Private Note AB in order to fulfill our requirement.

But would mind telling me where exactly i can find EH_ONONE_CLICK_ACTION so that ican try your the above suggested option as well???

Regards

Arup

suchita_phulkar
Active Contributor
0 Kudos

Hi Arup,

If you are using a std. AB, then generally it has a ACTION column which contains EDIT and Delet button as icons. IF the AB for priate notes that u r using has this actions column, then there must be and event handler called EH_ONONE_CLICK_ACTION.

You can find this event handler in the IMPL class ( the controller clas that ends with IMPL) of the view.

Open your view say NotesOV , then go to its IMPL class by double clicking on it in the component workbench.

Under methods, you will find this event handler. ( Remeber to uncheck the filer checkbox if it is checked as it shows you only redefined and created methods and not inherited methods).

Regards,

Suchita

Answers (0)