SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Mass update the User Parameter Value



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Feb 09, 2008 1:23 am    Post subject: Mass update the User Parameter Value Reply with quote

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.

Code:
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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.