Step-by-step SAP LSMW User Guide

Last time we discussed SAP Step-by-step LSMW Developer Guide, which you can find here Step-by-step SAP LSMW Developer Guide

Today let’s have a look at the User Guide.

Basics

LSMW is a standard SAP tool to do any kind of mass data changes.

In 99% cases, we use Batch Recording which works like macros in MS Excel/Word. The system follows user’s steps, recording screen by screen. Once done we map data file to these screens and data fields. Than system repeats the same steps like the user would be doing manually.

Organizing LSMW projects

In LSMW transaction we have projects, subprojects, and objects.

SAP LSMW Initial Screen

SAP LSMW

Ideally, there should be one global project for routine updates, one for data migration.

The subproject is something meaningful, like OM, PA, PT, and PY for different HR areas. Or it could be one subproject for all infotypes, no matter.

An object usually represents what’s being changed: infotype, table or something else.

To start we need to choose from all three entities: project, subproject, object.

Here is the main LSMW window. Steps “Define Object Attributes” to “Assign Files” are settings, other for execution for the end-user.

Read More


Step-by-step SAP LSMW Developer Guide

Basics

LSMW is a standard SAP tool to do any kind of mass data changes. It has a number of ways how to update the data in the system:

  • BAPI
  • IDOC
  • Batch Recording
  • Direct Input

BAPI is the fastest way, but there is a limited number of BAPIs available to the customer.

In 99% cases, we use Batch Recording which works like macros in MS Excel/Word. The system follows user’s steps, recording screen by screen. Once done we map data file to these screens and data fields. Than system repeats the same steps like the user would be doing manually.

Organizing LSMW projects

In LSMW transaction we have projects, subprojects, and objects.

Ideally, there should be one global project for routine updates, one for data migration.

The subproject is something meaningful, like OM, PA, PT, and PY for different HR areas. Or it could be one subproject for all infotypes, no matter.

An object usually represents what’s being changed: infotype, table or something else.

To start we need to create all three entities: project, subproject, object or choose them if they are already created.

Here is the main LSMW window. Steps “Define Object Attributes” to “Assign Files” are settings, other for execution for the end-user.

Read More


Easy way to mass change any field in SAP

There is an easy way to change any screen field you see on the screen. SE16N.. Joke..

We can create LSMW with the transaction we want to use to change specific field. Let’s say we want to change some field in PA30 or PP02. First of all we need to point the system to a specific record. So let’s enter exact date into begda and endda to allow system to choose exactly that record. Click on Copy button so it would fill all fields with data from the database record. Change one field you wanted to change.

And here is a trick. When you return from LSMW recording to Edit recording screen there will be a set of fields you saw on the screen. Delete all of them except that one you want to change (and have changed). It means system will change only one field, not all fields with some values from a file.

It took me 10 minutes to record this LSMW, thus it’s pretty convenient way to do mass changes.

LSMS Delete Screen Field

LSMS Delete Screen Field


SAP LSMW Translation Rules

In our previous posts, we’ve learned basic rules with LSMW. Today we need to clarify one the most important technique in data migration in SAP projects. We know how to use different migration tools like BAPI, IDOC, flat files, complex files, batch input. But all these are useless if we can’t convert data on the fly. This is a great advantage of Legacy Workbench in SAP is to able to convert data with integrated translation rules.

So, the translation rules are used when we need to map one value in the incoming file to any other value which is to store in SAP. It could be just simple text concatenation, substitutions or even complex ABAP logic with a lot of functional module calls retrieving some data out of the system.

SAP LSMW transformation rules

Read More


LSMW errors when you work with files

Sometimes when you load file in LSMW (Read Data step) system throws an error with a code without any human explanation. To understand this I advise you to look at this ABAP code from the standard LSMW program. Having this function module return codes (the same time error codes for LSMW) it would be easier to understand what’s wrong. Here is the list of LSMW errors when you work with text files. This step occurs just before you run convert data in legacy workbench. These return codes represent errors SAP shows us during file read step.

program /SAPDMC/SAP_LSMW_READ_FORMS:
CALL FUNCTION ‘GUI_UPLOAD’
EXPORTING
filename                      = l_filename
filetype                      = l_filetype
codepage                      = l_codepage
*     HAS_FIELD_SEPARATOR           = ‘ ‘
*     HEADER_LENGTH                 = 0
*     READ_BY_LINE                  = ‘X’
*   IMPORTING
*     FILELENGTH                    =
*     HEADER                        =
TABLES
data_tab                      = “l_upload_table”
EXCEPTIONS
file_open_error               = 1
file_read_error               = 2
no_batch                      = 3
gui_refuse_filetransfer       = 4
invalid_type                  = 5
no_authority                  = 6
unknown_error                 = 7
bad_data_format               = 8
header_not_allowed            = 9
separator_not_allowed         = 10
header_too_long               = 11
unknown_dp_error              = 12
access_denied                 = 13
dp_out_of_memory              = 14
disk_full                     = 15
dp_timeout                    = 16
OTHERS                        = 17


How to load multiple files in SAP LSMW

Here is a trick. Some time ago I found how to load hierarchical structures in LSMW from one file. We need to create a file in a special way so that structure record is repeated. These files are hard to create in legacy system particularly when there are no local developers who support the system. That’s why we prefer to work with flat simple files where one file is a single table. But, let me show you how to load multiple files in SAP LSMW tool with ease.

Couple days ago I was loading payroll wage types into SAP with a standard BUS7023 ManagerExtPayroll object. In the output, there is an IDOC which is stored in T558* tables for payroll migration. IDOC structure is a hierarchy itself, where on the top there is an employee, periods are below, and wage types are on the bottom line.

Loading multiple files in SAP LSMW

To simplify I decided to create three files:

  • Employees
  • Periods
  • Wage types

Every other file contains a reference to the previous one. Look what I’ve got.

lsmw_py_0

Read More