Lsmw Criacao Usuarios Mass
-
Upload
jacyr-jefferson-popenda -
Category
Documents
-
view
223 -
download
0
Transcript of Lsmw Criacao Usuarios Mass
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 1/12
LSMW – Mass User Creation
By Aninda, on January 11th, 2011
advertising
LSMW stands for Legacy System Migration WorkBench. Originally it was a tool supplied by
SAP to migrate data from a legacy system to SAP. However, as we will see in this article, it can be used to upload almost any data into SAP. In the present case, we will be creating a lsmw
script to create a bunch of user ids, a job which is common for any security administrator. Since
lsmw is based on sap BDC (batch-data-communication sessions) we would have to first create a
recording to store the entire sequence of actions involved in creating a user, read the user data for a set of users from a data file and use the read data to create a session for user creation. At the
final step we would run the session to actually create the users. Though I have taken the example
of user creation, by no means should it be assumed that this is the only application of lsmw insecurity. As long as you can create a recording for a sequence of repetitive actions, lsmw can
step in and lighten your load.
To start LSMW we use the transaction “lsmw”. We start create a project, subproject and object
as shown below.
lsmw - create project
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 2/12
Once the project is created we are greeted with the lsmw main screen showing a set of actions
needed to create the complete script. Depending on the nature of the script and the data all or
some of these option need to be updated.
lsmw - main screen
Step 1 – We start by maintain the object attributes. The most important attribute which needs to be specified is the name of the recording which will be used to create the BDC session. A
recording is basically a set of actions that the script will replicate during executing. We can
create a recording from following the menu options in the same screen. In the present case, wecreate a recoding for the SU01 transaction and fill up the various input fields needed to create a
user.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 3/12
lsmw - maintain object attributes
Step 2 – We create a source structure to store the data needed for the script. This will store theuser attributes needed by the script.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 4/12
lsmw - display source structure
Step 3 – Next we maintain the data fields in the source structure. In the present case, I have only
used the data fields – system id, last name, first name, department, email, user group and
password. Nothing is really stopping you from using more or less fields. Note that unless all
users use the same roles, it would be difficult to incorporate role addition into the same script.
lsmw - source fields
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 5/12
Step 4 – Next we maintain the structure relations. Since we defined only one structure in our
script, we accept the default values suggested and click save. This single data structure is used
as the data source for the recording that is used to create each user.
lsmw - maintain structure
Step 4: Maintain field mapping between the data structure and the fields used in the recording.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 6/12
lsmw - map structure fields
Step 5: In the next screen we can define our own fixed values, translations or routines to be used
in the script. In the present script, these options are left unused.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 7/12
lsmw - conversion routines
Step 6: In the next screen we define the path and format of the input files which would actually
store the legacy data meant to be loaded by the script. We have used a csv file in the local
machine as our data source.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 8/12
lsmw - specify input files
Step 7: Next we assign the data from the file to any of the structures used in the script. The
present script uses a single file and a single data structure. So we just accept the default values
suggested.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 9/12
lsmw - assign files
Step 8: Next we import the data from the source file
lsmw - import data from file
Step 9: On clicking execute we get the next screen displaying details about the data read. The
input file in our case had 33 records for creation of 33 users.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 10/12
lsmw - show details for import data
Step 10: We can display the read data to verify that input data has been correctly imported into
the script.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 11/12
lsmw - display imported data
Step 11: The next 2 steps are converting imported data and displaying the converted data for
verification. Since, we use imported data without change, these options remain unused for our
script. Finally we generate the BDC session for our recording and using the imported data fromthe source file. Once the BDC session has been successfully generated we use the last screen
option in lsmw or transaction SM35 to execute the session. If the recording is without errors and
the data is correct, executing of the session will create the 33 users whose attributes were
originally provided in the source file.
8/3/2019 Lsmw Criacao Usuarios Mass
http://slidepdf.com/reader/full/lsmw-criacao-usuarios-mass 12/12
lsmw - generate BDC session
LSMW is very similar to creating a recording through transaction SHDB, generating an ABAP
report for the recoding and modifying the generated code to read a source file and use the data to
generate a BDC session. A seasoned ABAP developer might prefer this method as custom code
provides a greater degree of flexibilty to answer complicated user requirements. However,custom code invariably results in greater maintenance and testing effort. So finally which method
you end up following will probably depend on your own special requirements.