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

Create SAP users with profiles, address, defaults, and param



 
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: 1640

PostPosted: Sat Nov 17, 2007 7:06 pm    Post subject: Create SAP users with profiles, address, defaults, and param Reply with quote

Create SAP users with profiles, address, defaults, and parameters - BDC program

Code:
REPORT YUSERMOD .

TABLES: USR02.
DATA: BEGIN OF BDC_TAB1 OCCURS 5.
        INCLUDE STRUCTURE BDCDATA.
DATA: END OF BDC_TAB1.
DATA: USER(12) VALUE 'DDDDDDDD',
      INI_PWD(8) VALUE 'INIT',
      DIALOG VALUE 'X',
      PROFILE1(12) VALUE 'SAP_ALL',
      PROFILE2(12) VALUE 'SAP_NEW',
      FULL_NAME(30) VALUE 'Full name',
      PRINT_IMMED VALUE 'X',
      PRINTER_NAME(4) VALUE 'SISK',
      PARAMETER(3) VALUE 'RID',
      PAR_VAL(18) VALUE 'YUSERADD'.

START-OF-SELECTION.

  PERFORM CREATE_USER.
  CALL TRANSACTION 'SU01' USING BDC_TAB1 MODE 'N' UPDATE 'S'.
  PERFORM ADD_ADDRESS_DATA.
  CALL TRANSACTION 'SU01' USING BDC_TAB1 MODE 'N' UPDATE 'S'.
  PERFORM ADD_DEFAULTS.
  CALL TRANSACTION 'SU01' USING BDC_TAB1 MODE 'N' UPDATE 'S'.
  PERFORM ADD_PARAMS.
  CALL TRANSACTION 'SU01' USING BDC_TAB1 MODE 'N' UPDATE 'S'.

*---------------------------------------------------------------------*
*       FORM CREATE_USER                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM CREATE_USER.

  REFRESH BDC_TAB1.
  CLEAR BDC_TAB1.
**************************************************1
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU200-XUSER' TO BDC_TAB1-FNAM,
         USER TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/6' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************2
  MOVE: 'SAPLSUSB' TO BDC_TAB1-PROGRAM,
        '0705' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU213-BCODE' TO BDC_TAB1-FNAM,
          INI_PWD  TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU213-BCODE2' TO BDC_TAB1-FNAM,
          INI_PWD TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU213-DIA' TO BDC_TAB1-FNAM,
          DIALOG TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU213-PROFILE(1)' TO BDC_TAB1-FNAM,
          PROFILE1 TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU213-PROFILE(2)' TO BDC_TAB1-FNAM,
          PROFILE2 TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/5' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************3
  MOVE: 'SAPLSUSB' TO BDC_TAB1-PROGRAM,
        '701' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         'CONT' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************4
  MOVE: 'SAPLSUSB' TO BDC_TAB1-PROGRAM,
        '702' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         'CONT' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************5
  MOVE: 'SAPLSUSB' TO BDC_TAB1-PROGRAM,
        '703' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/12' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************6
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/3' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM GENERATE_BDC_DATA_CR                                     *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM ADD_ADDRESS_DATA.

  REFRESH BDC_TAB1.
  CLEAR BDC_TAB1.
**************************************************1
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU200-XUSER' TO BDC_TAB1-FNAM,
         USER TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/18' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************2
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '320' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'USR03-NAME1' TO BDC_TAB1-FNAM,
          FULL_NAME TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
          '/11' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '320' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
          '/3' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************3
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/3' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM ADD_ADDRESS_DATA                                         *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM ADD_DEFAULTS.

  REFRESH BDC_TAB1.
  CLEAR BDC_TAB1.
**************************************************1
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU200-XUSER' TO BDC_TAB1-FNAM,
         USER TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/17' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************2
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '310' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'USR01-SPLD' TO BDC_TAB1-FNAM,
          PRINTER_NAME TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU310-SPDB1' TO BDC_TAB1-FNAM,
          PRINT_IMMED TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
          '/11' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '320' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
          '/3' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************3
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/3' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM ADD_DEFAULTS                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM ADD_PARAMS.

  REFRESH BDC_TAB1.
  CLEAR BDC_TAB1.
**************************************************1
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU200-XUSER' TO BDC_TAB1-FNAM,
         USER TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/19' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************2
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '350' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU350-PARID(1)' TO BDC_TAB1-FNAM,
          PARAMETER  TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'XU350-PARVA(1)' TO BDC_TAB1-FNAM,
          PAR_VAL TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
          '/11' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '320' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
          '/3' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
**************************************************3
  MOVE: 'SAPMS01J' TO BDC_TAB1-PROGRAM,
        '200' TO BDC_TAB1-DYNPRO,
        'X' TO BDC_TAB1-DYNBEGIN.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
  MOVE: 'BDC_OKCODE' TO BDC_TAB1-FNAM,
         '/3' TO BDC_TAB1-FVAL.
  APPEND BDC_TAB1.CLEAR BDC_TAB1.
ENDFORM.
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.