LTMOM
LTMOM
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.
2. In the context menu of the package, choose Create → Dictionary Object → Structure.
3. In the new dialog box, enter the name of the structure and choose with the quick info
text Continue.
You can find the structure at a later time using this short text, for example.
Perform the following steps for all the components you want to insert in the structure.
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
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.
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.
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.
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.
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.
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.
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.
You use this procedure to create function modules in the Function Builder.
3. In the context menu of the function group, choose Create → Function Module.
Process Specifies the function type. Choose Normal unless your function is to
type be run on remote systems or during update tasks.
6. Choose Save.
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.
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).
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.
LS_ZBAPIVB41-KAPPL = 'VS'.
LS_ZBAPIVB41-KVEWE = 'D'.
IF PV_DATAB IS INITIAL.
LS_ZBAPIVB41-DATAB = SY-DATUM.
ENDIF.
IF PV_DATBI IS INITIAL.
LS_ZBAPIVB41-DATBI = '99991231'.
ENDIF.
IF SY-SUBRC <> 0.
ZRETURN-TYPE = 'E'.
ZRETURN-NUMBER = '056'.
*Material & does not exist
MESSAGE E056(VK) WITH LS_ZBAPIVB41-MATWA INTO ZRETURN-MESSAGE.
APPEND ZRETURN.
EXIT.
ENDIF.
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.
LS_ZBAPIVB41-KNUMH = LS_VAKEDB-KNUMH.
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.
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.
NR_RANGE_NR = '01'
OBJECT = NUMMERVORG
IMPORTING
NUMBER = LS_ZBAPIVB41-KNUMH.
LV_NUMBER_GET_NEXT = 'X'.
ENDIF.
ENDIF.
CLEAR : TIME_VAKE_DB, XKONDAT, YKONDAT.
ENDIF.
APPEND XKONDDP.
BOOLE_T = 'X'.
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.
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.
ENDIF.
ENDIF.
ENDFUNCTION.
TABLES MARA.
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.
Field Description
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.
The exceptions screen only allows you to enter a text with which the exception can be
triggered in the function module.
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.
1. In the Object Navigator (transaction SE80), open the function module you want to edit.
You can switch between the inactive and the inactive version of a function module by choosing
Function module → Active <-> Inactive.
See also:
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
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.
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.
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.
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.
Use
You use this procedure to:
▪ Compare previous test results with results from a new test run
Procedure
Saving a Test Run
1. In the Object Navigator (transaction SE80), open the function module you want to test.
3. Choose Execute.
4. In the New Value field, specify a value for the input parameter and choose Continue.
6. In the Comments field, enter a description of the test run and choose Continue.
1. In the Object Navigator (transaction SE80), open the function module you want to test.
The system executes the same test again and displays any
differences in the results.
iii. Enter the function modules you want to test in the table
and choose Execute.
Now select ‘Add Method’ from Utilities > API Methods > Add Method.
Now go to: Edit > Change Release Status > Object type component > To Released. You can see
the message reading“ status for method set to Released”.
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.
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.
SAP_BR_CONFIG_EXPERT_DATA_MIG
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)
Since S/4HANA 2020, SAP has deprecated LTMC using the web Dynpro version and moved to
the Fiori app Migrate Your Data (F3473).
we will use Function Module BAPI_SERVICE_CREATE to create a Service Master custom LTMC
object.
1. Go to T-Code LTMOM
2. Choose the project that you want to create a new custom object.
4. Enter the object ID and description and choose Function Module as the Target Structure,
then click Next
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
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.
STRUCTURE MAPPING
After creating the source structure, we map our source to the target structure.
And the last step is field mapping our source structure to the target structure.
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
3. Our new custom migration object is automatically added to the project. Download the
template
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.