当前用户可以看到的BUKRS列表 [英] List of BUKRS which the current user is allowed to see

查看:150
本文介绍了当前用户可以看到的BUKRS列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取允许当前用户查看的所有BUKRS列表?

Is there a way to get a list of all BUKRS which the current user is allowed to see?

我想将此列表用作开放式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开始受官方支持,如 AUTHORITY-CHECK ),此处程序从已获得授权的航空公司读取航班:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆