0% found this document useful (0 votes)
94 views85 pages

LSMW Migration With IDOC Method and Using IDOC As Source

Uploaded by

gnafoo2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views85 pages

LSMW Migration With IDOC Method and Using IDOC As Source

Uploaded by

gnafoo2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 85

Mickael QUESNOT ©

LSMW migration with IDOC method and using IDOC as source


MATMAS as Example

1 Legacy System Migration Workbench


Use

The Legacy System Migration Workbench (LSMW) is a tool that supports data migration from
legacy systems (non-SAP systems) to SAP systems. It is a cross-platform component of the
SAP system.

Implementation Considerations

Do not use the LSMW before the SAP system has been installed and application customizing
has been completed.

Integration

The LSMW is a cross-application component (CA) of the SAP system.

The tool has interfaces with the Data Transfer Center and with batch input and direct input
processing as well as standard interfaces BAPI and IDoc.

The Legacy System Migration Workbench is called using transaction LSMW.

Features

Instead of individual tables or field contents, the tool migrates user-defined datasets (known
as objects), which are combined according to business criteria. In addition to using standard
import techniques, you can also generate user-specific objects. For more information,
see Recordings.

The LSMW comprises the following main functions:

1. Read data (legacy data in spreadsheet tables and/or sequential files). You can use any
combination of PC and server files.
2. Convert data (from the source into the target format).
3. Import data (to the database used by the SAP application).

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
1
Mickael QUESNOT ©

The following additional functions are available:

• Import techniques: Apart from standard batch/direct input and recordings, BAPI and
IDocs are available as additional import methods.
• Global Functions: You can call certain functions from an ABAP code location of your
choice, and so influence the procedure used to migrate your data.
• Editor Function: The source code for a target field can be checked. You can insert
source fields, global variables, and global functions as well as use the Pretty Printer.
• Action Log: All the actions associated with an object are stored in an action log.
• The field assignments for all parts of a project can be downloaded/uploaded in one
step.
• Unassigned Source Fields: Neglected data can be displayed.
• Source Fields: You can create source fields by copying them from other sources.
Copy.
• Processing Times: The ABAP code can be added to at different times.
• Authorizations: The LSM Workbench is independent from the client. Access to the
LSMW is controlled by authorizations. The assignment of these authorizations is
basically independent from the client. The Display, Execute, Change,
and Administration functions can be controlled by assigning authorizations.
• Documentation: User-specific documentation can be stored at different levels and
formatted into an overall documentation by pressing the appropriate button.
Constraints

Restrictions The LSMW supports a one-time transfer of data (initial data load) and also offers
a restricted support of permanent interfaces. Thus, a periodic transfer of data is possible. The
LSMW, however, does not include any functions for monitoring of permanent interfaces. The
tool does not support any data export interfaces (outbound interfaces).

More Information

More information about data conversion with the LSMW:

• Conceptional Preprocessing
• Authorizations
• Exporting a Project
Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
2
Mickael QUESNOT ©

• Importing a Project
• Migration of Data with LSMW
• Troubleshooting

1.1.1 Step 1 – Maintain object attributes

As this tutorial has the focus on IDOC import method put the radio button to IDOC and enter
the same message type and Basic type that you used for your extract via ALE,

Message Type MATMAS


Basic Type MATMAS01

Define Object Attributes

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
3
Mickael QUESNOT ©

You may get a warning message telling you that you have to activate IDOC inbound
processing.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
4
Mickael QUESNOT ©

Define the default values for inbound IDoc processing


Message no. /SAPDMC/LSMW813

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
5
Mickael QUESNOT ©

Procedure
In the initial screen of the LSM Workbench:

--> Settings --> IDoc Inbound Processing

Message no. /SAPDMC/LSMW813

Define the default values for inbound IDoc processing


Procedure
In the initial screen of the LSM Workbench: --> Settings --> IDoc Inbound Processing

if you use IDOC and BAPI import method then you need to define Ports and partner profiles like you
must do it when you get IDOCs from an external system.

In the initial screen of LSMW, where you entered the project name chose from menu Settings > IDOC
Inbound processing.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
6
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
7
Mickael QUESNOT ©

in the next screen you must enter the File port name, the partner type US (user) and the partner
number and then you click Activate Inbound processing.

This must be done in any system where you use this LSMW project.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
8
Mickael QUESNOT ©

File port and partner number are free definable names, and in many companies set up by the Basis
team. So, you would only need to enter those names and Activate IDoc Inbound processing,
However, if you must do it yourself, then you need to make use of the buttons next to those fields.

Maintain ports is actually nothing else than transaction WE21

In my example I had used the name ZFILE (for FILE)

After clicking Maintain ports you get the screen shown below. Put the cursor onto the file folder on
the left, then click the create icon.

Enter a description, set the radio button for the IDOC record type (most probably the 4.x type
nowadays), make the setting if you use Unicode format. then set the radio button to physical
directory, enter a directory and a function module in tab Outbound file then do an Access test to
make sure you have access to this directory. These are the minimum settings needed for a Port used
in LSMW.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
9
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
10
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
11
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
12
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
13
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
14
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
15
Mickael QUESNOT ©

Partner Type
Characterizes the communication partner. Partner type and partner number identify the partner uniquely.

Use
The partner type determines which partner master data the IDoc interface reads.

You can define your own partner types.

Examples
Your EDI partner is the vendor '4711'. Then

• partner number = '4711' and

• partner type = 'LI' (vendor).

Your ALE partner is an SAP system addressed via RFC by your system under the name 'ID3MDT800'
(logical name). Then

• partner number = 'ID3MDT800' and

• partner type = 'LS' ('logical system').

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
16
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
17
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
18
Mickael QUESNOT ©

The button Maintain partner numbers is transaction WE20.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
19
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
20
Mickael QUESNOT ©

In my example I named it LSMW

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
21
Mickael QUESNOT ©

After clicking this button, you are taken to the Partner profiles. Click create button. Enter the partner
number (here LSMW), partner type US, type US for user, Agent: you user-ID and your language.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
22
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
23
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
24
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
25
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
26
Mickael QUESNOT ©

Then define the Inbound parameters, Click the “insert line” icon below the table.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
27
Mickael QUESNOT ©

At this place you add the IDOC message type that will be used as your import method. LSMW can
create this entry itself if you have activated the IDOC inbound processing before you defined the first
step of your LSMW. But there is no harm if you add it manually, which usually must be done in Test
and production systems as you do not carry out step 1 anymore.

For this example, we use message type MATMAS.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
28
Mickael QUESNOT ©

Enter the process code with help of F4 (MATM)

Activate “Cancel Processing after Syntax error” and set the radio button to Trigger by background
program, otherwise your IDOCs get posted immediately while creating.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
29
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
30
Mickael QUESNOT ©

Activate

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
31
Mickael QUESNOT ©

Define Source Structures

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
32
Mickael QUESNOT ©

Just do not forget to add a Z in Front of any segment name, to make the source name different
from the target name.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
33
Mickael QUESNOT ©

Define Source Fields

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
34
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
35
Mickael QUESNOT ©

Define Structure Relations

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
36
Mickael QUESNOT ©

Just a click step, assign all corresponding segments of your source structure to the target
structure:

Place the cursor on the segment, then click Create Relationship icon.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
37
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
38
Mickael QUESNOT ©

Define Field Mapping and Conversion Rules

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
39
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
40
Mickael QUESNOT ©

Transfer (MOVE)

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
41
Mickael QUESNOT ©

Constant

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
42
Mickael QUESNOT ©

ABAP Code

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
43
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
44
Mickael QUESNOT ©

Specify Files

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
45
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
46
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
47
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
48
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
49
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
50
Mickael QUESNOT ©

Assign files

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
51
Mickael QUESNOT ©

Read Data

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
52
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
53
Mickael QUESNOT ©

Display Read Data

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
54
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
55
Mickael QUESNOT ©

Convert Data

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
56
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
57
Mickael QUESNOT ©

Display Converted Data

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
58
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
59
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
60
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
61
Mickael QUESNOT ©

Start IDoc Creation

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
62
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
63
Mickael QUESNOT ©

Start IDoc Processing

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
64
Mickael QUESNOT ©

Create IDoc Overview

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
65
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
66
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
67
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
68
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
69
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
70
Mickael QUESNOT ©

Start IDoc Follow-Up

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
71
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
72
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
73
Mickael QUESNOT ©

Resolve issue with ABAP Code :

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
74
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
75
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
76
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
77
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
78
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
79
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
80
Mickael QUESNOT ©

e1maram-matnr = zexcel-matnr.
* Caution: Source field is longer than target field

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'


EXPORTING
input = zexcel-matnr
IMPORTING
output = e1maram-matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.

CHECK sy-subrc = 0.

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
81
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
82
Mickael QUESNOT ©

Result

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
83
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
84
Mickael QUESNOT ©

Mickaël QUESNOT © - Copyright

https://www.linkedin.com/in/mickaelquesnot/
85

You might also like