How to disable DELETE and EDIT buttons function in attachment list

In some companies client attaches documents/approvals in any transactional or master data. Any user who have its display or change access can delete or edit this attachment. We can restrict users from deleting or editing attachments in all documents. Please check below process for this.
Run T-Code SU21 and create authorization object with display activity 03 only.



Create object class. If you want to use any existing class please leave this step.



Enter class name and text.



Now create authorization object. 





Create only one activity 03 for display.



Run T-Code SE24



Enter class CL_GOS_SRV_ATTACHMENT_LIST into object type.



Copy standard class into your own Z class and click on green tick/enter. Give you package name and save it in new transport request.



In the below screen double click on check_status.



Add authorization check. Coding is 
AUTHORITY-CHECK OBJECT 'ZATTACH' ID 'ACTVT' FIELD '03'.

IF sy-subrc = 0.
    on_mode_changed( 
'D' ). "--- For display
  ENDIF.
Logic is that field 03 is for display in authorization object activities. ‘D’ is an indicator for display mode. You have to assign this object only to those users to whom you want to restrict for editing and deleting attachments. The users without this object can still delete and edit attachments. 



Add Zclass in T-Code SGOS



Select VIEW_ATTA in Name of Service. Status Gen. Service should be active and enter Zclass name in class F.GEN.Service field. 



Assign authorization object to user and give activity 03. Now test in any attachment list. Edit and delete buttons will be in display mode as you can see in below screen.


Following is the screen shot for the user who has full access and I have not assigned authorization object to this user. So this user can change and edit attachments. 





1 comment:

  1. What if I want the user who created the document should not be able to delete the attachment, how do I go about it?

    ReplyDelete

Copyright © 2013 VENKAT SAP BASIS