Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling the Print Option in List (System Menu)

kaushalya
Active Participant
0 Kudos

Hi Gurus,

I've a requirement to disable Print option for a custom transaction.

First, I disabled PRINT icon on Standard Tool bar.

This seems worked fine as I added the following code:

   

    DATA itab TYPE TABLE OF sy-ucomm.

 

    APPEND: 'PRIN' TO itab.

    CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'

         EXPORTING

              p_status  = sy-pfkey

         TABLES

              p_exclude = itab.

       SET PF-STATUS 'ZDISP' EXCLUDING itab.

But, still, the user can Print the list from Standard Menu bar (System -> List -> Print) option.

For this I used the menu painter to copy the system menu MENUSYST into my custom program, and modified the system menu.

This also worked fine and now the System -> List -> Print option is disabled.

Except for now when I execute my custom transaction, I see duplicate menus for System and Help on the menu of the screen

And the Print function on the second system menu is enabled!

I can't figure out how to remove this second set of menus or how to modify them.

However, any modification to system user interface will affects system wide. Is there any possibilities to remove system menu or disable list/print option from standard menu bar completely, only for this custom report?

I also tried to use the print authorization object. The issue here is, the common users usually has authorization to print other reports, but need to be restricted from printing this custom report only. Any suggestion would be greatly appreciated.

Thanks in Advance

~Kaushalya

1 ACCEPTED SOLUTION

arindam_m
Active Contributor
0 Kudos

Hi,

The default menu bar options of SYSTEM and HELP i think are selected by default when you try to do a custom menu bar. So, no need to add your own SYSTEM amd HELP which you have done.

Try using a SWITCH option in MENU PAINTER should help you. Check the link to get started.

http://help.sap.com/saphelp_tm80/helpdata/en/d1/801d77454211d189710000e8322d00/content.htm

Cheers,

Arindam

9 REPLIES 9

custodio_deoliveira
Active Contributor
0 Kudos

Hi Kaushalya,

Can't you just check the program name in your code?

Cheers,

Custodio

arindam_m
Active Contributor
0 Kudos

Hi,

The default menu bar options of SYSTEM and HELP i think are selected by default when you try to do a custom menu bar. So, no need to add your own SYSTEM amd HELP which you have done.

Try using a SWITCH option in MENU PAINTER should help you. Check the link to get started.

http://help.sap.com/saphelp_tm80/helpdata/en/d1/801d77454211d189710000e8322d00/content.htm

Cheers,

Arindam

kaushalya
Active Participant
0 Kudos

Hi Arindam,

Thanks for ur suggestion.

But System and Help menu items which are added by default to the menu bar, are not modifiable. And that's actually the main issue here; since they are not shown as editable menu items on menu bar section on menu painter (only Edit, Goto, Extras,and Environment are displayed as Standard items on menu bar), Switch option cannot be used here.

arindam_m
Active Contributor
0 Kudos

Hi,

The options available on the menu is returned by a function code. So try to check the Function Code and simply give a error message so that the print function does not happen. That should be a simple way out.

Cheers,

Arindam

kaushalya
Active Participant
0 Kudos

Hi Arindam,

Since I cannot locate System menu bar from menu painter, I'm lost at how to check the Function code.

Should I trigger the error message from the program code? If so, then could u pls explain the procedure a bit clearer.

Thanks in advance.

Former Member
0 Kudos

Hi Kaushalya,

The Printing of the report can also be prevented on similar lines by checking the

   authorization object 'S_GUI'. 

   For example:- 

   Code:

            AUTHORITY-CHECK OBJECT 'S_GUI' 

                 ID 'ACTVT' FIELD '04'.

Regard's

Smruti

0 Kudos

Hi Smruti,

Thanks for the suggestion,

User are authorized to print any other report except this particular custom report.

Thus the authorization object S_GUI is not helpful here.

0 Kudos

So , Can you check your Program name with User Name ,  i mean to say put validation in your program with Particular Custom Report Name and User Name , if Condition is Match then Raise one Error Message .

SY-REPID ,SY-UNAME .

     AUTHORITY-CHECK OBJECT 'S_GUI'

                 ID 'ACTVT' FIELD '04'.

  IF SY-SUBRC IS INITIAL.

     IF SY-UNAME = 'SMRUTI'  and SY-REPID = 'ZTEST'.

          MESSAGE 'Printing is not permitted for the User' TYPE 'W' DISPLAY LIKE 'E'.

          LEAVE TO SCREEN sy-dynnr.

ENDIF.

ENDIF.

Regard's

Smruti

0 Kudos

Thank you Smruti,

But I couldn't figure out at which event block to put this code, as I tried to call this code bock after END-OF-SELECTION it prevents the display of the list output completely. I just want this message to trigger only when user click on PRINT menu bar item.

Any suggestions would be really helpful.

Thanks in advance.