When you need to mass maintain the User parameters to another value. This
program will come in handy as you do not need to maintain the parameters for
each user manually.
REPORT ZUSERPARAM.
PARAMETERS: P_PARID(3), "Parameter ID
P_PARVA(18), "Parameter Value
P_USER(18). "User Name
TABLES: USR02, USR05.
DATA BEGIN OF IUSR02 OCCURS 5.
INCLUDE STRUCTURE USR02.
DATA END OF IUSR02.
ULINE.
WRITE: /, 'Report Selection criteria:'.
WRITE: /10 'Parameter ID:', P_PARID.
WRITE: /10 ' Parm Value:', P_PARVA.
WRITE: /10 'User Name:', P_USER.
ULINE.
SELECT * FROM USR02 INTO TABLE IUSR02 WHERE BNAME = P_USER.
LOOP AT IUSR02. "Loop thru all users
SELECT SINGLE * FROM USR05
WHERE BNAME = IUSR02-BNAME
AND PARID = P_PARID.
IF SY-SUBRC = 0.
UPDATE USR05
SET PARVA = P_PARVA
WHERE BNAME = IUSR02-BNAME
AND PARID = P_PARID.
IF SY-SUBRC = 0.
WRITE: /5 USR05-BNAME, USR05-PARID, 'Old =', USR05-PARVA,
'New =', P_PARVA.
ELSE.
WRITE: /5 'Update rc=', SY-SUBRC, USR05-BNAME.
EXIT.
ENDIF.
ELSE.
CLEAR USR05.
USR05-BNAME = IUSR02-BNAME.
USR05-PARID = P_PARID.
USR05-PARVA = P_PARVA.
INSERT USR05.
IF SY-SUBRC = 0.
WRITE: /5 'Insert ok:', USR05-BNAME, P_PARID, P_PARVA.
ELSE.
WRITE: /5 'Bad Insert, rc=', SY-SUBRC, USR05-BNAME.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.