Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 

Table Authorization control

Through table event

Introduction

Table Maintenance events allow us to change the generated table maintenance dialog at predefined positions or event mentioned. The user routines written for that particular event are called dynamically. For this reason, the routines must be in a user including in the table/view maintenance dialog function group. Using Table maintenance event we can restrict a person from accessing the table or changing deleting etc the records. The biggest plus point of this is that we don’t need to create new report to restrict user.

Steps

To explain functionality of Table event in better way let’s take an example.

Suppose customer came up with a requirement to make a table and provide authorization to particular user to access the table or to display specific data based on value entered on particular field, this can be taken care using table event. Steps are mention below

  • Create a Z table suppose we created a Z table with below mention field

Field Name

Data element

Data type

length

Primary key

Description

MANDT

MANDT

CLNT

3

X

Client

KTOPL

KTOPL

CHAR

4

X

Chart of Accounts

SCOA5

CHAR

5

X

Account number on SCOA level 3

BLART

BLART

CHAR

2

X

Document Type

SHKZG

SHKZG

CHAR

1

X

Debit/Credit Indicator

BEWAR

BEWAR

CHAR

3

Transaction Type

    

     Now we create a maintenance view for the same table.

     We are doing it because in maintenance view we have a column P who’s value when made S a pop up screen appear before maintenance done from SM30

  • Create a maintenance view on the our table which we have created above 
  • Then in view field tab , For field KTOPL make the column P value equal to S

  • After this go for TMG of the view similar to given below screen shot.

  Generate a two step TMG or 1 Step TMG depending upon your requirement.

          Note: The authorization group used here &NC& is just for Demonstration only .. please use other authorization group for authorization purpose.

  •   Then in table maintenance generator , Environment menu -> modification  -> Events

 

Here make a new entry with event 19 and write the code mention in text file a for authorization check (We have taken event 19 because event 19 is called when initialization of global variable take place).

Either you create a T-code for view or you maintain through SM30.

Execution Step.

  •   SM30 T-code, Enter view name.

  •   Click on Maintain, a pop up will appear.

  •   Enter the chart of account, if authorized then will make you see entry for that specific chart of account else it will through error.

        •   Negative scenario

        •   Positive scenario

Even if you click on new entries button, you can only create entry for ES00.

In this way we can use Table event for our purpose. There are lots of other events which you can use as per your requirement. Mention below is snap shot of event present in table event.

Mention below are event that can also be used to auto fill the table fields contents etc.

The

17 Comments