SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Report to display user attributes



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Sep 13, 2008 6:35 pm    Post subject: Report to display user attributes Reply with quote

The below program takes the User Id and the list of attributes as input and displays the value of the attributes maintained in the Organization structure.

The program uses the standard function module BBP_READ_ATTRIBUTES to read and display the attributes.
Report to display user attributes

Code:
*&---------------------------------------------------------------------*
*& Report  ZKB_READ_ATTRIBUTES
*&---------------------------------------------------------------------*

REPORT  zkb_read_attributes.

*&---------------------------------------------------------------------*
* Data Declaration
*&---------------------------------------------------------------------*
TYPES: BEGIN OF lty_user_attr,
        attr_id        TYPE om_attrib,
        value_logsys TYPE   log_system,
        value          TYPE char30,
       END OF lty_user_attr.

DATA: lo_salv_table TYPE REF TO cl_salv_table.

DATA: lt_user_attr TYPE TABLE OF lty_user_attr.
DATA: lt_attr_list TYPE bbpt_attr_list.
DATA: lt_attr_data TYPE bbpt_attr.
DATA: lt_vlist     TYPE bbpt_attr_values.

DATA: ls_attr_list TYPE bbp_attr_list.
DATA: ls_attr_data TYPE bbps_attr.
DATA: ls_user_attr TYPE lty_user_attr.
DATA: ls_vlist     TYPE bbps_attr_values.
DATA: ls_t77omattr TYPE t77omattr.

*&---------------------------------------------------------------------*
* Selection Screen
*&---------------------------------------------------------------------*
PARAMETERS    : p_user TYPE sy-uname DEFAULT sy-uname OBLIGATORY.
SELECT-OPTIONS: s_attr FOR  ls_t77omattr-attrib  OBLIGATORY NO INTERVALS.

*&---------------------------------------------------------------------*
* START-OF-SELECTION.
*&---------------------------------------------------------------------*
START-OF-SELECTION.
  LOOP AT s_attr.
    CLEAR ls_attr_list.
    ls_attr_list-attr_id = s_attr-low.
    APPEND ls_attr_list TO lt_attr_list.
  ENDLOOP.

* Read Attributes
  CALL FUNCTION 'BBP_READ_ATTRIBUTES'
    EXPORTING
      iv_user                 = p_user
      it_attr_list            = lt_attr_list
    IMPORTING
      et_attr                 = lt_attr_data
    EXCEPTIONS
      object_id_not_found     = 1
      no_attributes_requested = 2
      attributes_read_error   = 3
      OTHERS                  = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

* Populate the Output List
  LOOP AT lt_attr_data INTO ls_attr_data.
    ls_user_attr-attr_id = ls_attr_data-attr_id.
    CLEAR : lt_vlist.
    lt_vlist = ls_attr_data-vlist.
    LOOP AT lt_vlist INTO ls_vlist.
      ls_user_attr-value_logsys = ls_vlist-value_logsys.
      ls_user_attr-value = ls_vlist-value.
      APPEND ls_user_attr TO lt_user_attr.
    ENDLOOP.
  ENDLOOP.

* Display Data in Alv Grid
  CALL METHOD cl_salv_table=>factory
    IMPORTING
      r_salv_table = lo_salv_table
    CHANGING
      t_table      = lt_user_attr.

  CALL METHOD lo_salv_table->display.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.