cancel
Showing results for 
Search instead for 
Did you mean: 

Achieving data display to countrywise authorized users

Former Member
0 Kudos

Hi <b>B</b>est and <b>W</b>ise gurus,

The scenario is like this:

There are two characteristics ZUSER(user) and ZCOUNTRY(country). The country refers to the

country in which the user is authorized to view data.

User and Country exhibit a many to many relationship.(one user can have authorization in

many countries and vice versa).

Also,the number of users and the countries is very large.

How can we achieve the following?

When a user logs in, the output of the query should be such that the user is able to see the

data pertaining to the country/countries in which he/she is authorized.

Thanks and regards,

Balaji

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

How is the relationship maintained between USER and COUNTRY. Is it defined in some ZTABLE or ODS? (Lets say ZTABLE1)

Once we have that in a table, we can define a 'user exit variable' on the country and get the list by lookin up on that table.

Define a user exit variable on country. Do not check the "ready for input" box.

Use this psuedo code to write your code in ZXRSRU01.

WHEN 'ZCOUNTRY'. " This is your variable on Country

IF I_STEP = 2. "After the popup

DATA:

temp_country of the type country.

internal table ZTABLE1 of type temp_country to hold the country list.

where /bic/zuserid = sy-uname.

select country

from ZTABLE1

into table ZTABLE1

where userID = SY-UNAME.

now all the authorized countries are in the internal table ZTABLE1.

*now loop at ZTABLE1 and return all the values to the query.

CLEAR L_S_RANGE.

loop at ZTABLE1 into temp_country.

L_S_RANGE-LOW = temp_country.

L_S_RANGE-SIGN = 'I'.

L_S_RANGE-OPT = 'EQ'.

APPEND L_S_RANGE TO E_T_RANGE.

EXIT.

ENDLOOP.

ENDIF.

ENDCASE.

Good Luck

Gova

PS: Ideally this should be done by building Authorization on Country. Let me know if you want that approach. All we have to do is define one Authorization Object and one role. We dont have to define different roles to different users. Values can then be populated using user exit.