Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
alexey_danshin
Participant
9,405
In this blog post you will learn how to adjust Material migration object in order to populate customer basic and plant data. It could be used as “cooking receipt” for other material enhancements migration or even for the other object using the same BAPI capabilities. Same approach could be used for some other migration objects such as Sales Order or FI – G/L account balance and open/line item.

BAPI_MATERIAL_SAVEREPLICA is used for Material migration. In case Material Master data was enhanced to fulfill customer needs corresponding Migration Cockpit migration object should be adjusted accordantly. BAPI_MATERIAL_SAVEREPLICA is used. Parameters EXTENSIONIN and EXTENSIONINX are used for transferring customer data. Detailed description is available on FM documentation. MARA, MARC, MARD, MBEW, MLGN, MLGT, MVKE, MARM, MAKT customer data could be transferred via extension structures. Steps below show basic concept of z-field migration.

The customer has added their own fields to tables MARA and MARC using APPEND structures.




























Table Field Name Data Type
MARA ZZ_FIELD_A1 CHAR 10
MARA ZZ_FIELD_A2 CHAR 10
MARC ZZ_FIELD_C1 CHAR 4
MARC ZZ_FIELD_C2 CHAR 3

The customer also requires that fields could be migrated with Migration Cockpit.

  • Make sure field selection group is assigned to new fields. Please check it out in T-code OMSR. Otherwise fields data will not be transferred to database.

  • Structures below should be enhanced in the same way as MARA and MARC table









































































Structure Component Component Type Data Type Length Short Description
BAPI_TE_E1MARA ZZ_FIELD_A1 CHAR 10 Field1
ZZ_FIELD_A2 CHAR 10 Field2
BAPI_TE_E1MARAX ZZ_FIELD_A1 BAPIUPDATE CHAR 1 Updated information in related user data field
ZZ_FIELD_A2 BAPIUPDATE CHAR 1 Updated information in related user data field


BAPI_TE_E1MARC

 
ZZ_FIELD_C1 Field3
ZZ_FIELD_C2 Field4
BAPI_TE_E1MARCX ZZ_FIELD_C1 BAPIUPDATE CHAR 1 Updated information in related user data field
ZZ_FIELD_C2 BAPIUPDATE CHAR 1 Updated information in related user data field









  • Create new Migration Project with t-code LTMC.




Double click on Material Object and copy it to the migration project.



  • Open Migration Object Material with t-code LTMOM Migration Object Modeler.

  • Adjust source structure of Migration Objects. Add fields listed below to S_MARA.
































Name Data Type Length Decimal Places Amount Field Column Header Group Text
ZZ_FIELD_A1 CHAR 10 0 Field1 Additional fields
ZZ_FIELD_A2 CHAR 10 0 Field2 Additional fields



  • Add fields listed below to S_MARC source structure.
































Name Data Type Length Decimal Places Amount Field Column Header Group Text
ZZ_FIELD_C1 CHAR 4 0 Field_C1 Additional fields
ZZ_FIELD_C2 CHAR 3 Field_C2 Additional fields



  • Now we can activate object and download updated template. Added fields arear at the end of sheets Basic Data and Plant Data.






It’s not possible to simply map each new field due there is no dedicated elements in source structure. Example below show populated Extension* structures for MAT1 material.



























T28_EXTENSIONIN Ref. Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
Row Function [C(3)] Material [C(18)] Structure [C(30)] Valuepart1 [(240)]
1 MAT1 BAPI_TE_E1MARA MAT1             1         2
2 MAT1 BAPI_TE_E1MARC MAT1             10003   4

 



























T29_EXTENSIONINX Checkbox Structure for Extension In/Extension Out
Row Function [C(3)] Material [C(18)] Structure [C(30)] Valuepart1 [(240)]
1 MAT1 BAPI_TE_E1MARA MAT1             XX
2 MAT1 BAPI_TE_E1MARC MAT1             1000XX

Next topics describe how to adjust object accordingly.

  • Change subproject event-based rule BOR_S_MARA. Put ABAP code below to the end of rule after lines


existing

*  RETURN.                                      "leave processing
ENDIF.

Add code:
data: lv_e1mara TYPE  BAPI_TE_E1MARA,
lv_e1marax TYPE BAPI_TE_E1MARAX.
* check Z fields are populated
IF _wa_s_mara-zz_field_a1 IS NOT INITIAL
or _wa_s_mara-zz_field_a2 IS NOT INITIAL.
CLEAR: _wa_t28_extensionin,
lv_e1mara.

PERFORM _rule_move_op
USING
_wa_t28_extensionin-_parentrecno
_wa_s_mara-_recno.

PERFORM _rule_move_op
USING
_wa_t28_extensionin-material
_wa_s_mara-matnr.

PERFORM _rule_move_op
USING
_wa_t28_extensionin-structure
'BAPI_TE_E1MARA'.

lv_e1mara-material = _wa_s_mara-matnr.
lv_e1mara-zz_field_a1 = _wa_s_mara-zz_field_a1.
lv_e1mara-zz_field_a1 = _wa_s_mara-zz_field_a1.

PERFORM _rule_move_op
USING
_wa_t28_extensionin-valuepart1
lv_e1mara.
mwb:r_data_write(
[t28_extensionin]
[_wa_t28_extensionin]
).
*------------------------------------------------
* we also have to provide T29_EXTENSIONINX
*------------------------------------------------
CLEAR _wa_t29_extensioninx.
PERFORM _rule_move_op
USING
_wa_t29_extensioninx-_parentrecno
_wa_s_mara-_recno.

PERFORM _rule_move_op
USING
_wa_t29_extensioninx-material
_wa_s_mara-matnr.

PERFORM _rule_move_op
USING
_wa_t29_extensioninx-structure
'BAPI_TE_E1MARAX'.

lv_e1marax-material = _wa_s_mara-matnr.
IF _wa_s_mara-zz_field_a1 NE space.
MOVE 'X' TO lv_e1marax-zz_field_a1.
ENDIF.
IF _wa_s_mara-zz_field_a2 NE space.
MOVE 'X' TO lv_e1marax-zz_field_a2.
ENDIF.

MOVE lv_e1marax to _wa_t29_extensioninx-valuepart1.

mwb:r_data_write(
[t29_extensioninx]
[_wa_t29_extensioninx]
).
ENDIF.


  • Create subproject event-based rule ZBOR_S_MARC. Put ABAP code below.


 

 
"MARC Z fields handling
data: lv_e1marc TYPE BAPI_TE_E1MARC,
lv_e1marcx TYPE BAPI_TE_E1MARCX,
lv_valuepart TYPE string.

* check if marc Z fields are populated
IF _wa_s_marc-zz_field_c1 IS NOT INITIAL
or _wa_s_marc-zz_field_c2 IS NOT INITIAL.

CLEAR: _wa_t28_extensionin,
lv_e1marc.

PERFORM _rule_move_op
USING
_wa_t28_extensionin-_parentrecno
_wa_s_marc-_recno.

PERFORM _rule_move_op
USING
_wa_t28_extensionin-material
_wa_s_marc-matnr.

PERFORM _rule_move_op
USING
_wa_t28_extensionin-structure
'BAPI_TE_E1MARC'.

lv_e1marc-material = _wa_s_marc-matnr.
lv_e1marc-plant = _wa_s_marc-werks.
lv_e1marc-zz_field_c1 = _wa_s_marc-zz_field_c1.
lv_e1marc-zz_field_c2 = _wa_s_marc-zz_field_c2.
PERFORM _rule_move_op
USING
_wa_t28_extensionin-valuepart1
lv_e1marc.

mwb:r_data_write(
[t28_extensionin]
[_wa_t28_extensionin]
).
*------------------------------------------------
* we also have to provide T29_EXTENSIONINX
*------------------------------------------------
CLEAR _wa_t29_extensioninx.
PERFORM _rule_move_op
USING
_wa_t29_extensioninx-_parentrecno
_wa_s_marc-_recno.

PERFORM _rule_move_op
USING
_wa_t29_extensioninx-material
_wa_s_marc-matnr.

PERFORM _rule_move_op
USING
_wa_t29_extensioninx-structure
'BAPI_TE_E1MARCX'.
lv_e1marcx-material = _wa_s_marc-matnr.
lv_e1marcx-plant = _wa_s_marc-werks.
IF _wa_s_marc-zz_field_c1 NE space.
MOVE 'X' TO lv_e1marcx-zz_field_c1.
ENDIF.
IF _wa_s_marc-zz_field_c2 NE space.
MOVE 'X' TO lv_e1marcx-zz_field_c2.
ENDIF.

MOVE lv_e1marcx to _wa_t29_extensioninx-valuepart1.

mwb:r_data_write(
[t29_extensioninx]
[_wa_t29_extensioninx]
).
ENDIF.

 



  • Set up structure mapping.


Target Structure               T28_EXTENSIONIN

Description                   Ref. Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT






























Source Structure Description Access Type Mapping Type Source Cardinality Target Cardinality Data Path Type
S_MARA Basic Data Mapping only Split 1 0 Not Applicable
S_MARC Plant Data Mapping only Split 1 0 Not Applicable

Target Structure               T29_EXTENSIONINX

Description                   Checkbox Structure for Extension In/Extension Out






























Source Structure Description Access Type Mapping Type Source Cardinality Target Cardinality Data Path Type
S_MARA Basic Data Mapping only Split 1 0 Not Applicable
S_MARC Plant Data Mapping only Split 1 0 Not Applicable





  • Adjust field mapping


Add ZBOR_S_MARC rule to Start of Record (Material Data at Plant Level)





  • Save and generate project.

  • Go to LTMC T-code and migrate your data.


Thereby we have prepared Material Master Migration Cockpit object which can migrate Z fields. I hope this example will be useful for adjustment migration object in order to transfer customer specific data .

 
7 Comments
Labels in this area