Show TOC

Background documentationField Mappings

 

In this section you define mappings of source fields to target fields. You can edit the following attributes (for example):

  • Target field: Name of target field

  • Source structure (outbound structure): One of the source structures that you specified for this mapping step.

  • Source field: Source structure field that supplies the source value

  • Fixed value: If you enter a non-initial value here, the system enters a fixed value into the target field. In this case, you must not enter any values for the source structure and the source field.

  • Field transformation: Name for a class that implements the interface IF_SMT_CONVERSION. The class converts a source value, before the system copies it to the target field.

Example Example

You want to copy a document number from one source field into a target field. The document number was entered without initial zeros. Enter the structure, which contains the document number, as a source structure, and enter the field of the document number as source field. Select the field, which you want to contain the number, as target field. To acquire the initial zeros, enter the field transformation CL_SMT_CONVERSION_ALPHA_IN.

End of the example.

Field Transformations

Field transformations are implementations of the interface IF_SMT_CONVERSION. This interface contains the method CONVERT only. It has the following signature:

  • I_SOURCE: Import parameter that contains the source value

  • I_SOURCE_STRUCTURE: Import parameter that contains the name of the source structure

  • I_SOURCE_FIELD: Import parameter that contains the name of the source field

  • I_TARGET_STRUCTURE: Import parameter that contains the name of the target structure

  • I_TARGET_FIELD: Import parameter that contains the name of the target field

  • E_TARGET: Export parameter that contains the converted value

The important parameters for the field value before and after the conversion are I_SOURCE and E_TARGET. The parameters I_SOURCE_STRUCTURE, I_SOURCE_FIELD, I_TARGET_STRUCTURE and I_TARGET_FIELD are required for creating user-friendly error messages. To inform the tool of an error, the conversion method must trigger a type CX_SMT_TRANSFORMATION_ERROR exception. This exception contains a log for storing multiple error messages. If only one message is required, you can use the following template to trigger the exception:

Syntax Syntax

  1. DATA: "...
  2.     l_protocol TYPE REF TO cl_smt_protocol,
  3.     "...
  4.   l_protocol = cl_smt_protocol=>create_protocol_for_message( i_msgid = l_msgid
  5.              i_msgty = l_msgty
  6.              i_msgno = l_msgno
  7.              i_msgv1 = l_msgv1
  8.              i_msgv2 = l_msgv2
  9.              i_msgv3 = l_msgv3
  10.              i_msgv4 = l_msgv4 ).
  11.   RAISE EXCEPTION TYPE cx_smt_transformation_error EXPORTING a_protocol = l_protocol.
End of the code.