on 03-04-2008 11:55 PM
Hi,
Could you please let me have tables or FM that will give me a (in a table format) the attribites associated to a user/ all users
Cheers
B
Guys help me out here,
You are way ahead of me, would you please give me a step by step guide to do this.
Thanks a ton
B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please create the program in SE38 (please see my above reply).
The i have populated the logic for Company Code and cost center here
ls_attr_list-attr_id = 'BUK'. "Company Code
APPEND ls_attr_list TO lt_attr_list.
ls_attr_list-attr_id = 'CNT'. "Cost Center
APPEND ls_attr_list TO lt_attr_list.
Now "BUK" stands for Company code and "CNT" for cost center.
Now repeat the below the codes for all the attibutes needed.
ls_attr_list-attr_id = ' <Attribute id here>'. "<- All required attributes one by one
APPEND ls_attr_list TO lt_attr_list.
....
Note: You can find all the attribute ids in the below thread.
And when you execute the program it will display the user attributes in ALV as a table.
Hope now your problem is solved.
Best Regards
Kathirvel
Please use the below program. It will give the exact results.
REPORT zkb_read_attributes.
PARAMETERS: p_user TYPE sy-uname DEFAULT sy-uname OBLIGATORY.
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.
ls_attr_list-attr_id = 'BUK'. "Company Code
APPEND ls_attr_list TO lt_attr_list.
ls_attr_list-attr_id = 'CNT'. "Cost Center
APPEND ls_attr_list TO lt_attr_list.
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.
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.
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.
Regards
Kathirvel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks Disha,
What I actually need is the details of the attributes i.e. user - CC - cost centre number or user - co code - co code number
i want to produce a table that shows the user with the details of the atributes so that I can map the user to the correct attribuites in the new system
thanks
B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just use the FM "BBP_READ_ATTRIBUTES ".Pass the user name to this FM and the attribute names whose value is to be found out as mentioned in the below example!
DATA: ls_attr_single TYPE bbp_attr_list.
DATA: ls_attr_dft_single TYPE bbps_attr_single.
ls_attr_single-attr_id = 'BUK'. " Attribute Needed
CALL FUNCTION 'BBP_READ_ATTRIBUTES'
EXPORTING
iv_user = sy-uname
iv_attr_single = ls_attr_single
IMPORTING
ev_attr_dft_single = ls_attr_dft_single "Value of attr here
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.
BR,
Disha.
Do reward points for useful answers.
Hi,
You can use the FM "BBP_READ_ATTRIBUTES" to get the attribute values for a user.
Also the attributes are stored in the table HRP1222/HRT1222 or view HRV1222A.
BR,
Disha
Do reward points for useful answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.