Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

LSMW - create batch input session

Former Member
0 Kudos

Hi,

I created LSMW script for PFCG to assign role to user but in the 13th step it is giving me only 1 batch input session created where as i have given 3 rows in the input file and when i execute this in foreground it is assigning for 1 user and for the rest 2users it is saying no batch input was created. please advise.

Thx,

Lisa

1 ACCEPTED SOLUTION

jurjen_heeck
Active Contributor
0 Kudos

I do not know how well LSMW and PFCG work together for role assignment.

I prefer using SU10.

Record with selecting one user and assigning one role at a time.

26 REPLIES 26

jurjen_heeck
Active Contributor
0 Kudos

I do not know how well LSMW and PFCG work together for role assignment.

I prefer using SU10.

Record with selecting one user and assigning one role at a time.

Former Member
0 Kudos

yes i guess you might be right,

I just created LSMW script successfully with pfcg recording and i created a .txt file( tab delinited) with one test role and three user id's as follow:

ROLE USERID

Z:TEST TEST1

Z:TEST TEST2

Z:TEST TEST3

when i run the script in the step number 14 it is assigning the user: test1 to this role and again while assigning the test2 it is overiding the test1 and tes3 overidin test2, looks like it is recorded the first line in the user tab, please advise to solve this.

former_member182098
Active Contributor
0 Kudos

Hello,

If you have same number of role in the excel sheet then PFCG will work for assignment. If you have different number of roles for each user, then it will not work.

You should go with SU10

Segregate the users per each role.

Then go to SU10

Add the users

Go to roles tab and make change for all users.

SU10 is the most easiest way for adding role to multiple users.

Regards,

Ravi

Former Member
0 Kudos

Ravi,

i have same 3 roles (Z:test) to different users: test1, test2 and test 3, in my lsmw script with pfcg

I understand that Su10 is better option but still why it is overiding the test1 with test2 and test2 with test3 when i execute the lsmw script with pfcg. it suppose to tab to next line.

0 Kudos

Your basic problem is cursor positioning.

After assigning your role to the first user, on line 1 in the PFCG user tab, the LSMW needs to go to line 2 in the user tab because line one is already occupied. LSMW is not capable of sensing/doing that.

I am not within reach of a system at the moment but some subscreens have the option to position the cursor in line one and hit a button to insert a new line. If you record that sequence there shouldn't be a problem. I use it with SECATT to assign single roles to composites in PFCG.

In SU10 you'll never see the roles already assigned so you can rely on line 1 being available. Just make sure you do not use SU10 as intended while recording. Enter one user and assign one new role in your recording. That'll make it repeatable.

0 Kudos

If you have exactly same number of roles for all the users (I assume that there are no roles already existing in any one of the users, because if they are already having some roles on their user account, then those lines get already filled and system cannot overwirte. Please make sure that all the users are having ZERO roles or currently containing similar number of roles). Because, I have execute even through LSMW, the role assignment WITHOUT any hassles in the past. So, thee is NO reason why it CANNOT be executed.

Anyway, I am attaching herewith a sample LSMW document, please go through once and see in case if there are any steps missing or doing something wrong.

http://www.scmexpertonline.com/downloads/SCM_LSMW_StepsOnWeb.doc

Regards,

Ravi

Former Member
0 Kudos

Hi,

When you have availabilty of system please let me know the option to position the cursor at first empty line of the user tab in Pfcg, positioning at line 1 and inserting may not work as any particular role might have n number of users so better cursor hit the first empty one. if role has already 10 users in user tab then cursor should hit 11th row.

Thx a lot

lisa

0 Kudos

> When you have availabilty of system please let me know the option to position the cursor at first empty line of the user tab in Pfcg

Sorry, I will do no such thing. SU10 will prove to be your solution, with or without recordings in LSMW or SECATT. Trust me.

0 Kudos

I was thinking the same thing, or even using a reference user if the role is the same for all the users.

Cheers,

Julius

0 Kudos

Hi,

Though I am not in front of the system I will try to explain each step in detail.

Maintain Object Attributes

Do the recording - Make sure that you do not have two fields with the similar name. If you have two fields with the same name double click on the field name and add1 or 2 to differentiate between field names. Just Copy those fields and descriptions in excel sheet, delete the blank lines, then in excel

data => text to columns, your field names and descriptions will be now in two columns. Copy them, then put your cursor on the next sheet, then edit => Paste Special => Transpose, all the columns will become your rows. Now your file structure is ready.

Maintain Source Structures

Give some unique structure name and description

Maintain Source Fields

Here you add the fields that are being used in EXCEL first sheet, just copy them and make all the fields as C (Constant) and then give length of 60 for all fields.

Maintain Structure Relations

Though structure relations are already created just go to this step, click on edit, then click on create structure relation, just accept the message stating that the structure relation has already been created.

Maintain Field Mapping and Conversion Rules

Do the field mapping for all the fields, all the fields willl be stretched and you will see five rows against each row. In case if there is any row that has NOT stretched means, there is something wrong in the mapping.

Maintain Fixed Values, Translations, User-Defined Routines

There is nothing to be done at this step. You can simply ignore this.

Specify Files

Make you must have saved your excel file as .txt (before saving make sure you have copied data from sheet2 to sheet 3 and then sheet 3 is saved at tab delimited file. Text (Tab delimited) Select your file, make SURE that you have select "TABULATOR" radio button and say OK.

Assign Files

Go to this step and click on Create assignment button and accept the message and say ok.

Read Data

Remove two check boxes and just click on execute button. See the log. Make sure you have number of entries (lines) in your excel file are matching with this.

Display Read Data

Display data give 1 to 999 lines and double click on one of the line and see whether fields are mapped correctly are not.

Convert Data

Execute and see the log match the number of entries.

Display Converted Data

Display converted data, give 1 to 999 and double click on one of the line and see whether fields are mapped correctly or not.

Create Batch Input Session

Check on Keep Batch Input sessions check box, then execute. If you select that check box, even after execution it will be there and you can analyze what happened.

Run Batch Input Session (Takes you to SM35)

Go to SM35 select the batch and click on process button (execute), make sure you have checked right hand side first three check boxes and FOREGROUND (because you want to save what it is creating)

Say OK

Keep on press ENTER on your key board in order to move the session further.

If you follow these steps along with the guide, surely you should be successful.

There may be small difference between the file and what I have explained but ultimately the purpose is same.

Hope this is useful and let me know in case if you have any issues.

Regards,

Ravi

Former Member
0 Kudos

Ravi,

I have a LSMW script recorded using PFCG to assign 1 user to a role so that if i have n number of entries in input file it will run or repeat........

but when i execute script user 1 in the file got assign to role in the line number 1 in the user tab and there after the line number 1 is getting overwritten untill last user in the file.... so by the time script completes only last user in the input file got assigned (only one user)....so question here is simple..how to position the cursor to next line while recording...or is there any option for this after recording also....hope this explanation helps

Thx

Lisa

Former Member
0 Kudos

Ravi,

I have already done all these 14 steps successfully for 2 scripts........

1. LSMW script recorded with Su10 and executed it was successful in execution as well

2. LSMW script recorded with PFCG and exexuted and was not successfull as it is overiding 1st line

My only question is do we have solution to avoid this.......

and also you came up with below explanation while doing step:1

" Hi, Though I am not in front of the system I will try to explain each step in detail. Maintain Object Attributes Do the recording - Make sure that you do not have two fields with the similar name. If you have two fields with the same name double click on the field name and add1 or 2 to differentiate between field names. Just Copy those fields and descriptions in excel sheet, delete the blank lines, then in excel data => text to columns, your field names and descriptions will be now in two columns. Copy them, then put your cursor on the next sheet, then edit => Paste Special => Transpose, all the columns will become your rows. Now your file structure is ready. "

by doing this can we avoid this overiding ????? hope you got this........

0 Kudos

Hello,

If you want to LSMW through recording for assignment of roles to users.

Make sure that all the users are having similar roles OR no roles.

As you said in your reply, you have already executed SU10 and assigned some roles. For example if you have assigned 10 roles to 10 users.

Now you are doing LSMW for 20 Users (including the ten users uploaded through SU10)

Presume that if you have created a FRESH user in recording and assigned two roles, your cursor will go to first field of role tab. Because it is FRESH user record.

When you are uploading the file (presume that all 20 users including 10 users created through SU10) with two roles. In this case fresh 10 user records which are not created through SU10 WILL BE SUCCESSFUL. The users created through SU10 will be failed. (Note that SYSTEM WILL NOT even overwrite).

Because your cursor go to the first screen for the SU10 user, where there is already a record which you have assigned through SU10. Therefore, system cannot write there and it will be failed. The same logic applies to all 10 users uploaded through SU10.

I would like to confirm that if we want to upload through LSMW through recording, all the users must have similar number of roles or ZERO ROLES.

Hope I am clear.

Regards,

Ravi

0 Kudos

For your question:

Maintain Object Attributes :

They are nothing to avoid any overwriting capability. It is just to identify the system and differentiate the field names by the system at the time of uploading.

Note that LSMW cannot OVERWRITE an USER in case if the SAME user name is already existing.

Similary, if you have a role in the first field for the user, LSMW cannot overwrite, because it is in DISPLAY mode.

Regards,

Ravi

0 Kudos

Overall, wanted to add that I'm amazed that someone uses LSMW to create roles. Having worked in Basis for 11+ years, this is the first I've read that anyone uses other than PFCG to do role creation . To me LSMW is a (one possible) functional tool for migrating data and not for creating roles.

Understand that I'm not being sarcastic but I am amazed. IMHO.

0 Kudos

Hello,

LSMW is just to create role name and role description, beyond that you cannot use it for changing the authorization data.

Regards,

Ravi

Former Member
0 Kudos

Ravi,

i totatly did not get you and I am sorry to say this...

FYI...I just created 2 LSMW scripts and testing them with just 3 users

LSMW with su10....the input file is this:

USERID ROLE

TEST1 Z:TEST

TEST2 Z:TEST

TEST3 Z:TEST

once this execution was successful I went to role Z:TEST and removed Users: test1, test2 and test3

then i went to execute the LSMW with pfcg and input file is :

ROLE USERID

Z:TEST TEST1

Z:TEST TEST2

Z:TEST TEST3

so while the script is running in foreground TEST1 got assigned to Z:TEST in line number 1 in user tab and there after it is overwritten with TEST2 and then TEST3 in line number 1 in user tab so by the time script completes only TEST3 got assigned to Z:TEST in line number 1 in user tab

Please dont relate these 2 LSMW script as i removed users TEST1, TEST2 and TEST3 after 1st LSMW script exection and this is more over the testing of LSMW script..so my only question is LSMw script with pfcg why it is over written in line number 1 in user tab in ther Role: Z:TEST.

0 Kudos

Hello,

Display Converted Data

Display converted data, give 1 to 999 and double click on one of the line and see whether fields are mapped correctly or not.

Can please check the above step.

Are the mappings are correct. Since there are three entries, you can double click on each entry and see whether the entries are mapped correctly or not. If there is entries are mapped correctly shown here itself, there is no question of overwriting. If there entries are not mapped here, then there is a problem in the mapping of structure / file format.

Regards,

Ravi

Former Member
0 Kudos

Ravi,

Clicked on one record in the display converted data screen and here are the details:

File LSMW_SECURITY1_ROLES_ROLE_REC.lsmw.conv

Structure PFCG_REC

ld Name Fld Text FldValue

TABNAME Table Name PFCG_REC

CODE Transaction Code PFCG

ROLE Z:TEST

USERID TEST1

and input file details i already mentioned, appreciate if you try in the system and give answers instead of giving orally to avoid the answers like may be... coube be....

Former Member
0 Kudos

Ravi,

Why cant you try in the system and see what is happening and that will take just 5 to 10 min to do this with 3 users.......

My worry is IF there is problem in mapping and in convert date it shoud occur in my 1st script as i am following the same procedure in both the scripts but I am fine in su10 1st script....

definitely some thing is misiing or it is not possible to do with pfcg as it is over writing, you can experience this if you log in to system and do by your self, if you keep on answering as per books it will cook for ever, so please dont answer with out trying in the system by yourself this time please.

0 Kudos

Because, in number of projects I have used LSMW for the same purpose. Not just for 3 users. For thousands of users I have used LSMW to update their master record with the roles. I am not trying to tell you based on the cook books, but with the real experience. More than thousand times, I run LSMW and I believe this is most easiest thing in SAP and consider myself master in this area (at least in recording)

If I am not confident enough, I would not have answered you at all.

As requested by you, I have created 3 roles

ZROLE1

ZROLE2

ZROLE3

My Three Users are

ZTEST1

ZTEST2

ZTEST3

For your kind information: I have opened all three users and each user is having 3 roles in my system.

Still If you are having issues, then I should visit you

Note: It has taken not even five minutes for me.

Following is the log:

16:10:48 Session USERTEST is being processed by user R19109 in mode A on server d8u 0 0 S 00 300

16:10:51 User ZTEST1 was saved SU01 1 SAPMSSY0 1000 4 S 01 226

16:10:51 Transaction was processed successfully SU01 1 0 S 00 355

16:10:52 User ZTEST2 was saved SU01 2 SAPMSSY0 1000 4 S 01 226

16:10:53 Transaction was processed successfully SU01 2 0 S 00 355

16:10:54 User ZTEST3 was saved SU01 3 SAPMSSY0 1000 4 S 01 226

16:10:55 Transaction was processed successfully SU01 3 0 S 00 355

16:10:55 Processing statistics 0 0 S 00 370

16:10:55 3 transactions read 0 0 S 00 363

16:10:55 3 transactions processed 0 0 S 00 364

16:10:55 0 transactions with errors 0 0 S 00 365

16:10:55 0 transactions deleted 0 0 S 00 366

16:10:55 Batch input processing ended 0 0 S 00 382

Please let me know if you are having still any issues.

Regards,

Ravi

Former Member
0 Kudos

Ravi,

Looks like you have recorded your LSMW script with SU01 as per your LOG, As i mentioned earlier I am also successful in LSMW with SU01 and SU10..................

can you try with PFCG and see what is happening...................

when you do this atleast assign 2 users to any one particular role so that you can make sure it is over writing or not.

0 Kudos

I will never use PFCG in recording to assign the users, hence I will not recommend PFCG.

Nowhere, I have mentioned to use PFCG for recording purpose to assign users. I have only used PFCG in LSMW for uploading ROLE NAME and DESCRIPTION in my previous projects.

I have tried from PFCG perspective what you have done and the system is NOT able to display converted Data. This is what I have suggested in my previous reply to check. If you have check probably you would have traced out the error at that step itself. There itself, the system is not able to pick the data against the user names. Hence, this will not work.

The above statement is again based on what I have done on system, but not COOK BOOK

Hope I am clear..

Regards,

Ravi

Former Member
0 Kudos

ravi,

from starting onwards i am clear on my question saying i am fine on script one with su01 or su10 and question is specific to pfcg recording and you gave long answers with procedures and experience and finally you came up with answer saying big no for pfcg, if you notice 2 other responses from this tread they told the same in the first response only where as you told in last response, any way thx for ur time ravi, take care.

0 Kudos

Thanks for your time and understanding.

Regards,

Ravi

0 Kudos

Hi Ravi,

I have tried recording SU01 on LSMW but it only gives me a process recording screen not the start screen for su01. LSMW has worked for other tcodes. is there anything specific I need to do?

Regards,

Ann Muhoro.