Vous êtes sur la page 1sur 2

SAP Community Network Wiki - Code Gallery - Au...

http://wiki.sdn.sap.com/wiki/display/Snippets/Autho...

Log In

Register

About Us

How to Contribute
Welcome Guest

SDN Community
Home Forums Wiki Blogs

BPX Community
Articles eLearning

BusinessObjects
Downloads Code Exchange

University Alliances
Career Center Events

SAP EcoHub
InnoCentive Idea Place

Authorization Objects for a role


Added by Victor Manuel Iniestra Alvarez, last edited by Victor Manuel Iniestra Alvarez on Mar 03, 2010

This report shows the authorization objects for a role. It's intended to be exported to a spreadsheet (use pipe '|' as separator character) * Reporte de los objetos y campos de autorizacin de un rol dado. REPORT zbar_objaut_rol. PARAMETERS: pa_rol TYPE agr_define-agr_name, pa_tecni TYPE char1 AS CHECKBOX DEFAULT 'X', pa_activ TYPE char1 AS CHECKBOX DEFAULT 'X'. DATA: lw_agr_texts LIKE agr_texts, lw_tobj LIKE tobj, lw_tobjt LIKE tobjt, lt_agr_prof TYPE STANDARD TABLE OF agr_prof, lw_agr_prof LIKE LINE OF lt_agr_prof, it_ust10s TYPE STANDARD TABLE OF ust10s, lw_ust10s LIKE LINE OF it_ust10s, it_ust12 TYPE STANDARD TABLE OF ust12, lw_ust12 LIKE LINE OF it_ust12, it_tactz TYPE STANDARD TABLE OF tactz, lw_tactz LIKE LINE OF it_tactz, lw_tactt LIKE tactt, l_perfil TYPE string, l_obj_ant TYPE string, l_campo_ant TYPE string, l_val_1 TYPE string, l_val_2 TYPE string, l_nom_campo TYPE string, l_auth_ant TYPE string, l_flag_actvt TYPE char1. SELECT SINGLE * FROM agr_texts INTO CORRESPONDING FIELDS OF lw_agr_texts WHERE agr_name = pa_rol AND spras = sy-langu. WRITE: 'Rol: |',pa_rol,'|',lw_agr_texts-text,/. SELECT * FROM agr_prof INTO TABLE lt_agr_prof WHERE agr_name = pa_rol. LOOP AT lt_agr_prof INTO lw_agr_prof. WRITE: 'l_perfil:'. IF pa_tecni = 'X'. l_perfil = lw_agr_prof-profile. CONDENSE l_perfil. WRITE: l_perfil,'|'. ENDIF. l_perfil = lw_agr_prof-ptext. CONDENSE l_perfil. WRITE: l_perfil,'(',lw_agr_prof-langu,')',/. WRITE: 'OBJETOS DE AUTORIZACIN:',/. SELECT * FROM ust10s INTO TABLE it_ust10s WHERE profn = lw_agr_prof-profile. * LOOP AT it_ust10s INTO lw_ust10s. IF l_obj_ant <> lw_ust10s-objct. l_campo_ant = ''. l_flag_actvt = 'X'. l_auth_ant = ''. NEW-LINE. SELECT SINGLE * FROM tobj INTO CORRESPONDING FIELDS OF lw_tobj WHERE objct = lw_ust10s-objct. SELECT SINGLE * FROM tobjt INTO CORRESPONDING FIELDS OF lw_tobjt WHERE langu = sy-langu AND object = lw_ust10s-objct. WRITE: /,'Clase: ',lw_tobj-oclss. NEW-LINE. l_obj_ant = lw_ust10s-objct. IF pa_tecni = 'X'. CONDENSE l_obj_ant. WRITE: l_obj_ant,'|'. ENDIF. WRITE: lw_tobjt-ttext. ENDIF. SELECT * FROM ust12 INTO TABLE it_ust12 WHERE objct = lw_ust10s-objct AND auth = lw_ust10s-auth.

1 of 2

02/10/2011 05:47 PM

SAP Community Network Wiki - Code Gallery - Au...

http://wiki.sdn.sap.com/wiki/display/Snippets/Autho...

LOOP AT it_ust12 INTO lw_ust12. IF l_auth_ant <> lw_ust12-auth. l_auth_ant = lw_ust12-auth. NEW-LINE. WRITE: ' ENDIF. IF l_campo_ant <> lw_ust12-field. l_campo_ant = lw_ust12-field. CONDENSE l_campo_ant. IF pa_activ = 'X' AND l_flag_actvt = 'X' AND l_campo_ant = 'ACTVT'. l_flag_actvt = ''. NEW-LINE. WRITE: ' NEW-LINE. SELECT * FROM tactz INTO TABLE it_tactz WHERE tactz~brobj = lw_ust12-objct. LOOP AT it_tactz INTO lw_tactz. SELECT SINGLE ltext FROM tactt INTO CORRESPONDING FIELDS OF lw_tactt WHERE tactt~spras = sy-langu AND tactt~actvt = lw_tactz-actvt. WRITE: ' lw_tactt-ltext. NEW-LINE. ENDLOOP. ENDIF. NEW-LINE. WRITE: ' '. IF pa_tecni = 'X'. WRITE: l_campo_ant,'|'. ENDIF. SELECT SINGLE ddtext FROM authx INNER JOIN dd04v ON authx~rollname = dd04v~rollname AND ddlanguage = sy-langu INTO l_nom_campo WHERE fieldname = lw_ust12-field. WRITE: l_nom_campo. ENDIF. l_val_1 = lw_ust12-von. CONDENSE l_val_1. l_val_2 = lw_ust12-bis. CONDENSE l_val_2. WRITE: '(',l_val_1,',',l_val_2,'),'. ENDLOOP. ENDLOOP. ENDLOOP. Selection Texts: PA_ACTIV Mostrar actividades permitidas / Show possible activities PA_ROL Clave del Rol / Role / Technical names on PA_TECNI Mostrar nombres tcnicos |',lw_tactz-actvt,'|', |Actividades Posibles:'. ',lw_ust12-auth.

Labels
utilities role authorization abap

ChildPages(1)
Authorization Objects for a transaction

Contact Us Site Index Marketing Opportunities Powered by SAP NetWeaver

Legal Terms

Privacy

Impressum

2 of 2

02/10/2011 05:47 PM