
SAP BASIS ADMINISTRATION TIPS
Assigning Tcodes to new roles from a text file
chris crofoot 10.24.2003
Rating: -3.50- (out of 5)




Creating a new role from scratch can be tedious and SAP hasn't provided a user friendly way of assigning a large number of Tcodes to a new role. This program allows you to take a text file (converted from Excel) and insert the Tcodes directly into the role menu. It is then a simple matter of creating the authorization profile from the new Tcodes. The code was written in R/3 4.6C.
Code
REPORT z_role_tcode_addition .
************************************************************************
* Program to write tcodes from text file to a Role
*
************************************************************************
* 10.07.03 CWC Created
************************************************************************
TABLES: cus_actobj, agr_tcodes.
DATA: iagrtc LIKE agr_tcodes OCCURS 1000 WITH HEADER LINE.
* Table to store the uploaded file.
DATA : BEGIN OF itab OCCURS 0,
tcode LIKE agr_tcodes-tcode,
END OF itab.
* Input file parameter.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: role LIKE agr_tcodes-agr_name OBLIGATORY.
PARAMETERS: ifile LIKE rlgrap-filename OBLIGATORY .
SELECTION-SCREEN END OF BLOCK b1.
**** Drop down for the file search
AT SELECTION-SCREEN ON VALUE-REQUEST FOR ifile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = '*.txt' " ifile
mask = ',*.*,*.*.'
mode = '0'
title = 'Select The Input File'
IMPORTING
filename = ifile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <:> 0.
STOP.
ENDIF.
START-OF-SELECTION.
PERFORM up_load.
PERFORM process_itab.
*&---------------------------------------------------------------------*
*& Form up_load
*&---------------------------------------------------------------------*
FORM up_load.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = ifile
filetype = 'DAT'
TABLES
data_tab = itab.
IF sy-subrc NE 0.
MESSAGE e368(00) WITH 'Error in uploading the file ' .
ENDIF.
ENDFORM. " up_load
*&---------------------------------------------------------------------*
*& Form process_itab
*&---------------------------------------------------------------------*
FORM process_itab.
iagrtc-agr_name = role.
iagrtc-type = 'TR'.
iagrtc-direct = 'X'.
LOOP AT itab.
iagrtc-tcode = itab-tcode.
APPEND iagrtc.
write: / iagrtc-agr_name, iagrtc-tcode.
ENDLOOP.
MODIFY agr_tcodes FROM TABLE iagrtc.
ENDFORM. " process_itab
 |

|
Rate this Tip
|
To rate tips, you must be a member of SearchSAP.com. Register now
to start rating these tips. Log in if you are already a member.
|

Submit a Tip
|


');
// -->
DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.
|
 |
|
|
 |
|
 |