2008 Apr 14 4:45 PM
Hi,
Does anyone knows how can I disable the delete button in a maintenance view so when a user that is not authorized can´t delete any row, or how can I lock the delete subroutine.
Thanks!
2008 Apr 14 5:11 PM
Hello Moises
The correct way is to use [Event 19: After Init. Global Variables, Field Symbols, etc.|http://help.sap.com/saphelp_nw2004s/helpdata/en/91/ca9f44a9d111d1a5690000e82deaaa/content.htm] for your maintenance view.
Here you define your authorization check and depending on the result you fill [Internal Table EXCL_CUA_FUNCT|http://help.sap.com/saphelp_nw2004s/helpdata/en/91/ca9f86a9d111d1a5690000e82deaaa/content.htm].
Where do you define these events?
Call the table maintenance generator and choose menu: Environment -> Modification -> Events
Regards
Uwe
Hi,
Does anyone knows how can I disable the delete button in a maintenance view so when a user that is not authorized can´t delete any row, or how can I lock the delete subroutine.
Thanks!
2008 Apr 14 4:48 PM
This should do it for you.
LOOP at SCREEN.
IF SCREEN-NAME EQ 'MY_BUTTON'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Edited by: Paul Chapman on Apr 14, 2008 5:50 PM
2008 Apr 14 5:01 PM
One more thing,
Can I do loop at screen when the delete button DELE is in an application toolbar?? How can I disable a button that is in my application toolbar in PF-STATUS but this pf-satus is declared in a standard program because belongs to a maintenance view code
Thanks for your answers!
2008 Apr 14 5:05 PM
Hi,
In the PF-STATUS loop at SCREEN logic won't work.
Create two PF-STATUS for this logic and then you have to change the logic in the way if the user has authorization set the corresponding PF-STATUS.
Hope this helps.
Thanks,
Greetson
2008 Apr 14 5:09 PM
Moises,
If it's in the Toolbar, you can do it this way.
DATA: excl_tab TYPE sy-ucomm OCCURS 0 WITH HEADER LINE.
CLEAR excl_tab[], excl_tab..
APPEND 'DELE' TO excl_tab.
SET PF-STATUS 'STAT_100' EXCLUDING excl_tab.
2008 Apr 14 5:11 PM
Hello Moises
The correct way is to use [Event 19: After Init. Global Variables, Field Symbols, etc.|http://help.sap.com/saphelp_nw2004s/helpdata/en/91/ca9f44a9d111d1a5690000e82deaaa/content.htm] for your maintenance view.
Here you define your authorization check and depending on the result you fill [Internal Table EXCL_CUA_FUNCT|http://help.sap.com/saphelp_nw2004s/helpdata/en/91/ca9f86a9d111d1a5690000e82deaaa/content.htm].
Where do you define these events?
Call the table maintenance generator and choose menu: Environment -> Modification -> Events
Regards
Uwe
2008 Apr 14 11:11 PM
Hello,
I've created Event No. 19 and then I defined de FORM BEFORE_INIT and I put the next code from Paul:
FORM BEFORE_INIT.
DATA: excl_tab TYPE sy-ucomm OCCURS 0 WITH HEADER LINE.
CLEAR excl_tab[], excl_tab..
APPEND 'DELE' TO excl_tab.
SET PF-STATUS status EXCLUDING excl_tab.
ENDFORM.
But I'm getting an error wich it says, status is the name of the status (but I don't know if is being creted dinamycally):
ABAP STATUS OF THE USER INTERFACE STATUS MISSING
I've tried several ways but nothing,Could you please tell me with an example how to fill the internal table EXCL_CUA_FUNCT. and then modify it. Or what is missing in the code.
Thanks!!
2008 Apr 15 6:53 PM
Thanks all for your help, what I did was in PBO:
DATA: sps_state LIKE sy-pfkey.
DATA: wa_vimexclfun TYPE vimexclfun.
wa_vimexclfun-function = 'DELE'.
APPEND iw_vimexclfun TO excl_cua_funct.
MOVE status TO sps_state.
CALL FUNCTION 'VIEW_SET_PF_STATUS'
EXPORTING
status = sps_state
objimp = x_header-importable
TABLES
excl_cua_funct = excl_cua_funct.
And that solved the problem, Thanks for your help!!
Moises Grappin.
2008 Apr 15 7:59 PM
Hello Moises
The problem with this solution is that if you ever need to modify your maintenance view (i.e. regenerate the dynpros because you may want to add new fields) your coding is gone.
This is not the case if you are using event 19. Below you see same sample coding:
*----------------------------------------------------------------------*
***INCLUDE LZUS_SDN_MAINTF01 . " Function Group with maintenance views
*----------------------------------------------------------------------*
* Event 19: After Init. Global Variables, Field Symbols, etc.
* http://help.sap.com/saphelp_nw2004s/helpdata/en/91/ca9f44a9d111d1a5690000e82deaaa/content.htm
*----------------------------------------------------------------------*
FORM exclude_gui_function.
* define local data
DATA: ls_excl TYPE vimexclfun.
ls_excl-function = 'DELE'. " taken from standard GUI-status 'ZULG'
BREAK-POINT.
AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
ID 'BUKRS' FIELD '1000'
ID 'ACTVT' FIELD '02'.
IF ( syst-subrc NE 0 ).
APPEND ls_excl TO excl_cua_funct.
ENDIF.
APPEND ls_excl TO excl_cua_funct. " Just for the purpose of demonstration
ENDFORM. "exclude_gui_function
Regards
Uwe