当前用户可以查看的BUKRS列表 [英] List of BUKRS which the current user is allowed to see
本文介绍了当前用户可以查看的BUKRS列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法获取当前用户可以看到的所有BUKRS的列表?
Is there a way to get a list of all BUKRS which the current user is allowed to see?
我想在open sql中使用这个列表作为过滤器.想象一下我搜索的方法的结果将结果存储在 bk_list
中.然后我可以像这样使用 bk_list
:
I want to use this list as a filter in open sql. Imagine the result of the method I search stored the result in bk_list
. Then I could use bk_list
like this:
SELECT * FROM some_table WHERE bukrs IN bk_list
推荐答案
另一种方法,基于 CL_AUTH_OBJECTS_TO_SQL
类(官方支持,从 ABAP 7.50 开始,如文档中所述权威检查),这里的程序读取来自读取授权航空公司的航班:
Another way to do it, based on the class CL_AUTH_OBJECTS_TO_SQL
(officially supported, as of ABAP 7.50, as explained in the documentation of AUTHORITY-CHECK), here the program reads the flights from the read-authorized airline carriers :
DATA(authsql) = cl_auth_objects_to_sql=>create_for_open_sql( ).
authsql->add_authorization_object( EXPORTING
iv_authorization_object = 'S_CARRID'
it_activities = VALUE #( ( auth_field = 'ACTVT' value = '03' ) )
it_field_mapping = VALUE #(
( auth_field = 'CARRID'
view_field = VALUE #( table_ddic_name = 'SFLIGHT' field_name = 'CARRID' ) ) ) ).
DATA(where) = authsql->get_sql_condition( ).
SELECT * FROM sflight INTO TABLE @data(sflights) WHERE (where).
这篇关于当前用户可以查看的BUKRS列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文