Application Development and Automation 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: 
Read only

LSMW question

Former Member
0 Likes
2,506

Hi everyone,

I have a few questions in LSMW. I have read a lot of content in SDN but wasnt able to get a clear cut solution.

Here are my questions---

1. How do I set a default value for a field using LSMW while uploading data. Let's say country should always be India.

2. Lets say in the flat file, for a field; say personnel number, the values are 1,2,3 and so on.

but I want the data in SAP as S0001, S0002, S0003 and so on. how do I do that.??

3. let's say there is a field BEGDA " stands for Begin Date" in the flat file. Lets assume its the third field in the flat file.

I need LSMW to look up for it in the flat file and take in the data.

I do know the steps for LSMW. I am assuming , things need to be done in step 6. Maintain field mapping and conversion rules.

or in Maintain Fixed values, translations and user defined routines.

but I would appreciate if someone can write a small code which needs to be placed in those above steps.

An inputs will be greatly appreciated and awarded.

Thanking you all in advance,

warm regards,

Hari Kiran

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,198

1. Setting default values

go to the field mapping and conversion rules step and go with the change mode. place the cursor on the filed to which you wanted to assing the constant value then go with the option constant on the top it will ask you for the constant value then u give the constant value that it.

2. I want the data in SAP as S0001, S0002, S0003 and so on. how do I do that.??

while you are assinging the source field to the target field before that you concatenate S000 to your field source field. Once it is done assing the source field to the target field.

3. let's say there is a field BEGDA " stands for Begin Date" in the flat file. Lets assume its the third field in the flat file. I need LSMW to look up for it in the flat file and take in the data.

Ya its depends entirely upon ur source structure. You should desing the source fields in the order of the flat file fields then while mapping the fields you can do where ever u want.

11 REPLIES 11
Read only

Former Member
0 Likes
2,199

1. Setting default values

go to the field mapping and conversion rules step and go with the change mode. place the cursor on the filed to which you wanted to assing the constant value then go with the option constant on the top it will ask you for the constant value then u give the constant value that it.

2. I want the data in SAP as S0001, S0002, S0003 and so on. how do I do that.??

while you are assinging the source field to the target field before that you concatenate S000 to your field source field. Once it is done assing the source field to the target field.

3. let's say there is a field BEGDA " stands for Begin Date" in the flat file. Lets assume its the third field in the flat file. I need LSMW to look up for it in the flat file and take in the data.

Ya its depends entirely upon ur source structure. You should desing the source fields in the order of the flat file fields then while mapping the fields you can do where ever u want.

Read only

0 Likes
2,198

hi,

I have found a few answers myself. Would appreciate your feedback on it.

1. For placing default values for a field., I should take a variable and then give it the default value. say v_country = " India"

2. For changing values from 1,2,3,4, and so on to S001, S002, S003, S004

I can use the option "PREFIX" and give "S00" there. That should solve the problem

Please provide your inputs on this.

Thank you for replying.

Warm regards,

Hari Kiran

Read only

manubhutani
Active Contributor
0 Likes
2,198

Hi

1.) in mapping step , when u double cli on country it will tak u to the code section

put the default value over there

2.) do same thing , in code concatenate the desired zeroes with the field in ur file. for eg the struc u made zstr

then conacte '0000' zstr-pernr into a value 9declare in global area) now global area is in layout tab..

and put that value over there

3 ) lsmw can't search for a date itself

u need to map that with the third field

Please reward points

Read only

0 Likes
2,198

Hi Manu,

My first question is pretty much solved based on the answers given by you both.

But I would like you to throw some more light on the second question I have asked. You have answered that question too.

but please be a bit more specific about the steps.

Thank you so much for answering.

Also, please suggest if any of the solutions given by me will work or not.

Thanking you once again,

Warm regards,

Hari Kiran

Read only

Former Member
0 Likes
2,198

Hi,

As per your question, you want 1 as S0001, similarly for 12 as S0012. So in this case declare a variable in global definitions like V_pernt(4) type n .

Assign your pernr to v_pernr, then concatenate S with v_pernr into another variable.

v_pernr = pernr.

concatenate s v_ernr into v_final.

Read only

0 Likes
2,198

Hi Rajesh,

Thank you for the clarity.

This definitely solves some of the issues in my current requirement. one was assigning default values for a field and the other was ; the one for which Rajesh answered.

I basically am migrating HR master data using LSMW.

I need to transfer PA data. ( Personnel Administration data)

I have decided to use Batch Input session recording.

I have 8 infotype data in my flat file. I will be recording the transaction PA30 for this. I dont have much issues doing this now.

However, I would like to know how to upload data into OM( Organisation Management) using LSMW. Is there a transaction code which I can record in LSMW and upload the data. Is it appropriate to use the following t-codes for recording......P010--Organisational units

PO03--jobs

PO13---Positions

Any input will be greatly appreciated.

Thank you all for answering my questions.

warm regards,

Hari Kiran

Read only

0 Likes
2,198

Hi

OM data is not related to pernr as u knoiw

it consists of various relationships b/w objects like pernr position org unit

so first clear

what data u need to upload and from which table

either u want to create objects

use transaction pp01

let me knw if any ques

please reward points

Read only

0 Likes
2,198

Hi Manu,

Thank you for answering.

basically I am required to upload data into the infotypes

HRP 1000 - Objects

HRP 1001 - Relationships

HRP 1008 - Account Assignment.

I do know that in OM data is fetched based on objects and relationships.

I need to upload data into these above 3 infotypes related to OM using LSMW.

In HRP 1000 these are the fields I need to load data into--

OTYPE

OBJID

BEGDA

ENDDA

SHORT

STEXT

Similarly for HRP 1001 and HRP1008.

What I want to know is , should I be using batch input session recording in LSMW to do this . If so, then what is the transaction code for that.???

Or shall I use the IDOCS and upload the data into these OM infotypes.

Kindly anyone, give me a feedback on this.

I need to make a decision on this and half of my problems will be solved.

once again thank you all for answering.

Warm regards,

Hari Kiran

Read only

0 Likes
2,198

Where i have to write this code in lsmw

Read only

JL23
Active Contributor
0 Likes
2,198

a quick look into help.sap.com  or into my blog

would immediately answer your question

Read only

dwilmsen
Discoverer
0 Likes
2,198

thank you