Uploaded by gri6os

SMT (Service Mapping Tool) Mapping

advertisement
SMT (Service Mapping Tool)
Applies to:
This document applies to SAP versions ECC 6.0. For more information, visit the ABAP homepage.
Summary
This article contains the guidelines for using the SMT (Service mapping Tool) Mapping. Main purpose this is
data mapping in interfaces. Through SMT Mapping we can simply map fields in an input structure to output
structure. It will reduce the coding and enhance the performance of the code
Author:
Prasanth.P
Company: Applexus Software Solutions (P) Ltd
Created on: 10 March 2011
Author Bio
Prasanth P is working as SAP ABAP HR with Applexus Software Solutions (P) Ltd. He is having
expertise in various Implementation, Support and Rollout Projects across various countries.
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
1
SMT (Service Mapping Tool)
Table of Contents
Introduction ......................................................................................................................................................... 3
Creating Package Groups ............................................................................................................................... 3
Assigning Packages ........................................................................................................................................ 4
Create Mapping .................................................................................................................................................. 6
Create Mapping Steps .................................................................................................................................... 7
Using SMT Mapping in Code ............................................................................................................................ 12
Initialize smt engine....................................................................................................................................... 12
Map data ....................................................................................................................................................... 12
Related Content ................................................................................................................................................ 13
Disclaimer and Liability Notice .......................................................................................................................... 14
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
2
SMT (Service Mapping Tool)
Introduction
SMT Mapping we can do through the transaction code SMT. Before doing the mapping we need to create a
package group. This created package group we want to specify while creating the mapping. In the creation of
mapping we need to specify each mapping as mapping steps. The SMT is a program that enables you to fill
target structures by using sets of source structures (in ABAP). It supports: simple mappings, mappings with
field transformations, complex transformations and field checks. Possible applications of the tool include:
preparation of data for further actions, conversions of Enterprise Service data to an SAP-internal format, and
vice versa. The SMT supports specific requirements for service implementations, such as extended XML
handling or field checks. The SMT executes standard mappings before extensions. Any checks that you
have activated for overwriting fields are never active for extensions.
Creating Package Groups
SMT – Menu
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
3
SMT (Service Mapping Tool)
Select the menu item ‟ define package groups‟
Check the package group whether it is exists already
If does not exists, press new entries button and create a new package group
Assigning Packages
In the Tree Menu Select the package group and double click on packages
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
4
SMT (Service Mapping Tool)
Click „new entries‟ and give the packages name in the table control
Enter 'GMT_TRANSFORMATION' (Mandatory) and also enter your custom created package
Press save button
Package group creation was completed
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
5
SMT (Service Mapping Tool)
Create Mapping
Click the second option “Create and edit mappings”
Now the web dynpro screen opens
Please enter the Mapping name, description , Package group and press enter button
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
6
SMT (Service Mapping Tool)
Create Mapping Steps
Now we need to define mapping steps
Enter mapping step name,description,source ,target structures and press enter button
Select the mapping step and press the details button in the table control
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
7
SMT (Service Mapping Tool)
Please select the mapping transformations tab
Please select the field mapping record in the table control
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
8
SMT (Service Mapping Tool)
Now the source and target structure with fields are displayed on the screen
Select the fields which we have to map and press map button
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
9
SMT (Service Mapping Tool)
Do the above step for all fields which we want to map
And finally press the close button then it will show save dialogue, save the mapping and exit
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
10
SMT (Service Mapping Tool)
Press the save button of mapping steps screen
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
11
SMT (Service Mapping Tool)
Using SMT Mapping in Code
Refer the below while writing SMT code in the program
Step 1: first it will initialize smt engine
Step2: Then it will map the source to target
DATA:
lo_smt_wcdvl_data
lx_smt_error
lo_smt_protocol
TYPE REF TO cl_smt_engine,
TYPE REF TO cx_smt_error,
TYPE REF TO cl_smt_protocol.
Initialize smt engine
TRY.
CREATE OBJECT lo_smt_wcdvl_data
EXPORTING
i_mapping
= zcl_constants_58693=>c_mapping_name1
i_mapping_step
= zcl_constants_58693=>c_mapping_step1
i_context
= space
i_extended_xml_handling = abap_true
i_with_prefetch
= abap_false.
CATCH cx_smt_error INTO lx_smt_error.
lo_smt_protocol = lx_smt_error->a_protocol.
CALL METHOD lo_smt_protocol->get_messages_as_bapiret
IMPORTING
et_message = lt_message.
APPEND LINES OF lt_message TO et_return.
RAISE EXCEPTION TYPE cx_sapplco_standard_msg_fault.
ENDTRY.
Map data
TRY.
LOOP AT ls_input-create_well_completion_volume-well_completion_volume ASSIGNING
<ls_input>.
CLEAR ls_data_out.
CALL METHOD lo_smt_wcdvl_data->execute
EXPORTING
i_source
= <ls_input>
CHANGING
ch_target = ls_data_out.
APPEND ls_data_out TO et_data_out.
ENDLOOP.
CATCH cx_smt_error INTO lx_smt_error.
lo_smt_protocol = lx_smt_error->a_protocol.
CALL METHOD lo_smt_protocol->get_messages_as_bapiret
IMPORTING
et_message
= lt_message.
APPEND LINES OF lt_message TO et_return.
RAISE EXCEPTION TYPE cx_sapplco_standard_msg_fault.
ENDTRY.
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
12
SMT (Service Mapping Tool)
Related Content
Service Mapping Tool (SMT)
Insurance Claim Handling 3
For more information, visit the ABAP homepage
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
13
SMT (Service Mapping Tool)
Disclaimer and Liability Notice
This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not
supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document,
and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or
code sample, including any liability resulting from incompatibility between the content within this document and the materials and
services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this
document.
SAP COMMUNITY NETWORK
© 2011 SAP AG
SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
14
Download