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


Advanced LSMW use examples

Look what I’ve just heard.

This is just a simple screen of simple LSMW project. Boring! But if you click Layout button, mark all checkboxes and then double-click …

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