2006 Jun 27 1:24 AM
Hi all!!!!
I wonder if somebody of you have done somethig like this...
I created a Z table with these fields
MANDT
UNAME
ID
DESCR
So this table is for all users going to the SM30 but i don't want to show all the records of all the users in the table, just show the records the user creates, for that reason i'm using the uname field to validate the user.
Have you ever had this problem??
redards!!
Hi all!!!!
I wonder if somebody of you have done somethig like this...
I created a Z table with these fields
MANDT
UNAME
ID
DESCR
So this table is for all users going to the SM30 but i don't want to show all the records of all the users in the table, just show the records the user creates, for that reason i'm using the uname field to validate the user.
Have you ever had this problem??
redards!!
2006 Jun 27 1:57 AM
Hi Adrian,
Have you looked FM <b>VIEW_MAINTENANCE_CALL</b> instead of SM30?
You can assign the correspondence user name (SY-UNAME) to uname field when you build tables parameter DBA_SELLIST.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
ACTION = 'U'
VIEW_NAME = 'ZTAB'
TABLES
DBA_SELLIST = IT_RANGETAB
EXCEPTIONS
CLIENT_REFERENCE = 1
FOREIGN_LOCK = 2
INVALID_ACTION = 3
NO_CLIENTINDEPENDENT_AUTH = 4
NO_DATABASE_FUNCTION = 5
NO_EDITOR_FUNCTION = 6
NO_SHOW_AUTH = 7
NO_TVDIR_ENTRY = 8
NO_UPD_AUTH = 9
ONLY_SHOW_ALLOWED = 10
SYSTEM_FAILURE = 11
UNKNOWN_FIELD_IN_DBA_SELLIST = 12
VIEW_NOT_FOUND = 13
MAINTENANCE_PROHIBITED = 14
OTHERS = 15.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.Hope this will help.
Regards,
Ferry Lianto
2006 Jun 27 2:31 AM
you can use events in table maintenance to achieve this.
In se11/12 for the table : utilities->table maintenance generator
After generating the maintenance view,
environment->modification->events.
Event AA can be used to over-ride the standard read routine. So you can put your own code in to only read records belong to the current user, the TOTAL table is the one used to hold the data used by the reat of the program. znrw_uname was the table I used to test it on.
There are other events that might be useful to you to, for example to hide/protect the uname field itself (as this will always default to sy-uname).
eg,
form new_read.
data: lt_znrw_uname type table of znrw_uname.
types begin of ty_total.
include structure znrw_uname.
include structure vimtbflags.
types end of ty_total.
data lt type table of ty_total.
select * from znrw_uname
into corresponding fields of table lt
where uname = sy-uname.
copy data to TOTAL table
total[] = lt[].
endform.