0% found this document useful (0 votes)
162 views171 pages

LTMOM

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)
162 views171 pages

LTMOM

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/ 171

Mickael QUESNOT ©

Add a new Custom Migration Object (BAPI) Using LTMOM for Migrate your data in
@SAP S/4HANA

This time I am going to show you how to add a new Custom Migration Object like the Cross
Selling (VB41).

The Migration object modeler (transaction LTMOM) is used to create your own customer-
specific migration objects or add SAP standard objects that are not yet included in the
migration cockpit. LTMOM can also be used to adjust the SAP standard migration objects
delivered with the cockpit by adding custom fields.

Creating Structures
Procedure

1. Open the Repository Browser and navigate to the package in which you want to create
the new structure.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
1
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
2
Mickael QUESNOT ©

2. In the context menu of the package, choose Create → Dictionary Object → Structure.

A dialog box appears.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
3
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
4
Mickael QUESNOT ©

3. In the new dialog box, enter the name of the structure and choose with the quick info
text Continue.

The maintenance screen for structures appears.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
5
4. Enter an explanatory short text in the Short text field.

You can find the structure at a later time using this short text, for example.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
6
Mickael QUESNOT ©

Perform the following steps for all the components you want to insert in the structure.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
7
You can also include structures, tables or views instead of individual components. This
procedure is described in Inserting an Include.

1. On the Components tab page, enter a name in the Components column.

Caution

If you want to insert the structure as an include in a transparent table at a later time, the
component names must not be longer than 16 characters.

2. Specify the attributes of the component. To do this, perform one of the following:
o If you want to add components by entering the data type and length directly, choose
Predefined type. You can now enter values for fields Data Type, Length, Decimal Pl.,
and Short description.
Caution

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
8
Mickael QUESNOT ©

If you have defined a data type with a decimal floating point in field Data Type, you
must specify the output style. To do this, double-click on the appropriate field on the
Data Type column. In the new dialog box, select one of the possible output styles.

For more information, see Output Styles.

o In the Typing column, you can select between the following options:
▪ Type - Refers to elementary types which are types of fixed or variable length that
are neither structured, nor a table type or a reference type. The predefined ABAP
types are elementary.
▪ Type Ref To - If the type defined in the ABAP Dictionary or the predefined type is a
reference type, choose this option. For more information, see Reference Type.
▪ Type … Boxed - Components of a structure or a class which are not stored at the
place where they are defined, but are managed by an internal reference.
Component of a structure or a class which is not stored at the place of definition
but is instead deep, that is, it is administrated by an internal reference. Boxed
components support initial value sharing and are therefore dynamic data objects.
They are declared with the BOXED addition when defining substructures using
TYPES or when declaring structured attributes of classes or interfaces using DATA.
For more information, see the ABAP Keyword Documentation under TYPES -
BOXED.
o In the Component type field, enter the name of the type whose attributes must be
used in the component. You can enter any type (data element, structure or table
type) here. You can enter a reference type in the Component Type field. If you enter a
class, interface, or generic reference (OBJECT or DATA) in the Component Type field,
the Typing field is automatically set to TYPE REF TO. If you enter ANY, the Typing field
is set to Type. If you enter a reference type already defined in the dictionary as a
reference type, a blue arrow appears in the Data Type column.
Note

You can combine components with direct type definition and components that are
defined by referencing an existing type as you like.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
9
3. On the Currency/quantity fields tab page, you must specify the reference field and
reference table for components of type CURR (currency) and QUAN (quantity).
4. Maintain the foreign keys of the structure.

Proceed as when maintaining the foreign keys of a table (see Creating Foreign Keys).

5. Choose Search Help if you want to assign a search help to a structure field that points to
a data element. Enter the name of a search help in the dialog box that appears.
See Attaching a Search Help to a Table or Structure Field.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
10
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
11
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
12
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
13
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
14
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
15
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
16
Mickael QUESNOT ©

6. Once you have defined all the components of the structure, choose with the quick
info text Save.

You are asked to assign the structure to a package. You can change the package later by
choosing Goto → Object directory entry.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
17
7. Choose an enhancement category. For more information, see Structure Enhancements.
8. Choose with the quick info text Activate.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
18
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
19
Result

The structure is now activated. The runtime object of the structure is created. The system writes
a log at activation. It can be displayed with Utilities → Activation log. If errors occur when you
activate the structure, the system displays automatically the activation log.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
20
Mickael QUESNOT ©

Additional Options

• Recording documentation:

You can create information about using the structure by choosing Goto →
Documentation. This documentation is also output when the structure is printed.

• Specifying the activation type:

The activation type defines whether the structure can be activated directly from the
ABAP Dictionary, or whether the runtime object of the structure must be generated first
with a C program. You must define an activation type for structures of the runtime
environment. You can define the activation type by choosing Extras → Activation type.

Creating a Function Module

You use this procedure to create function modules in the Function Builder.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
21
1. In the Object Navigator (transaction SE80), choose Function Group as the object type.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
22
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
23
2. Enter the name of the function group and choose Enter.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
24
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
25
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
26
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
27
The tree structure of the function group appears.

3. In the context menu of the function group, choose Create → Function Module.

The Create Function Module screen appears.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
28
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
29
4. In the Function Module field, enter a name for the new function module and in the Short
Text field, enter a description for the new function group.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
30
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
31
5. Specify the following attributes

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
32
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
33
Attribute Description

Short text Describes the function module.

Process Specifies the function type. Choose Normal unless your function is to
type be run on remote systems or during update tasks.

General General administration information.


data

6. Choose Save.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
34
Mickael QUESNOT ©

The system automatically creates an include file for your function module. For example, the
include file for the first function module in the function group FGRP is called LFGRPU01. The
next function modules have include files called LFGRPU02, LFGRPU03, LFGRPU04, and so on.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
35
For more information about include programs, see Understanding Function Module Code.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
36
Mickael QUESNOT ©

Specifying Parameters and Exceptions

Use
You use this procedure to set parameters and exceptions for your function module. They
constitute its interface. The Function Builder has a tab page for each of the following interface
components: tables, exceptions, import, export, and changing parameters.

Procedure
1. In the Object Navigator (transaction SE80), open the function module you want to edit.

2. Enter the required information for each of the parameters (import, changing, export, or
table).

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
37
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
38
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
39
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
40
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
41
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
42
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
43
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
44
Mickael QUESNOT ©

Add source code:

FUNCTION Z_BAPI_CROSS_SELLING.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(PV_KSCHL) TYPE ZBAPIVB41-KSCHL DEFAULT 'Z001'
*" VALUE(PV_KOTABNR) TYPE ZBAPIVB41-KOTABNR DEFAULT '011'
*" VALUE(PV_MATWA) TYPE ZBAPIVB41-MATWA DEFAULT ' '
*" VALUE(PV_SMATN) TYPE ZBAPIVB41-SMATN DEFAULT ' '
*" VALUE(PV_MEINS) TYPE ZBAPIVB41-MEINS DEFAULT ' '
*" VALUE(PV_SUGRD) TYPE ZBAPIVB41-SUGRD DEFAULT ' '
*" VALUE(PV_DATAB) TYPE ZBAPIVB41-DATAB DEFAULT SY-DATUM
*" VALUE(PV_DATBI) TYPE ZBAPIVB41-DATBI DEFAULT '99991231'
*" TABLES
*" ZBAPIVB41 STRUCTURE ZBAPIVB41
*" ZRETURN STRUCTURE BAPIRET2
*"----------------------------------------------------------------------

INCLUDE Z_MME_CROSS_SELLING_TOP.

CLEAR : LS_ZBAPIVB41, ZRETURN[].

LS_ZBAPIVB41-KAPPL = 'VS'.
LS_ZBAPIVB41-KVEWE = 'D'.

IF NOT PV_KSCHL IS INITIAL.


LS_ZBAPIVB41-KSCHL = PV_KSCHL.
ENDIF.

IF NOT PV_MATWA IS INITIAL.


CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = PV_MATWA
IMPORTING

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
45
OUTPUT = LS_ZBAPIVB41-MATWA.
LS_ZBAPIVB41-VAKEY = LS_ZBAPIVB41-MATWA.
ENDIF.

IF NOT PV_SMATN IS INITIAL.


CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
INPUT = PV_SMATN
IMPORTING
OUTPUT = LS_ZBAPIVB41-SMATN.
ENDIF.

IF NOT PV_KOTABNR IS INITIAL.


LS_ZBAPIVB41-KOTABNR = PV_KOTABNR.
ENDIF.

IF NOT PV_DATAB IS INITIAL.


LS_ZBAPIVB41-DATAB = PV_DATAB.
ENDIF.

IF NOT PV_DATBI IS INITIAL.


LS_ZBAPIVB41-DATBI = PV_DATBI.
ENDIF.

IF PV_DATAB IS INITIAL.
LS_ZBAPIVB41-DATAB = SY-DATUM.
ENDIF.

IF PV_DATBI IS INITIAL.
LS_ZBAPIVB41-DATBI = '99991231'.
ENDIF.

SELECT SINGLE * FROM MARA WHERE MATNR = LS_ZBAPIVB41-MATWA.

IF SY-SUBRC <> 0.
ZRETURN-TYPE = 'E'.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
46
Mickael QUESNOT ©

ZRETURN-NUMBER = '056'.
*Material & does not exist
MESSAGE E056(VK) WITH LS_ZBAPIVB41-MATWA INTO ZRETURN-MESSAGE.
APPEND ZRETURN.
EXIT.
ENDIF.

SELECT SINGLE * FROM MARA WHERE MATNR = LS_ZBAPIVB41-SMATN.

IF SY-SUBRC <> 0.
ZRETURN-TYPE = 'E'.
ZRETURN-NUMBER = '056'.
*Material & does not exist
MESSAGE E056(VK) WITH LS_ZBAPIVB41-SMATN INTO LS_ZBAPIVB41-SMATN.
APPEND ZRETURN.
EXIT.
ENDIF.

*Material

CLEAR LV_NUMBER_GET_NEXT.
CLEAR LS_VAKEDB.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF LS_VAKEDB
FROM KOTD011
WHERE KAPPL EQ LS_ZBAPIVB41-KAPPL
AND KSCHL EQ LS_ZBAPIVB41-KSCHL
AND MATNR EQ LS_ZBAPIVB41-MATWA
AND DATBI GE LS_ZBAPIVB41-DATAB
AND DATAB LE LS_ZBAPIVB41-DATAB.

*This condition already exists


IF SY-SUBRC = 0.

LS_ZBAPIVB41-KNUMH = LS_VAKEDB-KNUMH.

SELECT SINGLE * FROM KONDD WHERE KNUMH = LS_VAKEDB-

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
47
KNUMH AND SMATN = LS_ZBAPIVB41-SMATN.

*Material Substitution - Data Division


IF SY-SUBRC = 0.

ZRETURN-TYPE = 'E'.
ZRETURN-NUMBER = '028'.
*Duplicate entries exist for the combination &1, &2, &3
MESSAGE E028(FSH_MSG_CL_VAS) WITH LS_VAKEDB-KNUMH LS_ZBAPIVB41-
VAKEY LS_ZBAPIVB41-SMATN INTO ZRETURN-MESSAGE.
APPEND ZRETURN.
EXIT.

ELSE.

*Conditions: Additional Materials for Material Determination


SELECT SINGLE * FROM KONDDP WHERE KNUMH = LS_VAKEDB-
KNUMH AND SMATN = LS_ZBAPIVB41-SMATN.

IF SY-SUBRC = 0.
ZRETURN-TYPE = 'E'.
ZRETURN-NUMBER = '028'.
*Duplicate entries exist for the combination &1, &2, &3
MESSAGE E028(FSH_MSG_CL_VAS) WITH LS_VAKEDB-KNUMH LS_ZBAPIVB41-
VAKEY LS_ZBAPIVB41-SMATN INTO ZRETURN-MESSAGE.
APPEND ZRETURN.
EXIT.

ENDIF.

ENDIF.

ELSE.

CALL FUNCTION 'NUMBER_GET_NEXT'


EXPORTING

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
48
Mickael QUESNOT ©

NR_RANGE_NR = '01'
OBJECT = NUMMERVORG
IMPORTING
NUMBER = LS_ZBAPIVB41-KNUMH.

LV_NUMBER_GET_NEXT = 'X'.

ENDIF.

*Variable Key for Condition Maintenance: Internal Structure


XVAKE-KVEWE = LS_ZBAPIVB41-KVEWE.
XVAKE-VAKEY = LS_ZBAPIVB41-VAKEY.
XVAKE-KOTABNR = LS_ZBAPIVB41-KOTABNR.
XVAKE-KAPPL = LS_ZBAPIVB41-KAPPL.
XVAKE-KSCHL = LS_ZBAPIVB41-KSCHL.
XVAKE-DATBI = LS_ZBAPIVB41-DATBI.
XVAKE-DATAB = LS_ZBAPIVB41-DATAB.
XVAKE-KNUMH = LS_ZBAPIVB41-KNUMH.
XVAKE-UPDKZ = 'I'.
APPEND XVAKE.

*Condition Tables: Update Structure


MOVE-CORRESPONDING XVAKE TO TIME_VAKE_DB.
TIME_VAKE_DB-XXSTATE = 'I'.
TIME_VAKE_DB-XXPROCINFO = 'U'.
TIME_VAKE_DB-XXDBACTION = 'I'.
APPEND TIME_VAKE_DB.

*Change Document Structure; Generated by RSSCD000


*Condition Record: Old and New Validity Periods
XKONDAT-KNUMH = LS_ZBAPIVB41-KNUMH.
XKONDAT-DATAN = SY-DATUM.
XKONDAT-DATBI = LS_ZBAPIVB41-DATBI.
XKONDAT-DATAB = LS_ZBAPIVB41-DATAB.
XKONDAT-KZ = 'U'.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
49
APPEND XKONDAT.

*Change Document Structure; Generated by RSSCD000


*Condition Record: Old and New Validity Periods
YKONDAT-KNUMH = LS_ZBAPIVB41-KNUMH.
YKONDAT-DATAN = LS_ZBAPIVB41-DATBI.
YKONDAT-KZ = 'U'.
APPEND YKONDAT.

*Material Substitution - Posting Structure


XKONDD-SMATN = LS_ZBAPIVB41-SMATN.
XKONDD-MANDT = SYST-MANDT.
XKONDD-KNUMH = LS_ZBAPIVB41-KNUMH.
IF NOT LV_NUMBER_GET_NEXT IS INITIAL.
XKONDD-UPDKZ = 'I'.
ELSE.
XKONDD-UPDKZ = ' '.
ENDIF.
APPEND XKONDD.

*Conditions: Additional Mat.for Mat.Determination - Posting


XKONDDP-MANDT = SYST-MANDT.
XKONDDP-KPOSN = 1.
XKONDDP-KNUMH = LS_ZBAPIVB41-KNUMH.
XKONDDP-SMATN = LS_ZBAPIVB41-SMATN.
IF NOT LV_NUMBER_GET_NEXT IS INITIAL.
XKONDDP-UPDKZ = ' '.
XKONDDP-KPOSN = 1.
ELSE.
CLEAR LV_COUNT.
SELECT COUNT(*) INTO LV_COUNT FROM KONDDP WHERE KNUMH = LS_VAKEDB-KNUMH.
XKONDDP-UPDKZ = 'I'.
IF LV_COUNT IS INITIAL.
XKONDDP-KPOSN = LV_COUNT + 1.
ELSE.
XKONDDP-KPOSN = 2.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
50
Mickael QUESNOT ©

ENDIF.
CLEAR : TIME_VAKE_DB, XKONDAT, YKONDAT.
ENDIF.
APPEND XKONDDP.

IF NOT LV_NUMBER_GET_NEXT IS INITIAL.


* Condition Maintenance - General
CALL FUNCTION 'RV_KONDITION_SICHERN' IN UPDATE TASK
TABLES
VAKEDB_TAB = TIME_VAKE_DB.
ENDIF.

BOOLE_T = 'X'.

*Material substitution - update function


CALL FUNCTION 'RV_MAT_SUB_SAVE' IN UPDATE TASK
IMPORTING
USE_OUTBOUND_CALL = BOOLE_T
CD_KVEWE = LS_ZBAPIVB41-KVEWE
CD_KOTABNR = LS_ZBAPIVB41-KOTABNR
CD_KAPPL = LS_ZBAPIVB41-KAPPL
CD_KSCHL = LS_ZBAPIVB41-KSCHL
TABLES
X_KONDDVB = XKONDD
Y_KONDDVB = YKONDD
X_KONDDPVB = XKONDDP
Y_KONDDPVB = YKONDDP
X_KONDATVB = XKONDAT
Y_KONDATVB = YKONDAT
DB_TIME = TIME_VAKE_DB
DB_XVAKE = XVAKE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'


* EXPORTING
* WAIT =
* IMPORTING

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
51
* RETURN =
.

*Material Substitution - Data Division


SELECT SINGLE * FROM KONDD WHERE KNUMH = LS_ZBAPIVB41-
KNUMH AND SMATN = LS_ZBAPIVB41-SMATN.

IF SY-SUBRC = 0.

ZRETURN-TYPE = 'S'.
ZRETURN-NUMBER = '211'.
*Condition record &1 has been created
MESSAGE I211(FSH_MSG_CL_VAS) WITH LS_ZBAPIVB41-KNUMH INTO ZRETURN-MESSAGE.
APPEND ZRETURN.

ELSE.

*Material Substitution - Data Division


SELECT SINGLE * FROM KONDDP WHERE KNUMH = LS_ZBAPIVB41-
KNUMH AND SMATN = LS_ZBAPIVB41-SMATN.

IF SY-SUBRC = 0.

ZRETURN-TYPE = 'S'.
ZRETURN-NUMBER = '211'.
*Condition record &1 has been created
MESSAGE I211(FSH_MSG_CL_VAS) WITH LS_ZBAPIVB41-KNUMH INTO ZRETURN-MESSAGE.
APPEND ZRETURN.

ELSE.

ZRETURN-TYPE = 'E'.
ZRETURN-NUMBER = '213'.
*No valid condition records are found
MESSAGE E213(FSH_MSG_CL_VAS) INTO ZRETURN-MESSAGE.
APPEND ZRETURN.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
52
Mickael QUESNOT ©

ENDIF.

ENDIF.

ENDFUNCTION.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
53
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
54
Mickael QUESNOT ©

Add abap code :

TABLES MARA.

DATA: KVEWE LIKE T681V-KVEWE VALUE 'D',


OLD_KSCHL LIKE T685-KSCHL,
KSCHL_PARA(3) VALUE 'VGD',
NUMMERVORG(10) VALUE 'KOND',
SUBRC LIKE SY-SUBRC,
KONDDP_DETAIL.

DATA LS_VAKEDB LIKE VAKEDB.


DATA LV_COUNT TYPE SYST-SUBRC.
DATA LS_ZBAPIVB41 TYPE ZBAPIVB41.

DATA: BOOLE_T LIKE BOOLE VALUE 'X'.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
55
DATA: BEGIN OF TIME_VAKE_DB OCCURS 10.
INCLUDE STRUCTURE VAKEDB.
DATA: END OF TIME_VAKE_DB.

TABLES: KONDD, *KONDD, KONDDP, *KONDDP.

DATA: BEGIN OF XKONDD OCCURS 100.


INCLUDE STRUCTURE KONDDVB.
DATA: END OF XKONDD.

DATA: BEGIN OF YKONDD OCCURS 100.


INCLUDE STRUCTURE KONDDVB.
DATA: END OF YKONDD.

DATA: BEGIN OF XKONDDP OCCURS 100.


INCLUDE STRUCTURE KONDDPVB.
DATA: END OF XKONDDP.

DATA: BEGIN OF YKONDDP OCCURS 100.


INCLUDE STRUCTURE KONDDPVB.
DATA: END OF YKONDDP.

DATA: XKONDAT LIKE VKONDAT OCCURS 20 WITH HEADER LINE,


YKONDAT LIKE VKONDAT OCCURS 20 WITH HEADER LINE.

DATA: BEGIN OF TIME_VAKE_DISP OCCURS 5,


DATAB TYPE KODATAB,
DATBI TYPE KODATAB,
KNUMH TYPE KNUMH,
TABIX TYPE SYTABIX,
DELKZ(1),
END OF TIME_VAKE_DISP.

DATA: XVAKE TYPE STANDARD TABLE OF VAKEVB WITH HEADER LINE


INITIAL SIZE 50.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
56
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
57
Field Description

Parameter Name of the parameter for identification purposes.


Name

Type spec. A database field, component of an ABAP Dictionary structure, or an


entire ABAP Dictionary structure. This is the same as the ABAP
Dictionary field name in the Reference field/reference structure
column.

Use this field to create a field based on an ABAP Dictionary field. You
should always use a reference structure if the data in the parameter
must have the same structure as the reference field (for example,
when you want to add new entries to the database).

Associated You can enter any system type, either generic or fully typed. For more
Type information, see the Data Types section of the ABAP User Guide.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
58
Mickael QUESNOT ©

Field Description

Default Default value of the parameter. Applies to import and changing


parameters only. The system transfers this value to the function
module if the caller sets its own value for that parameter.

Reference The parameter reference. Specify this if you want the parameter to be
called by reference instead of by value. When a parameter is called by
reference, the system points to the original parameter without making
a copy of it. The function module works with and, if necessary, alters
the original parameter and not a copy. Table parameters are always
passed by reference.

3. Enter the exceptions.

The exceptions screen only allows you to enter a text with which the exception can be
triggered in the function module.

4. Document the interface on this screen.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
59
On the Documentation screen, you can enter short descriptions of the parameters and
exceptions or write full documentation of the entire function module.For more
information, see Documenting and Releasing Function Modules

5. Save your entries.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
60
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
61
Checking and Activating Function Modules

Use
You use this procedure to check and activate your function modules.

Procedure
Checking a Function Module

1. In the Object Navigator (transaction SE80), open the function module you want to edit.

2. Do one of the following:


▪ To check a single function module, choose Function module → Check.

▪ To check a function module as a part of the whole function group, choose


Function module → Check → Main program. The system checks all active and
inactive function modules and include programs.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
62
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
63
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
64
Mickael QUESNOT ©

Activating a Function Module

1. In the Object Navigator (transaction SE80), open the function module you want to edit.

2. Choose Function module →Activate.

Syntax check is performed automatically upon activation. An active function module is


included in the syntax checks of the whole function group.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
65
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
66
Mickael QUESNOT ©

Restoring the Active Version of a Function Module

You can switch between the inactive and the inactive version of a function module by choosing
Function module → Active <-> Inactive.

See also:

Inactive Sources in the ABAP Workbench

Documenting and Releasing a Function Module

Use
You use this procedure to document function modules in the Function Builder. There are two
kinds of documentation: parameter documentation and function module documentation.

Procedure
Creating Interface Documentation

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
67
The parameter documentation provides users with information about the different parameters
and exceptions in the function module.

1. In the Object Navigator (transaction SE80), open the function module you want to
document.

2. On the Import, Export, Changing, Exceptions or Tables tab pages, choose the Long Text
pushbutton.

The SAPscript Editor appears.

3. Enter a short text for each entry.

4. Save your entries.

Creating Function Module Documentation

Function module documentation contains important information about the functioning of the
module. It should be detailed enough for the users to understand the module without having to
examine its source code.

1. In the Object Navigator (transaction SE80), open the function module you want to
document.

2. In the toolbar, choose the Function Module Documentation pushbutton.

The SAPscript Editor appears.

3. Enter your text.

4. Save the documentation.

Note
When you release a function module, the documentation is also released for translation
and appears in the work list of your translator. We recommend that you inform your
translator before releasing such documentation.

Releasing a Function Module

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
68
Mickael QUESNOT ©

To release a function module, choose Function module → Release →Release.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
69
Note

Check the attributes for a function group to find out who is responsible for the function group.
Notify the person responsible when your function module is ready for release. You can also
release the function module only internally to other SAP developers.

Saving Tests and Test Sequences

Use
You use this procedure to:

▪ Save test runs

▪ Display old tests and their results

▪ Compare previous test results with results from a new test run

▪ Compose a test sequence for repeating tests.

Procedure
Saving a Test Run

1. In the Object Navigator (transaction SE80), open the function module you want to test.

2. In the toolbar, choose the Test/Execute pushbutton.

The Test Function Module: Initial Screen appears.

3. Choose Execute.

The Enter Parameter Value screen appears.

4. In the New Value field, specify a value for the input parameter and choose Continue.

5. In the toolbar, choose the Save Data Records pushbutton.

The Save Test Data screen appears.

6. In the Comments field, enter a description of the test run and choose Continue.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
70
Mickael QUESNOT ©

Displaying Old Test Data and Running Regression Tests

1. In the Object Navigator (transaction SE80), open the function module you want to test.

2. In the toolbar, choose the Test/Execute pushbutton.

The Test Function Module: Initial Screen appears.

3. In the toolbar, choose the Test Data Directory pushbutton.

The Test Data Directory: Single Tests screen appears.

4. Do one of the following:


Activity Result

To a. In the toolbar, choose the Test Data Directory pushbutton.


display
old tests The Test Data Directory: Single Tests screen appears.

To re-run b. In the toolbar, choose the Test data directory pushbutton.


old tests
c. Place the cursor on the test you want to re-examine.

d. In the toolbar, choose the Regression Test pushbutton.

The system executes the same test again and displays any
differences in the results.

i. Open the Function Builder (transaction SE37).

ii. Choose Function Module → Test → Test Sequence.

The Select Function Module screen appears.

iii. Enter the function modules you want to test in the table
and choose Execute.

You can re-run the same function module several times or


test different function modules. For example, you can test

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
71
Activity Result

a module that creates a new table record and then test


one that deletes the same record. If you want to test a
series of function modules, choose Function modules →
Other function module after each test.

iv. End the sequence by choosing Edit →New sequence.

Using Test Sequences

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
72
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
73
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
74
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
75
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
76
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
77
Defining the business object in SWO1 for BAPI

Go to transaction SWO1 and enter the name of the BAPI .

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
78
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
79
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
80
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
81
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
82
Mickael QUESNOT ©

Now select ‘Add Method’ from Utilities > API Methods > Add Method.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
83
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
84
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
85
Just click on the “next” icon.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
86
Mickael QUESNOT ©

Just click on the “next” icon.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
87
A popup will be displayed as below.
Click on Yes.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
88
Mickael QUESNOT ©

Select & Double click on method.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
89
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
90
Mickael QUESNOT ©

Now select the Object

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
91
Now go to: Edit > Change Release Status > Object type >To Implemented. We can see a message
reading “Object type status set to implemented” .

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
92
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
93
Now, go to: Edit > Change Release Status > Object > To Released. Click continue the Pop Up.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
94
Mickael QUESNOT ©

Now go to: Edit > Change Release Status > Object type component > To Released. You can see
the message reading“ status for method set to Released”.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
95
Click on ‘Generate’ from Object Type as shown below.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
96
Mickael QUESNOT ©

After clicking on the generate button, you can see the message reading “Object type” generated
successfully”. Now we are done with the creation of a BAPI.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
97
Test

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
98
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
99
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
100
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
101
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
102
Mickael QUESNOT ©

4: Checking the created BAPI in BAPI Explorer


Go to BAPI Explorer (BAPI) there we can find the BAPI (our BAPI).

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
103
Create New Custom Migration Object Using LTMOM

INTRODUCTION

As we know, SAP has pre-delivered objects in LTMC, but there is master data or transactional
data that does not yet have LTMC objects, such as service master. In this post, we will create a
custom LTMC object for uploading the CROSS SELLING (VB41) using LTMOM with A BAPI.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
104
Mickael QUESNOT ©

Testing is done on S/4HANA 2021.

Configuration Expert - Data Migration

SAP_BR_CONFIG_EXPERT_DATA_MIG

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
105
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
106
Mickael QUESNOT ©

Migrate Your Data


for Configuration Expert - Data Migration

With this app, you can migrate business data to SAP S/4HANA. You can migrate data directly
from certain SAP source systems, or you can use staging tables to migrate data.

Key Features
Read more in
App Documentation
Learn more about solution capability:
Data Integration for S/4HANA (S/4)

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
107
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
108
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
109
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
110
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
111
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
112
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
113
PREREQUISITES

Since S/4HANA 2020, SAP has deprecated LTMC using the web Dynpro version and moved to
the Fiori app Migrate Your Data (F3473).

How to Create New Custom LTMC Object using LTMOM

we will use Function Module BAPI_SERVICE_CREATE to create a Service Master custom LTMC
object.

CREATE A NEW CUSTOM OBJECT

1. Go to T-Code LTMOM

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
114
Mickael QUESNOT ©

2. Choose the project that you want to create a new custom object.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
115
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
116
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
117
3. After choosing the project, click in the menu bar Project->Create Migration Object-
>User-Defined->Migrate Data Using Files/Staging Tables to create a new custom object

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
118
Mickael QUESNOT ©

4. Enter the object ID and description and choose Function Module as the Target Structure,
then click Next

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
119
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
120
Mickael QUESNOT ©

5. Enter the name of Function Module, Return Parameter and TestRun parameter so that
we can do the simulation before uploading the data, then click continue

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
121
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
122
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
123
CREATE SOURCE STRUCTURE

After successfully creating the new custom object, now we create a source structure.

6. Double click on the source structure at the left sidebar, right click on the source
structure on the right sidebar, then choose Append Structure to Lower Level.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
124
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
125
7. Enter the name of the source structure, then click continue

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
126
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
127
8. Click add field to enter the fields of the source structure, then click the save

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
128
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
129
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
130
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
131
9. You can also make certain fields to become mandatory by right click the structure and
then choosing change view

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
132
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
133
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
134
Mickael QUESNOT ©

STRUCTURE MAPPING

After creating the source structure, we map our source to the target structure.

10. Double click on the structure mapping on the left sidebar

11. Drag our source structure to the target structure

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
135
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
136
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
137
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
138
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
139
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
140
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
141
12. Drag our source structure to the target mapping field, then click the save

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
142
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
143
FIELD MAPPING

And the last step is field mapping our source structure to the target structure.

13. Double click the Field Mapping on the left sidebar.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
144
Mickael QUESNOT ©

14. Drag the source field to the target field just like we did in the previous step

15. Right click Single-Character Flag Number Range Check, then choose assign rule

16. Choose rule Move and enter parameter ‘X’ to assign a constant value to the field

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
145
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
146
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
147
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
148
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
149
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
150
Mickael QUESNOT ©

17. Then click Save and then Generate

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
151
TESTING

1. Open Migrate Your Data app

2. Open your migration project

3. Our new custom migration object is automatically added to the project. Download the
template

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
152
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
153
4. Complete the template data

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
154
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
155
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
156
Mickael QUESNOT ©

5. Upload the template file

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
157
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
158
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
159
6. Click Prepare

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
160
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
161
7. After the preparation of the staging table is completed, you can click instance to check your
data.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
162
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
163
8. Choose Migrate

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
164
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
165
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
166
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
167
MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/
SAP S/4HANA CONSULTANT / SAP HELPER
168
Mickael QUESNOT ©

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
169
10. The migration data is successfully executed.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
170
Mickael QUESNOT ©

CONCLUSION

If pre-delivered LTMC objects don’t yet support your migration data requirements, you can
create custom objects using LTMOM with a standard or custom Function Module.

MICKAEL QUESNOT © https://www.linkedin.com/in/mickaelquesnot/


SAP S/4HANA CONSULTANT / SAP HELPER
171

You might also like