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: 

Restrict Access to Database table Entries

Former Member
0 Kudos

Hello All,

How can we restrict the access of Z Database table(SE11) entries to users for the specific company code.

For Example:ZTABLE(SE11) which has data entries of different company codes,If my user name is Anil i should access the Ztable entries only the company code which are authroized to me.

Waiting for your valuable replies.

Regards,

Anil.D

17 REPLIES 17

Former Member
0 Kudos

Hi,

If the only way your users access the table is using SE11 then you cannot apply a restriction to the data records they see.

If you create a bespoke transaction to maintain the table then you can apply the standard authorisation concept using authorisation objects etc.

If you use the table maintenance generator you may be able to use events to limit the records returned, have a search for exits in table maintenance generator if this is of interest.

Regards,

Nick

0 Kudos

Hello Nick,

Yes i created transaction code for the table maintaine,how to assign authorization objects for it.I try by SU24 But did not work.

Regards,

Anil.D

sreemsft
Contributor
0 Kudos

Hi Anil,

I understood that you have a table maintenance for a table and you want to display the records only belongs to a specific user's company code.

For this you need to manually restrict the data which is displaying in the table. There are some exits available in the table maintenance you can try them.

Check this [LINK|https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=93454609]

Thanks,

Sreekanth

Former Member
0 Kudos

Hello Srikanth,

Thankyou for the reply..I will try accordingly...

Let me know any more sugesstions.....

Regards,

Anil.D

Former Member
0 Kudos

Hello Srikanth,

Which event i can use while displaying the data in table maintainece.

Regards,

Anil.D

0 Kudos

Hi,

Use START-OF-SELECTION event for selecting the data and END-OF-SELECTION event to display the data.

Thanks,

Sri.

Former Member
0 Kudos

Hi Sri,

I am not asking about the report events,i want the event in Table maintaince to restrict the display of table entries .

Regards,

Anil.D

huseyindereli
Active Contributor
0 Kudos

Hi Anil ,

Restrict all user for your Z table. Create projection view or database view for the necessary companies than assign the responsibles to these views.

0 Kudos

Hello Huseey,

How to assign responsibiltes to views,Is it possible to restrict the table entreis to display for specific company code.

Regards,

Anil.D

huseyindereli
Active Contributor
0 Kudos

For example if you have 3 company codes for this operation and your table name is ZTABLE than you will create 3 different views for each company. ZTABLE_C100 , ZTABLE_C200 , ZTABLE_C300. By the help of authorization objects , you will assign each view to the responsibles.

0 Kudos

Hello Husey,

Thankyou for the reply.

Can you please tell me how to assign the view to the authorization objects and how it works...can you also send me any link on this topic on how to create different views for single table and assign to authorization objecst...

Regards,

Anil.D

huseyindereli
Active Contributor
0 Kudos

You can create table maintenance for them individually and using the Authorization Group assign different groups.

On the other hand i think it's better that you can create a z program which has a bukrs parameter. At selection screen check for the auto upon current user than , simply use the code below. It's totally what you need.

parameters : p_bukrs type bkpf-bukrs memory id buk.

data : rangetab type table of vimsellist with header line.

*** HERE CHECK AUTHO

  clear : rangetab , rangetab[].

  rangetab-viewfield = 'BUKRS'.
  rangetab-operator  = 'EQ'.
  rangetab-value = p_bukrs.
  rangetab-tabix  = 2.
  rangetab-converted = 'X'.
  append rangetab.

  call function 'VIEW_MAINTENANCE_CALL'
    exporting
      action                       = p_action   " S - display U-edit
      view_name                    = 'ZTABLE'
      check_ddic_mainflag          = 'X'
    tables
      dba_sellist                  = 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.

0 Kudos

Hello Husey,

Yes i tried even using this program it is showing the following message

No entries found that match selection criteria but the entries which i give in selection criteria is exist.

Regards,

Anil.D

huseyindereli
Active Contributor
0 Kudos

For the autho check ;

authority-check object 'F_BKPF_BUK'
            id 'BUKRS' field p_bukrs
            id 'ACTVT' field '02'.  " 02 Change 03 Display

huseyindereli
Active Contributor
0 Kudos

Tabix field represents the order of the field in your ZTABLE. I mean change the tabix field to your field order. In the example below tabix = 3.

ZTABLE fields ;

MANDT

GJAHR

BUKRS

BELNR

0 Kudos

Yes i gave tabix value as in the table still it is showing the same message.

Regards,

Anil.D

huseyindereli
Active Contributor
0 Kudos

Hi ,

I've got one which is definitely working so double check your table name , field name and rangetab[] . If you get the same message again , i have no idea.

Regards.