Posted: Fri Jan 22, 2010 4:15 pm Post subject: Profile listing according to user-id or client
Code:
REPORT ZBCAUTH1 .
*
************************************************************************
*
* Profile listing according to Erikki Tikka
* user-id or client Sni-Finland
* 150495
************************************************************************
*
TABLES: USR01, USR04.
*
PARAMETERS: CLIENT LIKE SY-MANDT DEFAULT '* ',
USER LIKE USR01-BNAME DEFAULT '*'.
*
DATA:BEGIN OF IUSR01 OCCURS 0.
INCLUDE STRUCTURE USR01.
DATA:END OF IUSR01.
DATA:ED-BNAME LIKE USR01-BNAME.
*
IF CLIENT = '*'.
CASE USER.
WHEN '*'.
PERFORM ALL-ALL.
WHEN OTHERS.
PERFORM ALL-ONE.
ENDCASE.
ELSE.
CASE USER.
WHEN '*'.
PERFORM ONE-ALL.
WHEN OTHERS.
PERFORM ONE-ONE.
ENDCASE.
ENDIF.
*
FORM ALL-ALL.
************************************************************************
* Selection from all excisting Clients / All users
************************************************************************
*
SELECT * FROM USR01
CLIENT SPECIFIED
INTO TABLE IUSR01.
*
SORT IUSR01 BY BNAME MANDT.
*
PERFORM LOOP-IUSR01.
*
ENDFORM.
*
FORM ALL-ONE.
************************************************************************
* Selection from all excisting Clients / One user
************************************************************************
*
SELECT * FROM USR01
CLIENT SPECIFIED
INTO TABLE IUSR01
WHERE BNAME = USER.
*
SORT IUSR01 BY BNAME MANDT.
*
PERFORM LOOP-IUSR01.
*
ENDFORM.
*
FORM ONE-ALL.
************************************************************************
* Selection from one excisting Client / All users
************************************************************************
*
SELECT * FROM USR01
CLIENT SPECIFIED
INTO TABLE IUSR01
WHERE MANDT = CLIENT.
*
SORT IUSR01 BY BNAME MANDT.
*
PERFORM LOOP-IUSR01.
ENDFORM.
*
PERFORM LOOP-IUSR01.
*
FORM ONE-ONE.
************************************************************************
* Selection from one excisting Client / One users
************************************************************************
*
SELECT * FROM USR01
CLIENT SPECIFIED
INTO TABLE IUSR01
WHERE MANDT = CLIENT AND
BNAME = USER.
*
SORT IUSR01 BY BNAME MANDT.
ENDFORM.
*
PERFORM LOOP-IUSR01.
*
FORM LOOP-IUSR01.
************************************************************************
* Loop internal-table / Search valid Profiles
************************************************************************
LOOP AT IUSR01.
IF ED-BNAME <> IUSR01-BNAME.
WRITE /.
WRITE: /2 IUSR01-BNAME.
ENDIF.
ED-BNAME = IUSR01-BNAME.
SELECT * FROM USR04
CLIENT SPECIFIED
WHERE BNAME = IUSR01-BNAME AND
MANDT = IUSR01-MANDT.
PERFORM WRITE-RESULT.
ENDSELECT.
ENDLOOP.
ENDFORM.
*
FORM WRITE-RESULT.
************************************************************************
* Prints out the result
************************************************************************
*
WRITE: /2 IUSR01-MANDT, 6 USR04-NRPRO, 15 USR04-PROFS+2.
ENDFORM.
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.