6 Replies Latest reply: Oct 6, 2010 9:43 AM by Prabhu Peram RSS

Disabling 'Change' and 'Delete' button in Attachment List in ME52N

Fawaz Sheikh
Currently Being Moderated

Hi Friends,

 

The reuqirement is this:

 

A user attaches doucments  ( using the Generic Object Services to attach document ) while creating/changing Purchase Requisition (ME51N / ME52N).

 

Now when any user goes to see the docuemnts attached to the PR, he selects the 'Attachement List' from the context menu, he should only be able to read it and should not be allowed to change or delete the document. For this we need to disable the 'change' and 'delete' buttons from the toolbar.

 

Awaiting your response.......

 

 

Regards,

Fawaz

  • Re: Disabling 'Change' and 'Delete' button in Attachment List in ME52N
    Jonathan Bourne
    Currently Being Moderated

    Have a look at the following link from SAP Help - it seems you can use transaction SGOS for your needs or if you're feeling more adventurous BADI GOS_SRV_SELECT.

     

    Link:[http://help.sap.com/saphelp_47x200/helpdata/EN/15/7b623c28695c63e10000000a11405a/content.htm]

     

    Good luck.

    JB

    • Re: Disabling 'Change' and 'Delete' button in Attachment List in ME52N
      Fawaz Sheikh
      Currently Being Moderated

      Hi,

       

      I have solved the issue Alhamdulillah by the foll. method:

       

      1. Copied CL_GOS_SRV_ATTACHMENT_LIST to ZCL_GOS_SRV_ATTACHMENT_LIST

      2. In ZCL_GOS_SRV_ATTACHMENT_LIST there is a method called: CHECK_STATUS. I overwrote with my check;

      on_mode_changed( 'D' ). --- For display

      on_mode_changed( 'E' ). --- For edit mode.

       

      3. In SGOS tcode, added VIEW_ATTA to point to ZCL_GOS_SRV_ATTACHMENT_LIST

       

      Regards,

      Fawaz

      • Re: Disabling 'Change' and 'Delete' button in Attachment List in ME52N
        Henrik Andersson
        Currently Being Moderated

        That solution I also found in note 491271.

         

        I try to disable the "CREATE ATTACHMENT" Service... ..but end up with that both my method AND the SAP method CHECK_STATUS is executed....

         

        I follow the instruction from SAP:

        If you want to provide a service for certain authorizations only, check the SGOSATTR table to see which ABAP OO class implements the service. Create a new subclass, and overwrite the CHECK_STATUS method. Store a separate authorization check here. If this fails, set the service status to inactive. Then enter your new class in SGOSATTR.

         

        I did this...

        New subclass of CL_GOS_SRV_ATTACHMENT_CREATE >> ZCL_GOS_SRV_ATTACHMENT_CREATE.

        In this Z-class I Redefined the CHECK_STATUS method with my coding.

        I changed the table entry in table SGOSATTR to point at ZCL_GOS_SRV_ATTACHMENT_CREATE.

         

        Then when I select an invoice via FB03 and press the Attachment List button...

        I do dive into my CHECK_STATUS method

        ....BUT....AFTER my CHECK_STATUS was executed  SAP also execute the standard CHECK_STATUS method belonging to CL_GOS_SRV_ATTACHMENT_CREATE (the class that I created a new subclass)

         

        Why??

        What did I do wrong??

         

        Best regards

        Henrik

        • Re: Disabling 'Change' and 'Delete' button in Attachment List in ME52N
          GET SAP
          Currently Being Moderated

          Hi,

           

          Probably you have uncommented the call to super class when you reimplement the method on child class (z class)

           

          I just implement the same thing now and it worked for me. Take a look:

           

          1 - Modify the SGOSATTR table by SM30, just write a Z class (in my case CL_GOS_SRV_ATTACHMENT_CREATE) .

          2 - Create/inheridt a subclass (not a copy) in SE24 of the standard class.

          3 - Implement the method CHECK_STATUS in the z class. Note that the call to method on super class came commented. You only uncomment if you want to also execute a standard code in the super class.

           

          Here is my code:

           

           

          method CHECK_STATUS.

           

            • NOTE - In my real implementation I have uncommented the code below because I want do standard code be executed before my own check.

           

          *CALL METHOD SUPER->CHECK_STATUS

          • EXPORTING

          •    IS_LPORB  = IS_LPORB

          •    IS_OBJECT = IS_OBJECT

          • IMPORTING

          •    EP_STATUS = EP_STATUS

          •    EP_ICON   = EP_ICON

              .

           

          •   Check for BUS2012 = Bussinnes Object for Purchase Order

          •   IF IS_LPORB.TYPEID = BUS2012

          •   Check authorization and disable create attachment item if the user does not have authority...

           

           

          IF IS_LPORB-TYPEID = 'BUS2012'.

           

          AUTHORITY-CHECK OBJECT 'Z_MM001' ID 'ACTVT' FIELD '01'.

           

            IF sy-subrc <> 0.

              ep_status = mp_status_inactive.

            ENDIF.

           

          ENDIF.

           

           

          endmethod.

           

           

          Regards,

          Alexandre

Actions