How to Figure Out Character Length Easy in Sap for Lsmw
In this post we will go through the steps needed to create, export / import, and finally run the LSMW. This will additionally cover how to create your own Batch Input Recording and how to reuse the created LSMW. Towards the end we will discuss some frequently asked questions.
Overview
- What is LSMW?
- Detailed Steps
- Importing and Exporting LSMW in SAP Environments
- Running and Reusing LSMW
- Additional Information
- Summary
What is LSMW?
LSMW stands for Legacy System Migration Workbench. It is typically used during data migration tasks when you are moving data from legacy system to the new system.
The idea is to think of it as a quick "automation" tool that you can use when you are dealing with massive data in SAP or data that needs to be imported to SAP.
Another way of looking at LSMW is to think of it as a friendly robot assistant. This is my personal analogy and I even like to think of LSMW as my "R2-D2".
"R2-D2" is the droid and "pilot assistant" from Star Wars.
Apologies to some who do not get the Star Wars reference. We can just stick to "friendly robot" as a general analogy. I just had to add it in there.
The concept of this analogy is that you have LSMW as your friendly robot assistant when you need to handle massive SAP data uploads and even changes.
Some Functions
- Massive legacy data upload / import in SAP using spreadsheets or sequential files
- Massive data upload / import using standard SAP interfaces (IDoc inbound processing, Batch Input, Direct Input)
- Converting Data (in legacy system data format to target SAP system format)
The above functions can be a handful for beginners which is why I will focus on a basic scenario.
Our Scenario
Let us say that the client needs to move to SAP S/4HANA in the near future. Part of the preparation tasks would be to ensure the data in SAP ECC is "clean".
Our data focus for this scenario will be WBS Elements and status changes. We need to find a way to release thousands of WBS Elements in a short amount of time.
To simplify this scenario further, you can also simply consider that multiple WBS Elements in the current SAP system needs to be updated to "released status" in a short amount of time.
Note: This process will focus on creating an LSMW with Batch Input Recording.
When I say, "Batch Input Recording", it means I want to SAP to record the actions I will do in the system. SAP will use that recording and repeat the actions multiple times.
This scenario is common, and you can even create your own "recording" (provided the change proper can be recorded) for the specific changes you need to do.
Detailed Steps
The steps below will focus on creating an LSMW with Batch Input Recording
Create your LSMW Project, Subproject, and Object
- First, go to transaction code LSMW and click on the Check button to proceed.
When you go to the transaction for the first time, you should see the window below.
- Click on the Create Project icon and name your Project, Subproject, Object, etc. Once done with the naming, click on the Check button to proceed.
Maintain Object Attributes
- You should now see the screen below. Double click on Maintain Object Attributes.
- There are multiple process steps in the screen. We will start with the first one "Maintain Object Attributes". You will notice that there are multiple Object Type and Import Methods available. Since we are focusing on "Batch Input Recording", select that option and input a recording name.
- Click on the Overview button (highlighted in red) to start recording.
Create Batch Input Recording
- You should arrive at the screen below. Enter a description for your recording. Then click on the Check button to proceed.
- You will now be asked the transaction code of your recording. Enter "CJ02" since the goal of our scenario is to create a recording that updates the Status of WBS Elements to "Released".
NOTE: Before you start recording, please have your accurate test / dummy data ready. For example, a WBS with status Created and will allow status to be set to Released.
- We are now in the Recording Proper. Do the same actions you would do in a normal scenario.
Enter the accurate WBS Element data you have on the WBS Element Field. Click on the Enter button to proceed.
- Click on Edit > Status > Release then click on the Save button once status has updated.
You should see the update notification below.
- You should see a summary of the recording that was done. Click on the Save button to ensure the recording is saved.
- Notice that the input field where we indicated the WBS element. It is populated at the moment. Double click on the field or select the field, click on "Default", and delete the Default Value. Click on the check button to proceed.
Ideally, we want to input the list of WBS Elements subject to this change update so we should keep the PRPS-POSID blank (highlighted in green).
- You can further review the input fields that were captured by the recording and delete any fields that you do not need. Select the item and click on "Delete Screen Field". You should receive the same notification below. Click on the check button to proceed. Make sure to SAVE the recording.
For example, PROJ-PSPID is not needed. It would be better to delete the field to ensure it doesn't complicate or cause issues.
- Click on the back button and click on the Save button up until you end up in the LSMW Overview "Object Attributes" screen.
Maintain Object Attributes – Link The Batch Input Recording
- Here we are back at the LSMW Overview "Object Attributes" screen. Notice that the recording is still registered under Batch Input Recording. Let us click Save once more just to be sure then click on Back.
Maintain Source Structure
- We are now back in the LSMW main screen. Notice how the items lessened according the Object Attributes we specified a while ago. We will go through each one until we complete all Process Steps. Double click on Maintain Source Structure.
- Here you need to create your source structure. Click on the New button and enter the Source details. You can also follow the description below.
Our LSMW will involve selecting a text file with all WBS Elements listed that are subject to status changes.
We will "feed" the file and LSMW will do the update proper.
- Click on Save once done and press the back button to proceed to the next step.
Maintain Source Fields
- This time double click on Maintain Source Fields.
- Here you need to Enter a source field name and description. Below I entered WBSNUM. Ensure to specify the Field Length and Field Type. Click on the check button to proceed.
The field length below is just an example for explanation purposes. You can match the character requirement to the field in concern.
If the number below is higher than the actual field length, LSMW will accept the data. Of course, if you have data that exceeds the normal WBS length, SAP will throw back an error as it is not possible.
- Click on the Save button and click on the back button to proceed to the next step.
Maintain Structure Relations
- Double click on Maintain Structure Relations.
- Usually the below is populated. In our case we do not need anything further. The current setting will do for our scenario. To be sure you can edit and save.
Maintain Field Mapping and Conversion Rules
- Next, double click on Maintain Field Mapping and Conversion Rules.
- Here you can click on POSID then click on Create Source Field. It should create the entries below. Click on save and click on the back button to proceed to the next steps.
If you have other rules or mappings, feel free to add them. Otherwise, this will be okay.
Maintain Fixed Values, Translations, User-Defined Routines
- Double click on Maintain Fixed Values, Translations, User-Defined Routines.
- You will see the screen below. In our case we don't necessarily need fixed values or other information, but we can go through this quickly for visualization purposes.
You can click on Translations for example and click on the change button. Below is an example.
- Once done editing, click on Save and click on the back button to proceed to other steps.
Specify Files
- Double click on Specify Files. This is when we are going to upload a file to execute / test our LSMW. We have our recording and prerequisite steps. Now we need to "feed" the input file and ask LSMW to perform the changes.
Make sure you have a text file ready with valid test data. Simply open up Notepad and copy paste the WBS Element test data you have.
- You will see multiple options available for you to specify files. In our example, we will select the "On the PC" option. Click on New to proceed with the file input details. This will allow us to specify a file from our PC/Desktop and load it to SAP.
- You can follow the settings / procedures below. Here we specified a file from the desktop and gave it a name. For file contents we have "Data for One Source Structure (Table)". This is a simpler approach for our scenario.
- You can scroll down to see further settings. Below we selected a Delimiter, File Structure, File Type, and Code Page. Click on save to proceed to the next steps.
Assign Files
- Double click on Assign Files.
- Here you can specify the assignment as seen below. Click on Save and click on back button to proceed to the next steps.
Read Data
- Double click on Read Data. This time SAP will try to read the content of your file.
- You should see the screen below. You don't need to enter anything. Just click on Execute. After executing, click on back to proceed to the next steps.
Display Read Data
- Double click on Display Read Data.
- Leave the To Line blank or you can limit the number of entries you want to process. Click on the check button to proceed.
- You should see the screen below. If the rows correspond to the number of items you have on the file input, then it worked well. Click on the back button to proceed to the next steps.
Convert Data
- Double click on Convert Data.
- You don't have to enter anything. Click on execute. Once done with the execution, click on back to proceed to the next steps.
Display Converted Data
- Double click on Display Converted Data.
- You can leave the To field blank or add a number to limit the rows processed. Click on the Check button to proceed.
- You should see the screen below. If the rows correspond to the number of items from your input file then it is working okay. Click on back to proceed to the next steps.
Create Batch Input Session
- Double click on Create Batch Input Session.
- SAP will populate default values as seen below. I like to leave it as is. You can select the Keep Batch Input Folder if you would like to retain the Batch Input. If not, just leave it unticked. Click on Execute to proceed.
- You should see this notification once the Batch Input Session has created. Click on the check button to proceed.
Run Batch Input Session or SM35
- The last step is to Run Batch Input Session. No changes have taken place unless the Batch Input Session is executed. For me, I like to skip this step in LSMW and go to Transaction code SM35. If you would like to proceed with this in LSMW, feel free to do so.
- Go to transaction code SM35. You should see the created Batch Input Session from our LSMW. Highlight / Select the Batch Input Session concerned and click on Process.
- A good step is to process the Batch Input Session in Foreground first to ensure it is doing exactly what it needs to do. Executing this in foreground allows you to visualize what SAP is doing. Click Process to proceed and run through the recording.
- When processing is complete, you should see the notification below. You can view the session overview or exit the batch input. You can also verify the status of the WBS by checking the master data. If the status has indeed updated, then it is working.
Validate by Testing and Checking Relevant Master Data
Checking the master data:
Importing and Exporting LSMW in SAP Environments
Export LSMW
To export your LSMW, click on Extras > Export Project.
You can select / deselect the content of the project. There can be multiple rules, recordings, subprojects in a project. In our example, it is just 1 of each. Be careful if you are exporting an already existing Project with multiple items.
Select where the file should be saved on your Desktop / PC. You should receive the following notification once it is complete:
Import LSMW
To import your LSMW in the target SAP System, click on Extras > Import Projects then select the file from your Desktop / PC:
Select what gets imported:
In our case, all will be applicable so you can proceed. Once it is imported, you should see the notification below. You are now free to use the LSMW in the target SAP System.
Running and Reusing LSMW
To run and reuse LSMW, you can go to transaction code LSMW and look for the project, subproject, and object in concern.
Instead of starting the process steps from the very beginning, you can start with Specify Files (Except assign files as it is not needed) up until Create Batch Input Session.
From there you can proceed to transaction code SM35 and process the session accordingly. The same steps are repeated as needed for all files you need to upload using the same LSMW / recording.
- Specify Files,
- Read Data
- Display Read Data
- Convert Data
- Display Converted Data
- Create Batch Input Session
- SM35 Process > Display Errors Only.
Additional Information
What is the difference between BDC and LSMW?
This seems similar to BDC or Batch Data Recording. In ways, it is similar because you are recording and making use of that recording to perform the same action multiple times.
LSMW is of course an "enhanced" version because it contains more settings / options. It is also easier to "control" because you have process steps available for you to follow.
Can I copy an LSMW recording and modify the recording myself?
Yes, you can. Simply select the existing recording and click on the Copy button. You can modify the content as needed. Please ensure you know the exact lines to be deleted or modified.
Can I use Transaction Code MASS instead of LSMW?
Yes, provided that the action you need is available in MASS. However, MASS transaction code doesn't contain all "actions" so LSMW would be a good alternative.
More Resources on LSMW
- Legacy System Migration Workbench – SAP Help
- Using LSMW – SAP Help
Summary
- What is LSMW? Your friendly robot assistant when you need to handle massive SAP data uploads and even changes.
- Detailed Steps (Batch Input Session Approach in LSMW)
- Maintain Source Fields
- Maintain Structure Relations
- Maintain Field Mapping and Conversion Rules
- Maintain Fixed Values, Translations, User-Defined Routines
- Specify Files
- Assign Files
- Read Data
- Display Read Data
- Convert Data
- Display Converted Data
- Create Batch Input Session
- Run Batch Input Session or SM35
- Validate by Testing and Checking Relevant Master Data
- Importing and Exporting LSMW in SAP Environments
- Extras > Import Projects > Select applicable items
- Extras > Export Projects > Select applicable items
- Running and Reusing LSMW
- Note: Make sure you have the file upload ready with the data.
- LSMW > Choose the concerned Project, Subproject, and Object.
- Execute the following:
- Specify Files
- Read Data
- Display Read Data
- Convert Data
- Display Converted Data
- Create Batch Input Session
- SM35 Process > Display Errors Only
- Additional Information
- What is the difference between BDC and LSMW? – LSMW is an enhanced version and easier to "control" and "reuse".
- Can I copy an LSMW recording and modify the recording myself? Yes. There is a Copy Recording button you can utilize. Make sure you 100% know the recording lines that you plan to add or delete.
- Can I use Transaction Code MASS instead of LSMW? Yes, provided that the action you need is available in MASS.
I hope this helps 😊 Good luck!
Source: https://techlorean.com/2021/01/28/lsmw-beginner-sap-consultant-detailed-step-by-step-procedure-batch-input-session/
0 Response to "How to Figure Out Character Length Easy in Sap for Lsmw"
Enregistrer un commentaire