T4S4  18.2 C7549 A21431
Teamcenter Gateway for SAP S/4HANA API Reference
T4S::MM::CUSTOM::ITEM::IMPORT Namespace Reference

Mapping namespace for T4S material master import. More...

Functions

 createTC_Object Function ObjectKey AdditionalInfo args
 Customer specific mapping function to create a Teamcenter item and item revision. More...
 
 getMaterialMasterInfo ObjectKey AdditionalInfo args
 Customer specific mapping function to read material master data from SAP. More...
 
 SAP_MaterialMasterMapping2TC_Object Function ItemType ItemRevisionType ObjectKey AdditionalInfo args
 Customer specific mapping function for writing SAP attributes to Teamcenter attributes. More...
 
 selectTC_Object Function ObjectKey AdditionalInfo args
 Customer specific mapping function to identify the corresponding target item revision. More...
 
 updateTC_Object Function ItemTag ItemRevisionTag ItemType ItemRevisionType ObjectKey AdditionalInfo args
 Customer specific mapping function to start an additional customer specific post-action after the normal update. More...
 

Detailed Description

Mapping namespace for T4S material master import.

The namespace contains the custom specific part of a T4S material master import:

  • Procedure getMaterialMasterInfo reads the related SAP material master information
  • Procedure selectTC_Object searches for the related Teamcenter item using Teamcenter query Find_MaterialMaster_in_TC
  • Procedure createTC_Object creates a new Teamcenter item and item revision if item not exists
  • Procedure SAP_MaterialMasterMapping2TC_Object maps SAP attributes to Teamcenter attributes (so called reverse mapping)
  • Procedure updateTC_Object updates the new created Teamcenter item and item revision
Note
All transfers from SAP to Teamcenter are executed asynchronously via batch job.
For the T4S Material Master Import the pre-defined import batch job template T4S_IMPORT_MM exists.
For the data exchange between SAP and T4S the internal TCL array ::SAPMatDat is used.
For the data exchange between Teamcenter and T4S the internal TCL dictionary ::TcData is used.
SAP attributes can be read from ::SAPDat using function T4S::TC::MAPPING::SAPFieldMapping.
Teamcenter attributes can be written to ::TcData with function T4X::TC::MAPPING::storeReverseMappingAttribute.
Precondition
For the material master import the following preferences are used:
  • T4S_MaterialMasterTypeList : list of allowed Teamcenter object types
  • T4S_MaterialMasterMapping2<ObjectType> : list of Teamcenter data types to write back during reverse mapping
  • T4S_MaterialMasterFieldMapping2<DataType> : list of Teamcenter attributes to write back during reverse mapping (optional)

Function Documentation

◆ createTC_Object()

T4S::MM::CUSTOM::ITEM::IMPORT::createTC_Object   Function ObjectKey AdditionalInfo args  

Customer specific mapping function to create a Teamcenter item and item revision.

The procedure creates a new Teamcenter item and item revision.

Parameters
Function- Name of the batch job template
ObjectKey- SAP Id of material master
AdditionalInfo- additional information
args- Not used
Returns
Return code used by the following import function. The following values are valid:
OK $ItemTag -> T4S will continue the batch job execution with proc SAP_MaterialMasterMapping2TC_Object
SKIPPED -> T4S will abort batch job execution by going to cleanup procedure directly
any other return value -> T4X treats it as an error, there by customised error returns with info when/why the error occured are supported

References T4X::CUSTOM::MAPPING::TOOLBOX::createTC_Object(), T4X::CORE::getSessionLogChannel(), T4S::TC::MAPPING::SAPFieldMapping(), and tpwrite().

◆ getMaterialMasterInfo()

T4S::MM::CUSTOM::ITEM::IMPORT::getMaterialMasterInfo   ObjectKey AdditionalInfo args  

Customer specific mapping function to read material master data from SAP.

The procedure reads the related SAP material master information.
Input parameter ObjectKey is retrieved from batch job attribute ImportObjectId.

Parameters
ObjectKey- SAP Id of material master
AdditionalInfo- Not used
args- Not used
Returns
Return code used by the following import function. The following values are valid:
OK $ObjectKey -> T4S will continue the batch job execution with proc selectTC_Object
SKIPPED -> T4S will abort batch job execution, ZPTC entry (if configured) will be update to E2S_STATUS C (cancelled)
ERROR $ErrorMessage -> T4S will abort batch job execution, ZPTC entry (if configured) will be update to E2S_STATUS E (error)

References TPSAP::MM::getAllMaterialMasterInfos(), TPSAP::MM::getMaterialMasterInfo(), TPSAP::MM::getMaterialMasterInfoRfc(), TPSAP::getReleaseInfo(), T4X::CORE::getSessionLogChannel(), and tpwrite().

◆ SAP_MaterialMasterMapping2TC_Object()

T4S::MM::CUSTOM::ITEM::IMPORT::SAP_MaterialMasterMapping2TC_Object   Function ItemType ItemRevisionType ObjectKey AdditionalInfo args  

Customer specific mapping function for writing SAP attributes to Teamcenter attributes.

The procedure maps some SAP attributes to Teamcenter attributes
SAP Id -> user_data_1
SAP OLD_MAT_NO -> user_data_2
T4S import status -> item_comment

Parameters
Function- Name of the batch job template
ItemType- Teamcenter item type
ItemRevisionType- Teamcenter item revision type
ObjectKey- SAP Id of material master
args- Not used
Returns
No return code required

References TPSAP::MM::getExternalMaterialNumber(), T4X::CORE::getSessionLogChannel(), T4S::TC::MAPPING::SAPFieldMapping(), T4X::TC::MAPPING::storeReverseMappingAttribute(), and tpwrite().

◆ selectTC_Object()

T4S::MM::CUSTOM::ITEM::IMPORT::selectTC_Object   Function ObjectKey AdditionalInfo args  

Customer specific mapping function to identify the corresponding target item revision.

The procedure identifies the corresponding Teamcenter item revision using the Teamcenter query Find_MaterialMaster_in_TC.

Parameters
Function- Name of the batch job template
ObjectKey- SAP Id of material master
AdditionalInfo- additional information
args- Not used
Returns
Return code used by the following import function. The following values are valid:
FOUND $ItemRevisionTag -> T4X will continue the import execution with proc SAP_MaterialMasterMapping2TC_Object

OK $ItemRevisionTag -> T4X will continue the import execution with proc SAP_MaterialMasterMapping2TC_Object
NOT_FOUND $ErrorMessage -> T4X will continue the import execution with proc createTC_Object (using search query)
ITEMID_DOESNT_EXIST $ErrorMessage -> T4X will continue the import execution with proc createTC_Object (using ITK::ITEM_exists)
SKIPPED -> T4X will stop the import execution successfully without an error
any other return value -> T4X treats it as an error, there by customised error returns with info when/why the error occured are supported

References ITK::executeQuery(), TPSAP::MM::getExternalMaterialNumber(), T4X::CORE::getSessionLogChannel(), ITK::ITEM_ask_latest_rev(), and tpwrite().

◆ updateTC_Object()

T4S::MM::CUSTOM::ITEM::IMPORT::updateTC_Object   Function ItemTag ItemRevisionTag ItemType ItemRevisionType ObjectKey AdditionalInfo args  

Customer specific mapping function to start an additional customer specific post-action after the normal update.

The procedure updates the new Teamcenter item or item revision and saves the changes.

Parameters
Function- Name of the batch job template
ItemTag- Teamcenter item tag
ItemRevisionTag- Teamcenter item revision tag
ItemType- Teamcenter item type
ItemRevisionType- Teamcenter item revision type
ObjectKey- SAP Id of material master
args- Not used
Returns
Return code used by the following import function. The following values are valid:
OK -> T4S will continue and pass the return code as BatchJobStatus to proc cleanUp
SKIPPED -> T4S will continue and pass the return code as BatchJobStatus to proc cleanUp
ERROR -> T4S will continue and pass the return code as BatchJobStatus to proc cleanUp

References ITK::AOM_refresh_lock(), T4X::CORE::getSessionLogChannel(), T4X::CUSTOM::MAPPING::TOOLBOX::saveItemWithUnlock(), tpco_formatHEX16(), and tpwrite().