62
Teamcenter Product Cost Management Gateway for SAP S/ 4HANA - Configuration Guide

Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

  • Upload
    others

  • View
    24

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

TeamcenterProduct CostManagementGateway for SAP S/4HANA-ConfigurationGuide

Page 2: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Contents

Preface 5

Introduction 1-1

Basic ConfigurationThe File tcpcm4s_mapping_config ────────────────────────── 2-1Provide SAP Account Information ─────────────────────────── 2-2Configurable Teamcenter Product Cost Management URL ─────────── 2-3Configure Communication Channel ────────────────────────── 2-3Mapping Templates ──────────────────────────────────── 2-5

SAP Authentication ConceptTechnical Concept Manual SAP Logon ──────────────────────── 3-1Technical Concept SAP Auto Logon ────────────────────────── 3-2

Calculation Structure PreviewTechnical Concept TCPCM4S Calculation Structure Preview ─────────── 4-1Calculation Structure Preview Mapping File ───────────────────── 4-1Structure of the Input Dictionary for the Calculation Structure Preview Usecase

───────────────────────────────────────────── 4-2

Calculation Structure ImportTechnical Concept TCPCM4S Calculation Structure Import ─────────── 5-1Teamcenter Product Cost Management Gateway for SAP S/4HANA Calculation

Structure Import Mapping File ───────────────────────── 5-3Structure of the Input Dictionary for the Calculation Structure Import Usecase

───────────────────────────────────────────── 5-5

Masterdata SynchronisationTechnical Concept Teamcenter Product Cost Management Gateway for SAP S/

4HANA Masterdata Synchronisation ───────────────────── 6-1Technical Concept TCPCM4S Masterdata Synchronisation for Generic Objects ──── 6-1Technical Concept TCPCM4S Intelligent Material Masterdata Synchronisation ──── 6-2

Teamcenter Product Cost Management Gateway for SAP S/4HANA - MasterdataSynchronisation Trigger Script ───────────────────────── 6-3

Teamcenter Product Cost Management Gateway for SAP S/4HANA MasterdataSynchronisation Mapping File ───────────────────────── 6-4

Structure of the Input Dictionary for the Masterdata Synchronization Usecase───────────────────────────────────────────── 6-6

Configuration Guide 2© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 3: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Cross functional SAP ConfigurationUseful SAP Key Shortcuts ──────────────────────────────── 7-1Using a Custom BAPI for a Standard Transaction ────────────────── 7-1Technical Name of SAP GUI Fields ─────────────────────────── 7-2Read SAP Table ─────────────────────────────────────── 7-3Installed SAP Languages ───────────────────────────────── 7-4Get SAP Connection Data ──────────────────────────────── 7-5Correct Number and Date Format ─────────────────────────── 7-6Check if an Object is Locked in SAP ────────────────────────── 7-7Call Custom SAP BAPI ─────────────────────────────────── 7-8Basics on SAP Long Text ───────────────────────────────── 7-9Basics about SAP Object Links ───────────────────────────── 7-9Ask SAP GUI for Type Abbreviations ────────────────────────── 7-9Call Transaction ────────────────────────────────────── 7-10

Glossary A-1

Contents

Configuration Guide 3© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 4: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

4 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 5: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

PrefaceThis documentation cannot be used as a substitute for consulting advice, because it can never considerthe individual business processes and configuration. Despite our best efforts it is probable that someinformation about functionality and coherence may be incomplete.

Issue: August 2019

Legal notice:

All rights reserved. No part of this documentation may be copied by any means or made available toentities or persons other than employees of the licensee of the Teamcenter Product Cost ManagementGateway for SAP S/4HANA or those that have a legitimate right to use this documentation as part oftheir assignment on behalf of the licensee to enable or support usage of the software for use within theboundaries of the license agreement.

© 2018-2019 Siemens Product Lifecycle Management Software Inc.

Trademark notice:

Siemens, the Siemens logo and SIMATIC IT are registered trademarks of Siemens AG.

Camstar and Teamcenter are trademarks or registered trademarks of Siemens Product LifecycleManagement Software Inc. or its subsidiaries in the United States and in other countries.

Oracle is a registered trademark of Oracle Corporation.

SAP, R/3, SAP S/4HANA®, SAP Business Suite® and mySAP are trademarks or registered trademarks of SAPor its affiliates in Germany and other countries.

TESIS is a registered trademark of TESIS GmbH.

All other trademarks, registered trademarks or service marks belong to their respective holders.

Configuration Guide 5© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 6: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

6 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 7: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

1. IntroductionThe Teamcenter Product Cost Management Gateway for SAP S/4HANA (TCPCM4S) software solution isan integration software that provides data and process integration between Teamcenter Product CostManagement® by Siemens Product Lifecycle Management Software Inc. and SAP S/4HANA® by SAP AG

TCPCM4S provides functionality to sync masterdata from SAP ERP, search and import calculations intoTeamcenter Product Cost Management. It is also possible to show a preview of the calculation prior tothe import. TCPCM4S also comes with an authentication suite to authenticate against SAP ERP.

This document details the components of Teamcenter Product Cost Management Gateway for SAP S/4HANA integration, which are available out of the box and configurable to meet customer specificsolution requirements.

Configuration Guide 1-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 8: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

1. Introduction

1-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 9: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

2. Basic Configuration

The File tcpcm4s_mapping_config

The file tcpcm4s_mapping_config.sd in the directory <GS_ROOT>\var\mmap\tcpcm4s_mapping_config\is the first file that is read by each TCL worker thread or process of the TCPCM4S software. It loads therest of the mapping files and may contain basic settings as well as variables which are supposed to beused in more than one mapping file.

The following basic configuration data can be set in generic mapping configuration filetcpcm4s_mapping_config.sd:

• System login data, see chapter Provide SAP Account Information

• The variable ::TCPM4S_Defaults(MasterDataSyncURL) determines the URL of TeamcenterProduct Cost Management endpoint for the masterdata sync. For more information on how to set upthis enpoint, please refer to the official Teamcenter Product Cost Management documentation.

• The variable ::TCPM4S_Defaults(CommunicationChannelUser) determines the usernamethat should be used for authentication against the Teamcenter Product Cost Management endpointfor the masterdata sync, in case basic authentication is enabled. The user needs to be stored inencrypted form. This variable should not be set at all in case not basic authentication is used.

• The variable ::TCPM4S_Defaults(CommunicationChannelPassword) determines thepassword that should be used for authentication against the Teamcenter Product Cost Managementendpoint for the masterdata sync, in case basic authentication is enabled. The password needs to bestored in encrypted form. This variable should not be set at all in case not basic authentication is used.

• The variables ::TCPM4S_Defaults(ConfigGuid<My_Masterdata_Object_Type>) define theTeamcenter Product Cost Management config GUID that is used for a specific masterdata object type(<My_Masterdata_Object_Type>). Possible values for the masterdata object types are:MaterialMasterHeader, MaterialMasterDetail, MaterialMasterRevision, PlantHeader,WorkcenterHeader, CostcenterHeader, ActivityTypeHeader and ActivityRateHeader.

• Thevariables ::TCPM4S_Defaults(ImportConfigAttributes<My_Masterdata_Object_Type>) define the Teamcenter Product Cost Management attributes that will be sent in the payload. All ofthose attributes need to be found in the corresponding import configuration for that specificmasterdata object type.

• Since the there could be a difference between the attributes that are in the import config and theattributes we might want to map and send, thevariables ::TCPM4S_Defaults(AttributesForPayload<My_Masterdata_Object_Type>)define the Teamcenter Product Cost Management attributes that will be mapped for the payload. Allof those attributes need to be found in the corresponding import configuration for that specificmasterdata object type.

Configuration Guide 2-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 10: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

• Sourcing of mapping files with source -relax.Example: source -relax tcpcm4s_calcstruct_import_custom.sd. This means TCPCM4Shas to read the content of the file tcpcm4s_calcstruct_import_custom.sd. The argument -relaxmeans the file is looked up in the memory first and only if its content is not there, the file is loadedfrom disc (only in the same directory <GS_ROOT>\var\mmap\tcpcm4s_mapping_config).In principle, the file names may be modified freely as long as the file extension .sd is kept. Every filestated there that has the file extension .sd is actually used for the mapping functionality. In fact theonly file TCPCM4S actually uses for the mapping is the compiled mapping filetcpcm4s_mapping_config.rfdt. So this is what you need to think about in order to create the compiledmapping file correctly.In order to not use a mapping file it is enough to not "source" it in tcpcm4s_mapping_config.sd.However, we strongly recommend keeping only those mapping files in the mmap directory that youreally want to use!Be sure to have the correct file names (the files located in <GS_ROOT>\var\mmap\tcpcm4s_mapping_config) in the "source" section of this file

Provide SAP Account Information

When authenticating against SAP ERP out of Teamcenter Product Cost Management there are twopotential ways to authenticate:

• Manual logon = User enters SAP Logon credentials for a certain SAP system manually over a userlogon dialogue

• Auto logon = No input from the user is needed and the authentication against SAP is managedautomatically by TCPCM4S in the background

The settings described here have to be done in the file tcpcm4s_mapping_config.sd. For theconfiguration that has to be done in Teamcenter Product Cost Management in terms of logonconfiguration (TCPCM4S Adapter Config) please refer to the official Teamcenter Product CostManagement documentation. It is also possible to combine the definition of manual and auto logon.Solely the Teamcenter Product Cost Management configuration determines which approach is used.

Storing SAP logon information for Manual logon

TCPCM4S Configuration

Since all information about the logon is entered manually in the Teamcenter Product Cost Managementuser dialogue, there is no need to define any information in the tcpcm4s_mapping_config.sd. Theinformation is just routed through to TCPCM4S. It just needs to be ensured that the sapnwrfc.inicontains all SAP systems that the user mights selects within Teamcenter Product Cost Management.

Storing SAP logon information for Auto logon

Configuration in tcpcm4s_mapping_config.sd

2. Basic Configuration

2-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 11: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

The auto logon information for the SAP system can be defined by using the generic EA connectionhandling functions in the tcpcm4s_mapping_config.sd. The chapter Test SAP Connection withNetweaver how this can be achieved.

Configurable Teamcenter Product Cost Management URL

TCPCM4S executes the web services calls to the Teamcenter Product Cost Management webserviceendpoint that is configured on an IIS. The service call for all masterdata objects is implemeted inthe ::TCPCM4S::PCM::WEBSERVICE::TOOLBOX::callTcPCMService4Masterdata function. Itis important to only configure the second part of the URL, because the base URL to the IIS needs to beconfigured in the communication channel configuration (for more information please refer toConfigure Communication Channel). The target URL suffix may have the following structure:

#***************************************************************************************************# Configuration of the masterdata sync from SAP to TCPCM#***************************************************************************************************## set ::TCPM4S_Defaults(MasterDataSyncURL) "/<your.iis.service.name>/PpcConnectorService.svc/<your authentication method>"#

The following code shows an example configuration:

## Example configuration for localhost environment:#set ::TCPM4S_Defaults(MasterDataSyncURL) "/PpcConnectorService.svc/basic"

Configure Communication Channel

The Teamcenter Product Cost Management Gateway for SAP S/4HANA connection to TeamcenterProduct Cost Management is configured via a "Communication Channel". By default TCPCM4S has acommunication channel called "PCM" configured. This communication channel needs to be used toconfigure the connection to Teamcenter Product Cost Management for outgoing webservice calls. Donot rename the default communication channel!

Since the configuration of the webservices for Teamcenter Product Cost Management is a manual step,the default communication channel needs to be adjusted to the configuration of the correspondingendpoint on the IIS. For more information on configuring the Teamcenter Product Cost Managementendpoint for the masterdata sync, please refer to the official Teamcenter Product Cost Managementdocumentation.

In order to adjust the configuration of the "PCM" communication channel, open the advanced settings inthe "Communication Channel" Menu:

Configurable Teamcenter Product Cost Management URL

Configuration Guide 2-3© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 12: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Afterwards you can select and edit the default communication channel "PCM":

In the actual communication channel dialogue you can then configure base url of your webservice (theendpoint url until but without /PpcConnectorService.svc), the port the webservice endpoint is listeningto (default IIS port is :80). It also gives you the possibility to enable TLS. For more information on TLSplease refer to the help in the Admin UI.

2. Basic Configuration

2-4 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 13: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Mapping Templates

The installation package of the GS contains mapping templates under the following path <GS_ROOT>\var\mmap\tcpcm4s_mapping_config\. Those mapping templates only work with the correspondingimport configuration within Teamcenter Product Cost Management. The demo mapping templatesdepend further on an out of the box SAP system with IDES demo data to work.

The samples in the mapping template files may serve as a guideline to your own customer specificimplementation and show the use of the functions provided to make the implementation easier.

• tcpcm4s_calcstruct_import_custom.sdSample implementation of a multi-level calculation structure import.

• tcpcm4s_calcstruct_preview_custom.sdContains a sample implementation of a calculation structure preview.

• tcpcm4s_material_import_custom.sdImplementation of an example import job mapping that reads material master information from SAPand creates Material Header, Material Revision and Material Details for all plants that the MaterialMaster is maintained.

• tcpcm4s_plant_import_custom.sd

Mapping Templates

Configuration Guide 2-5© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 14: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Implementation of an example import job mapping that creates a plant in Teamcenter Product CostManagement based on metadata that is assigned to the import job.

• tcpcm4s_workcenter_import_custom.sdImplementation of an example import job mapping that creates a workcenter in Teamcenter ProductCost Management based on metadata that is assigned to the import job.

• tcpcm4s_costcenter_import_custom.sdImplementation of an example import job mapping that creates a costcenter in Teamcenter ProductCost Management.

• tcpcm4s_activity_rates_import_custom.sdImplementation of an example import job mapping that creates activity rates in Teamcenter ProductCost Management based on metadata that is assigned to the import job.

• tcpcm4s_activity_types_import_custom.sdImplementation of an example import job mapping that creates activity types in Teamcenter ProductCost Management based on metadata that is assigned to the import job.

• tcpcm4s_custom_functions.sdThis mapping file can be used to implement custom functions that might be called from multiplemapping files.

The delivery also contains a script to trigger the masterdata sync between SAP and Teamcenter ProductCost Management by creating the import jobs. This script might be modified as well as the mappingfiles, according to customer specific requirements. The script tcpcm4s_trigger_masterdata_sync.tcl islocated under the following path: <GS_ROOT>\var\test\TCPCM4S\

2. Basic Configuration

2-6 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 15: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

3. SAP Authentication Concept

Technical Concept Manual SAP Logon

The following picture describes the concept that is used for the manual logon. For more informationabout how to configure the auto logon in TCPCM4S itself please refer to the chapter Provide SAPAccount Information. For more information on how to configure the manual logon in TeamcenterProduct Cost Management please refer to the official product documentation.

The center of the whole manual logon mechanism is a unique logon token that is stored in TeamcenterProduct Cost Management and Teamcenter Product Cost Management Gateway for SAP S/4HANA for thelength of a user session (= open Teamcenter Product Cost Management instance on a client). Thedialogue to enter the logon information will only pop up for the first logon in the session. TCPCM4Smanages the the SAP logon information that was entered over a logon dialogue in Teamcenter ProductCost Management. In case the import and preview of a calculation structure has to be done withanother language, then this can be accomplished by restarting / opening another Teamcenter ProductCost Management session in combination with entering the desired language in the logon dialogue.

Configuration Guide 3-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 16: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Technical Concept SAP Auto Logon

The following picture describes the concept that is used for the auto logon. For more information aboutwhat to consider for the auto logon in TCPCM4S itself please refer to the chapter Provide SAP AccountInformation. For more information on how to configure the auto logon in Teamcenter Product CostManagement please refer to the official product documentation.

Like for the manual logon the center of the logon mechanism is a unique logon token that is stored inTeamcenter Product Cost Management and Teamcenter Product Cost Management Gateway for SAP S/4HANA for the length of a user session (= open Teamcenter Product Cost Management instance on aclient). The auto logon does self understanding not have a dialogue in Teamcenter Product CostManagement that asks for the SAP system and credentials to establish a connection. This informationhas to be stored in the tcpcm4s_mapping_config.sd as described in Provide SAP Account Information.At least the information of the system that is configured in the TCPCM4S Adapter config must be stored

Caution:

At least the information of the system that is configured in the TCPCM4S Adapter config must bestored in the tcpcm4s_mapping_config.sd. Otherwise neither the calculation structure import, northe calculation structure import will work.

3. SAP Authentication Concept

3-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 17: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

4. Calculation Structure Preview

Technical Concept TCPCM4S Calculation Structure Preview

The following picture describes the technical concept of the calculation structure preview on a highlevel:

Caution:

For the preview of the calculation structure there is no import configuration layer in TeamcenterProduct Cost Management as it is for the calculation structure import or the masterdata sync. Theconsequence of this is, that the attribute names are shown in the Teamcenter Product CostManagement as they come in the payload. Therefore be very careful how you name yourattributes in the JSON payload response that is sent to Teamcenter Product Cost Management.

Calculation Structure Preview Mapping File

When the mapping logic for the calculation structure preview gets triggered, there are the functions inthe custom mapping that will be called by the core in a certain order:

Configuration Guide 4-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 18: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

The getCalculationsForImport function implements the logic to get a list of available calculationsfor the given material number / plant combination and determines which of those calculations should beused for import. Customer specific subfunctions might be called from here in order to structure the codebetter:

proc getCalculationsForImport {MaterialNumber PlantNumber} { # Implement your logic here return $Status (OK|ERROR)}

The getPCMStructureInputDict function is just used to return the structure input dict to thecustomer. This gives the implementation consultant the freedom to name the dict of the structure as hepleases.

proc getPCMStructureInputDict {} {

# Implement your logic here

return $TCPCMInputDict}

Structure of the Input Dictionary for the Calculation StructurePreview Usecase

The JSON payload of the webservice response that contains the preview information of the calculationstructure is based on the structure of the TCL dictionary that is returned by the functiongetPCMStructureInputDict (for futher reference about the function calls of the calculationstructure import mapping please refer to the chapter Calculation Structure Preview Mapping File).The following picture illustrates how the dictionary needs to be structured, so that TCPCM4S is able tocreate the response payload:

4. Calculation Structure Preview

4-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 19: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Caution:

Teamcenter Product Cost Management can only display a flat list of attributes. Therefore adictionary structure with an index higher than one is not supported!

Structure of the Input Dictionary for the Calculation Structure Preview Usecase

Configuration Guide 4-3© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 20: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

4. Calculation Structure Preview

4-4 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 21: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

5. Calculation Structure Import

Technical Concept TCPCM4S Calculation Structure Import

The following picture describes the technical concept of the calculation structure import on a high level:

It is important to know that there are also mapping capabilities in the import configuration layer on theTeamcenter Product Cost Management side. The following picture shows the import configurationconcept for TCPCM4S. In general it is recommeded to place as many mappings and business logic in theTCPCM4S mapping files. But it has proven to be very handy to leverage the import configuration layer inTeamcenter Product Cost Management for the definition of default values and for the mapping fromabstract payload values to Teamcenter Product Cost Management internal types. The illustration belowshows the Teamcenter Product Cost Management import configuration layer more in detail:

Configuration Guide 5-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 22: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

The following screenshot shows an example configuration of the the adapter configuration inTeamcenter Product Cost Management:

The following screenshot shows an example Teamcenter Product Cost Management importconfiguration for the a structure import:

5. Calculation Structure Import

5-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 23: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

For detailed information on how to configure the adapter config and an import configuration inTeamcenter Product Cost Management, please refer to the official Teamcenter Product CostManagement documentation.

Teamcenter Product Cost Management Gateway for SAP S/4HANACalculation Structure Import Mapping File

When the mapping logic for the calculation structure import gets triggered, there are the functions inthe custom mapping that will be called by the core in a certain order:

Teamcenter Product Cost Management Gateway for SAP S/4HANA Calculation Structure Import Mapping File

Configuration Guide 5-3© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 24: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

The getCalculationsForImport function implements the logic to get a list of available calculationsfor the given material number / plant combination and determines which of those calculations should beused for import. Customer specific subfunctions might be called from here in order to structure the codebetter:

proc getCalculationsForImport {MaterialNumber PlantNumber} { # Implement your logic here return $Status (OK|ERROR)}

The iterateCalculationStructure function implements the logic that reads the calculationexplosion that is supposed to be imported. It iterates through the structure and fills a dictionary that willbe the base for the payload creation. Customer specific subfunctions might be called from here in orderto structure the code better.

proc iterateCalculationStructure {SapDatIndexPar…} { # Implement your logic here

return $Status (OK|ERROR)}

The getPCMStructureInputDict function is just used to return the structure input dict to thecustomer. This gives the implementation consultant the freedom to name the dict of the structure as hepleases.

proc getPCMStructureInputDict {} {

# Implement your logic here

return $TCPCMInputDict}

5. Calculation Structure Import

5-4 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 25: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Structure of the Input Dictionary for the Calculation StructureImport Usecase

The JSON payload of the webservice response that contains the calculation structure is based on thestructure of the TCL dictionary that is returned by the function getPCMStructureInputDict (forfuther reference about the function calls of the calculation structure import mapping please refer to thechapter Teamcenter Product Cost Management Gateway for SAP S/4HANA Calculation StructureImport Mapping File). The following picture illustrates how the dictionary needs to be structured, sothat TCPCM4S is able to create the response payload:

Structure of the Input Dictionary for the Calculation Structure Import Usecase

Configuration Guide 5-5© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 26: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

5. Calculation Structure Import

5-6 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 27: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

6. Masterdata Synchronisation

Technical Concept Teamcenter Product Cost Management Gatewayfor SAP S/4HANA Masterdata Synchronisation

Technical Concept TCPCM4S Masterdata Synchronisation for Generic Objects

The following picture describes the technical concept of the calculation structure import on a high level:

It is important to know that there are also mapping capabilities in the import configuration layer on theTeamcenter Product Cost Management side. The following picture shows the import configurationconcept for TCPCM4S. In general it is recommeded to place as many mappings and business logic in theTCPCM4S mapping files. But it has proven to be very handy to leverage the import configuration layer inTeamcenter Product Cost Management for the definition of default values and for the mapping fromabstract payload values to Teamcenter Product Cost Management internal types. In contrast to theCalculation Structure Usecase there is no TCPCM4S Adapter Configuration Layer, due to the fact that theendpoint connection is managed in the <GS_ROOT>\var\mmap\tcpcm4s_mapping_config.sd (see TheFile tcpcm4s_mapping_config). The file <GS_ROOT>\var\mmap\tcpcm4s_mapping_config.sd is alsothe place where the GUID of the Teamcenter Product Cost Management Import Config is defined for theMaterial Header, Material Revision, Material Detail. The illustration below shows the Teamcenter ProductCost Management import configuration layer more in detail:

Configuration Guide 6-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 28: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Technical Concept TCPCM4S Intelligent Material Masterdata Synchronisation

The following picture describes the technical concept of the calculation structure import on a high level:

Due to the fact that the Material Masterdata can reach a very high volume and considering further thatonly a few changes in this area are relavant for costing there is a slightly different approach for thesynchronization of Material Masterdata in comaprison the approach for the other masterdata objects(see Technical Concept TCPCM4S Masterdata Synchronisation for Generic Objects). Instead ofquerying all material masters TCPCM4S will just query the corresponding material masters that arewritten in the ZPTC table. How the material master entries for the ZPTC table are marked as relevant forthe material masterdata sync needs to be defined by the solution architect (for more information on

6. Masterdata Synchronisation

6-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 29: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

how to work with the ZPTC Table search for the term "ZPTC" in the documentation). Which changes arerelevant for costing can be different from customer to customer.

Caution:

A BAPI that fills the ZPTC table with entries of Material Numbers that had relevant changes is notpart of the TCPCM4S delivery. Such a BAPI needs to be provided by the customer!

It is important to know that there are also mapping capabilities in the import configuration layer on theTeamcenter Product Cost Management side. The following picture shows the import configurationconcept for TCPCM4S. In general it is recommeded to place as many mappings and business logic in theTCPCM4S mapping files. But it has proven to be very handy to leverage the import configuration layer inTeamcenter Product Cost Management for the definition of default values and for the mapping fromabstract payload values to Teamcenter Product Cost Management internal types. In contrast to theCalculation Structure Usecase there is no TCPCM4S Adapter Configuration Layer, due to the fact that theendpoint connection is managed in the <GS_ROOT>\var\mmap\tcpcm4s_mapping_config.sd (see TheFile tcpcm4s_mapping_config). The file <GS_ROOT>\var\mmap\tcpcm4s_mapping_config.sd is alsothe place where the GUID of the Teamcenter Product Cost Management Import Config is defined foreach object type that might be synced. The illustration below shows the Teamcenter Product CostManagement import configuration layer more in detail:

Teamcenter Product Cost Management Gateway for SAP S/4HANA -Masterdata Synchronisation Trigger Script

The script that is used to trigger the masterdata sync can be found under <GS_ROOT>\var\test\Tools\tcpcm4s_trigger_masterdata_sync.tcl. It follows the concept of asynchronous triggers. To install such apolling mechanism, configure the Task Management in the TCPCM4S Admin Tool (see the online help ofthe Admin UI chapter "Task Management" for details). In this case you have to switch off the schedulingmechanism of the trigger script by setting paramter "Mode" to value "single". In addition to the synced

Teamcenter Product Cost Management Gateway for SAP S/4HANA - Masterdata Synchronisation Trigger Script

Configuration Guide 6-3© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 30: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

runs it is possible to trigger the script out of the TCPCM4S administration user interface manually at anytime.

The script itself has flags that can be set to determine the scope of the masterdata sync. For example ifyou only want to sync costcenters and workcenters during a specific run, you should only set the flagsfor those object types to true, while the flags for the other object types remain on false.

In case there is the need to select the objects to be synced by a customer specific logic, or if there is acustomer specific rule that can reduce the amount of data that needs to be synced the masterdata synctemplate can be modified accordingly.

Teamcenter Product Cost Management Gateway for SAP S/4HANAMasterdata Synchronisation Mapping File

When the mapping logic for the calculation structure import gets triggered, there is only one function inthe template of the import mapping for each specific object type to be synced that will be called by thecore: Map<SyncObject>MasterData. The term <SyncObject> needs to be replaced with the syncobject type.

namespace eval ::TCPCM4S::PCM::<Sync Job Object Type>::CUSTOM {

proc Map<SyncObject>MasterData {} { …

6. Masterdata Synchronisation

6-4 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 31: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

return $Status (OK|ERROR and Input Dictionary) }

}

The following list maps the possible sync object types to namespaces and the corresponding keywords:

• Object type: Material Master

• Keyword: MaterialMaster

• Namespace for custom mapping: ::TCPCM4S::PCM::MM_IMPORT::CUSTOM

• Name of the mapping functions called by the core: MapMaterialMasterHeaderData,MapMaterialMasterRevisionData, MapMaterialMasterDetailData

Caution:

The material import is an exeption and has three funtions that get called in the order describedabove (all other imports only have one). But the concept is for all functions that get called bythe core for all object types the same. They all return a status and an input dictionary. Thereason for the exception for the material import is the Teamcenter Product Cost Managementdatamodel. For more information please refer to the official Teamcenter Product CostManagement documentation.

• Object type: Plant

• Keyword: Plant

• Namespace for custom mapping: ::TCPCM4S::PCM::PLANT_IMPORT::CUSTOM

• Name of the mapping function called by the core: MapPlantMasterData

• Object type: Workcenter

• Keyword: Workcenter

• Namespace for custom mapping: ::TCPCM4S::PCM::WORKCENTER_IMPORT::CUSTOM

• Name of the mapping function called by the core: MapWorkcenterMasterData

• Object type: Costcenter

• Keyword: Costcenter

• Namespace for custom mapping: ::TCPCM4S::PCM::COSTCENTER_IMPORT::CUSTOM

Teamcenter Product Cost Management Gateway for SAP S/4HANA Masterdata Synchronisation Mapping File

Configuration Guide 6-5© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 32: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

• Name of the mapping function called by the core: MapCostcenterMasterData

• Object type: Activity Types

• Keyword: ActivityTypes

• Namespace for custom mapping: ::TCPCM4S::PCM::ACTIVITY_TYPES_IMPORT::CUSTOM

• Name of the mapping function called by the core: MapActivityTypesMasterData

• Object type: Activity Rates

• Keyword: ActivityRates

• Namespace for custom mapping: ::TCPCM4S::PCM::ACTIVITY_RATES_IMPORT::CUSTOM

• Name of the mapping function called by the core: MapActivityRatesMasterData

Mapping templates for the specific sync object types can be found under <GS_ROOT>\var\mmap\.

Structure of the Input Dictionary for the MasterdataSynchronization Usecase

The XML payload of the webservice response that contains the calculation structure is based on thestructure of the TCL dictionary that is returned as second parameter by the functionMap<SyncObject>MasterData (for futher reference about the function call of the masterdata syncmapping please refer to the chapter Teamcenter Product Cost Management Gateway for SAP S/4HANA Masterdata Synchronisation Mapping File). The following picture illustrates how thedictionary needs to be structured, so that TCPCM4S is able to create the response payload:

6. Masterdata Synchronisation

6-6 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 33: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

The payload attributes need to match the attributes in the Teamcenter Product Cost Managementimport configuration. Structure pays respect to the fact that Teamcenter Product Cost Managementcould potentially handle multiple data tables for the same object type in one request. For the mostimplemention it should be enough to work with only one table index (Table Index = 1).

Structure of the Input Dictionary for the Masterdata Synchronization Usecase

Configuration Guide 6-7© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 34: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

6. Masterdata Synchronisation

6-8 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 35: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

7. Cross functional SAP Configuration

Useful SAP Key Shortcuts

Working in SAP GUI can be accelerated by the usage of shortcuts:

• F1: context sensitive help

• F3: Back

• Shift-F3: Exit

• F4: Open selection "Possible entries" (see screenshot)

• F7: Display

• F8: same as the "Execute" button where available

• F12: Cancel current operation

Note that you may configure the way SAP behaves when you press F4 from the main menu. Select Help– Settings – F4 Help.

Using a Custom BAPI for a Standard Transaction

AIG uses mostly standard SAP BAPIs for all the transactions. E.g. BAPI_MATERIAL_SAVEDATA to createand update Material Masters.

In order to tell AIG which BAPI you want to replace you can leverage themethod ::TPSAP::setSapFunctionName in your mapping. The function can not only define which

Configuration Guide 7-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 36: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

standard BAPI should be replaced, it can also restrict the replacement only to a specific SAP system.Therefore it has the following parameters:

1. State the name of the standard BAPI, e.g. BAPI_MATERIAL_SAVEDATA.

2. State the name of the function to be used instead of the default one, e.g. My_MM_BAPI.

3. (optional) State the SAP system that you want to do the replacement for.

The following example shows how to replace BAPI_MATERIAL_SAVEDATA with My_MM_BAPI:

::TPSAP::setSapFunctionName BAPI_MATERIAL_SAVEDATA My_MM_BAPI

The next example shows how to replace BAPI_MATERIAL_SAVEDATA with My_MM_BAPI only for aspecific SAP system (ET5):

::TPSAP::setSapFunctionName BAPI_MATERIAL_SAVEDATA My_MM_BAPI ET5

Caution:

The interface of the custom BAPI needs to be equivalent to the one of the standard BAPI.

Technical Name of SAP GUI Fields

To display the name of a field in the SAP GUI, perform the following steps within a SAP GUI window:

• Click into the desired field.

• Press F1 (Help).

• Click the button Technical Information (may be a text field or an icon with hammer and wrench).

• A new window will open.

• The "Screen field" there shows the internal field name.

• To see how this field is formatted (string length, number format…), double click "Data Element" in thesection "Field data".

• Another window will open.

• Open the tab "Definition" and see the section "Data Type" there.

7. Cross functional SAP Configuration

7-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 37: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

The format in which you have to transfer the data may be language dependent (especially "date", e.g."17.06.2005" or "06/17/2005") but this is not shown here.

• The data type "DATS" is a "char 8" field. To transfer such a date, you have to transfer it as "YYYYMMDD"([binary -format [clock seconds] %Y%m%d]).

• The date type "DATE" is "char 10" pass "[binary -format [clock seconds] %d.%m.%Y].

• Both of them "DATS" and "DATE" are shown in the same way in SAP (e.g. "12.05.2006" with GermanSAP date settings) and may be cleared with the TCL formatted string [string repeat "0" 10]x.

If you click on "Field Name" instead of "Data Element", SAP will show the database table as known fromthe transaction SE11 ("Dictionary: Display View"). This table additionally shows the field length, e.g.length 13 and 3 decimals for the type QUAN which is used for a BOM component quantity.

Read SAP Table

can read the contents of a SAP table in the database with thefunction ::TPSAP::MISCELLANEOUS::RfcReadTable.

Parameters:

• ::SAPDat(ReadTable:PARAMETER:QUERY_TABLE)The table name.

• ::SAPDat(ReadTable:PARAMETER:DELIMITER)Separator for the data in the output result string.

• ::SAPDat(ReadTable:PARAMETER:NO_DATA)If not left empty only table field information is returned but no data.

• ::SAPDat(ReadTable:OPTIONS:TEXT:*)Search parameters in Open SQL (>; <; <>; =; like...)

• ::SAPDat(ReadTable:FIELDS:FIELDNAME:*)You have to specify the columns from the table that shall be in the output of the function.

Mapping Example:

# Set parametersset ::SAPDat(ReadTable:PARAMETER:QUERY_TABLE) /TESISPLM/ZPTCset ::SAPDat(ReadTable:PARAMETER:DELIMITER) ;set ::SAPDat(ReadTable:PARAMETER:NO_DATA) ""# Filter (optional, can be empty)set ::SAPDat(ReadTable:OPTIONS:TEXT:1) "ID >= '10'"

Read SAP Table

Configuration Guide 7-3© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 38: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

set ::SAPDat(ReadTable:OPTIONS:TEXT:2) "and OBJECT_TYP = 'MATERIAL'" set ::SAPDat(ReadTable:OPTIONS:TEXT:3) "and OBJECT_ID like '%24728'"# define output columnsset ::SAPDat(ReadTable:FIELDS:FIELDNAME:1) IDset ::SAPDat(ReadTable:FIELDS:FIELDNAME:2) OBJECT_ID# function call and resultset rc [::TPSAP::MISCELLANEOUS::RfcReadTable]puts "::TPSAP::MISCELLANEOUS::RfcReadTable finished with >$rc<"foreach elem [lsort -dictionary [array names ::MiscResultDat]] { puts "::MiscResultDat($elem) = $::MiscResultDat($elem)"}

The result is stored in the array ::MiscResultDat. The output of your search in DATA:WA:* and thedescription of the tables columns in FIELDS:*.

The output string in ::MiscResultDat(DATA:WA:*) contains only the fields selectedin ::SAPDat(ReadTable:FIELDS:FIELDNAME:*) by numerical order, separated by the chosendelimiter:

::TPSAP::MISCELLANEOUS::RfcReadTable finished with >OK<::MiscResultDat(DATA:WA:1) = 6743 ;000000000000024728::MiscResultDat(FIELDS:FIELDNAME:1) = ID::MiscResultDat(FIELDS:FIELDNAME:2) = OBJECT_ID::MiscResultDat(FIELDS:FIELDTEXT:1) = Natural Number::MiscResultDat(FIELDS:FIELDTEXT:2) = Char 80::MiscResultDat(FIELDS:LENGTH:1) = 000010::MiscResultDat(FIELDS:LENGTH:2) = 000080::MiscResultDat(FIELDS:OFFSET:1) = 000000::MiscResultDat(FIELDS:OFFSET:2) = 000011::MiscResultDat(FIELDS:TYPE:1) = I::MiscResultDat(FIELDS:TYPE:2) = C

Installed SAP Languages

This is applicable to every SAP data object; it may be important if you try and set a language specific SAPfield by . SAP will only process the data correctly if the language is shown as available in SAP:

• Log in to SAP

• Start transaction SMLT (Language Management)

• To obtain the valid language code for a language, see the list you get when setting a languagespecific field directly in SAP

7. Cross functional SAP Configuration

7-4 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 39: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

You can also try and login to the SAP system with any language code. If the corresponding language isnot installed, SAP will refuse the access with the message "Please enter one of the installed languages.Unfortunately, not every SAP system provides the list of valid language codes here.

Caution:

When you modify a language specific field (e.g. the "Material Description") and click on the buttonto select the language for your entry, you might get a list with more languages. This does notmean that SAP accepts data in all these languages by an interface!

Get SAP Connection Data

Use the function call ::T4X::CONNECTION2EA::testEALogin T4S to check your SAP connection. Itwill return OK if the connection is fine.

As allows using several SAP systems it might be useful to check which SAP system is connected in atransaction. The function ::TPSAP::RfcGetAttributes sets the following variables.

• ::TPSAP::RfcAttributes(DEST)SAP target system

• ::TPSAP::RfcAttributes(SYSID)SAP system ID

• ::TPSAP::RfcAttributes(CLIENT)SAP Client

• ::TPSAP::RfcAttributes(KERNEL_REL)SAP Version

Get SAP Connection Data

Configuration Guide 7-5© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 40: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Caution:

These values are only updated if the function is called, so call it every time before you use thesevariables.

Correct Number and Date Format

SAP may reject a transaction that contains data in a format that is not expected (mainly for date anddecimal numbers).

Using SAP GUI

Look up the data format that SAP expects as follows:

• Log in to the SAP system

• Type transaction code SU01 for User Maintenance.

• Type the appropriate user ID (the SAP user that will be called by ).

• Click on the button with the glasses symbol ("Display").

• Click on the tab "Defaults"

You should see something like the following:

The mapping needs to be set up such that SAP receives the data in the format shown for the specific SAPsystem.

7. Cross functional SAP Configuration

7-6 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 41: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Using a Mapping Function

The function ::TPSAP::getSystemInfo retrieves data about the settings of the currently connecteduser:

• User Name$::TPSAP::SystemInfo(USER_NAME)

• Decimal Sign$::TPSAP::SystemInfo(DECIMAL_SIGN)You can also use ::TPSAP::getDecimalSigns.

• Login Language$::TPSAP::SystemInfo(LANGUAGE)You can also use ::TPSAP::getLoginLanguage and ::TPSAP::getLoginLanguageISO.

• Date Format$::TPSAP::SystemInfo(DATE_FORMAT)You can also use the functions ::TPSAP::getExternDateString for external data formatand ::TPSAP::getInternDateString for the internal data format.

• SAP System Release Information$::TPSAP::SystemInfo(SAP_SYSTEM_RELEASE)You can also use ::TPSAP::getReleaseInfo.

Check if an Object is Locked in SAP

In most cases, the reason for a locked SAP object is that it is being processed. So SAP prevents any othermodification on the same object by putting a lock on it. To check such a lock, use the SAP transactionSM12 "Select Lock Entries". The following screenshot shows it with a lock on the DIR:

In case of a DIR the "Lock Argument" is<SAP_client><DIR_type><internal_DIR_ID><internal_DIR_ID><DIR_part><DIR_version>.

In order to check such lock, use the test script "SAP get ENQUEUE data" (sap_get_enqueuedata.tcl)which needs two parameters:

Check if an Object is Locked in SAP

Configuration Guide 7-7© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 42: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

• Object IDThis is the SAP internal object identifier, so in most cases not just the SAP Object ID itself but acombination of the SAP client, the Object ID and may more data, see below

• Object TableThis is the SAP internal Object Table name, e.g. MARA for MM, DRAW for DIR

In order to find the lock on that DIR using the test script, you have to enter the table name "DRAW" andexactly the same string shown here in the script parameter "Object ID", see screenshot below. So whentrying to check locks on other object types, it is helpful to check the correct parameter format for the"Lock Argument" directly in SAP using that transaction SM12:

Caution:

With an incorrect "object ID" (from SAP perspective the "lock argument"), SAP will not answersomething like "object not found" but just return no lock information, so the script result is "Objectis not locked!" So be sure to check that parameter accurately.

Call Custom SAP BAPI

In some cases a business use case requires functionality that is not provided out of the box by . If there isa standard or customer provided BAPI function in SAP that provides the required capability, it can beused by to close this gap.

There is a special test script that will generate the code example to execute this function. This examplecan then be tailored with less effort to the customer needs. To generate the code, select the test scriptcreate_code4genericSAP_call.tcl (Generate code in order to call a generic SAP function).

In the field "SAP Function" you can enter the full name of the BAPI that needs to be called. You also needto select a "Pattern" for the input array (the name can be selected freely). Optionally you also can definethe name of the generated file (do not enter a full path):

7. Cross functional SAP Configuration

7-8 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 43: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Caution:

Make sure that your SAP user has the access rights to call the BAPI.

After the script has been executed, you will find the generated file in <GS_ROOT>\tmp\.

Depending on your BAPI function, the generated code will include init functions (e.g.init__TESISPLM_ZPTC_INSERT_PARAMETER) and the main function that will prepare the BAPI call(e.g. call_TESISPLM_ZPTC_INSERT). The BAPI itself is called by the standardfunction ::TPSAP::performSapCall with the generated input parameters.

Basics on SAP Long Text

By default, SAP only allows up to 132 characters per line in a long text. If you transfer a longer line, itwill be cut. The line index you set in the mapping has to be contiguous and ascending, even if youtransfer a text in different languages.

When setting several lines in more than one language, then all the indexes for the same language mustbe set contiguously (else SAP will not store all of them).

The index used in the mapping line is not necessarily the line number you will find in SAP.

Depending on the SAP configuration if a Long Text is set, the first line of one language is what SAP willshow as "Description" in the same language.

In some cases, SAP will not provide an error message if a requirement for setting a long text is notfulfilled. For example if the SAP MM "Sales View" is not activated, SAP will not store the "Sales text" butthe transfer will be successful.

Basics about SAP Object Links

SAP allows linking different objects together, so you can access the one object directly from the otherobject without having to know its ID. In most cases, SAP only allows the link creation from a DIR. But youmay access the DIR from the linked object as well.

Depending on the SAP configuration, the link creation to an object that does not exist is maybe notallowed (SAP gives an error message and the link is not created). If it is allowed and the target object iscreated afterward, the link will be shown.

Ask SAP GUI for Type Abbreviations

In order to find the abbreviations SAP expects from T4S or T4S4 (e.g. the "Material type"), you canconfigure the SAP GUI to show:

Basics on SAP Long Text

Configuration Guide 7-9© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 44: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

• In the SAP GUI (no active transaction, "SAP easy access"), click the icon "Customize Local Layout" (seered arrow in the following screenshot) or press ALT-F12:

• Select "Options" (in older SAP GUI versions there was tab "Expert" to be activated)

• Open "Interaction Design" and select "Visualization 1"

• Activate the check box "Show Keys within drop-down lists".

• Then you will find the whole expression and the abbreviation, e.g. "FERT Finished Product" instead ofonly "Finished Product" for the material type.

Call Transaction

If there is no standard function or BAPI, the transaction can be called directly. The methodology is nottrivial and depending on the complexity it can be quite impossible to implement for your use-case.

Specific Configuration in SAP

Those functions call special SAP functions (not standard SAP) which are provided with the transportpackages:

<GS_ROOT>/var/template/sap/TransportPackages/TESISPLM_T4S_CALL_TRANSACTION.zip

It contains the following SAP function module that can be used by :

/TESISPLM/T4S_CALL_TRANSACTION

After the corresponding SAP function module is implemented, make sure your SAP user is allowed to useit. There are more functions included in that transport package. Please read the file <GS_ROOT>/var/template/sap/TransportPackages/readme.txt for more information.

7. Cross functional SAP Configuration

7-10 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 45: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Follow this list to create a recording in SAP. As an example we call the transaction "Create Customer"(Transaction code XD01):

• Open SAP GUI

• Click on "System" > "Batch Input" > "Recorder"

• Click on "New recording"

• Name your recording

• Type in the code of the transaction you want to call

• Click on "Start recording"

Call Transaction

Configuration Guide 7-11© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 46: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Now you will enter the Transaction. Type in the data you want to maintain.

7. Cross functional SAP Configuration

7-12 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 47: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Caution:

If you get an error or warning during the process you will need to restart from the beginning.Prepare ahead, what you want to do and what you need to enter.

When you exit the transaction, the result should look similar to this:

Call Transaction

Configuration Guide 7-13© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 48: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Configuration

The recording will be the input for your Mapping.

The first parameter you need to set is the transaction code.

7. Cross functional SAP Configuration

7-14 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 49: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

# Set transaction code for callset TCode "XD01"

Then you have to define the input array for the function call. Create a separate block of code for eachscreen (PROGRAMDYNPRODYNBEGIN). Then add the data for each field name (FNAM) and field value(FVAL). Repeat this for all programs and fields. You may want to replace the values with variables.

You can find the example in the file <GS_ROOT>/var/template/capabilities/T4S/t4s_crossfunctional_mapping_doc.sd under "Call Transaction".

Call Transaction

Configuration Guide 7-15© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 50: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

7. Cross functional SAP Configuration

7-16 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 51: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

A. Glossary

A

ABAPABAP is a proprietary programming language of the SAP AG.

Adminis the term used in this document for people who install and configure Teamcenter and its components.This is in contrast to the "user" role.

Admin UIWeb based administrative user interface of the GS and BGS.

AIGThe entire Active Integration Gateway product family.

AIG_ROOTPlease see GS_ROOT and BGS_ROOT. This term is used if something is true for both the GS and BGS.

AI-ObjectApplication-Interface Object

APIApplication Programming Interface.

AppsSee "GS".

AppServerApplication Server.

B

BAPIThe Business Application Programming Interface allows external programs to access objects andbusiness processes in SAP.

BGSBasic Gateway Service.

Configuration Guide A-1© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 52: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

BGS_ROOTThe installation directory of the Basic Gateway Service (e.g. C:\Siemens\BGS).

BMIDETeamcenter Business Modeler IDE (Integrated Development Environment)

BOMA Bill Of Materials is a list of the parts or components and their quantities that are required to build aproduct.

BOM HeaderA BOM Header is the top item of a BOM. BOMs can have multiple levels, so this often means the topitem of the actual level.

BOPThe Bill Of Process describes a manufacturing process and lists the operations and steps with all theirinstructions, consumed materials, resources, work places and machines.

C

CCObjectCollaboration Context Object

CEPCamstar Enterprise Platform

Change MasterThe Engineering Change Master (ECM) contains the metadata to a change number.

CharacteristicAn characteristic is an attribute of a SAP class.

CIOCamstar Interoperability

CLM4SClosed Loop Manufacturing for SAP S/4HANA®

D

Data CarrierPlease see Vault.

A. Glossary

A-2 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 53: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

DataviewThe Dataview is an extension to the Teamcenter RAC and is deployed as part of the TEM installationprocess of the Teamcenter Gateway. The Dataview is used to display the real-time data of externalapplications, associated with Teamcenter objects.

Dataview mark-upis the language understood by the Dataview. The Dataview receives messages written in this languagefrom the T4x server. Such messages can be formatted as XML or JSON. Normally users do not see suchmessages. They may however appear in log files or error messages. The so called prop mapping (e.g.t4s_prop_mapping_template.sd) contains TCL commands that compose messages in the Dataviewmark-up.

DCDData Collection Definition

DIRDIR is the abbreviation for a SAP Document Info Record.

Document KeyA Document Info Record is identified by the combination of Document Type, Document Number,Document Part and Document Version.

Document StructureA Document Structure is like a Bill Of Materials for Documents.

E

EAstands for Enterprise Application, any software or set of computer programs used by business users toperform various business functions in context of current integration's portfolio with Teamcenter.

ECNThe Engineering Change Notice can also be called an Engineering Change Note, Engineering ChangeOrder (ECO), or just an Engineering Change (EC).

EPMEnterprise Process Modeling

EWIElectronic Work Instructions

Configuration Guide A-3© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 54: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

F

File StreamMethod of transfer to send an original to SAP.

G

Gateway MenuAn additional menu item of the Teamcenter Gateway software available in the Teamcenter RAC.

GRMThe Generic Relationship Management provides a general way in which two objects can be associatedvia a relationship.

GSGateway Service, manages the communication between Enterprise Applications.

GS_ROOTThe installation directory of the Gateway Service (e.g. C:\Siemens\GS).

GUIGraphical user interface.

GUIDGlobally Unique Identifier

I

IDGENThe IDGEN is a mechanism to get an external ID from the ERP system when assigning a Teamcenter ID.

Inspection PlanContains characteristics to be inspected in an operation and equipment to be used.

iPPEIntegrated Product and Process Engineering is a module that can be used to mange products with manyvariants.

ITKThe Integration Toolkit (ITK) is a set of software tools provided by Siemens PLM Software that you canuse to integrate third-party or user-developed applications with Teamcenter.

A. Glossary

A-4 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 55: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

J

JCOThe Java Connector is an interface to . In the context of it is now mostly replaced by the Netweaver RFCinterface.

JDBCJava Database Connectivity is an application programming interface (API) for the programming languageJava, which defines how a client may access a database.

JobTeamcenter Gateway features asynchronous transfer. This datatransfer is managed via a Job.

Job PoolThe Job Pool contains all finished and unprocessed Jobs. It is managed by the BGS.

Job ServerThe Job Server on the Basic Gateway Service (BGS) manages the Job and distribution them to the JobAgent for processing.

JSONJavaScript Object Notation is a lightweight data-interchange format1.

K

KProKpro stands for Knowledge Provider. See also Data Carrier.

L

LOVList of Values

M

MappingThe mapping is part of the T4x configuration. It contains the code that controls the behavior of the datatransfer between Teamcenter and the ERP system.

1 JSON.org

Configuration Guide A-5© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 56: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

MFKMulti-key functionality in Teamcenter.

MMMM is the abbreviation for a SAP Material Master.

MOMManufacturing Operations Management

N

NCNNon-Conformance Notification

NetWeaver RFC SDKThe NetWeaver RFC SDK contains libraries for 3rd party applications to connect to . It can be obtainedfrom the SAP ONE Support Launchpad.

O

Object KeyThe Object Key is a string that contains the ID of an Enterprise Application object. If the identifier is acombination of multiple keys, then the Object Key is a combination of those keys in a defined order andformat.

Object LinkA relation between SAP objects like Material Master and Document Info Record.

Object Management RecordBelongs to a SAP Change Number and Documents changes of one particular SAP object like a MaterialMaster.

OOTBOut of the box

OriginalA representation of a file in SAP.

OSS NoteThe OSS Note is an online patch service for SAP. The patch can be identified by the OSS Notes number.

A. Glossary

A-6 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 57: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

P

PIRPIR is an abbreviation for a SAP Purchase Info Record.

Portal TransactionThis means that a transfer to SAP that is not triggered by a workflow handler but via the Gateway Menu.

R

RACstands for Rich Application Client also referred to as rich client or portal.

Revision LevelUsed to show changes with reference to a change to a SAP Material Master or Document Info Record.

RFCRemote Function Call (SAP)

S

SAPSAP S/4HANA® / SAP Business Suite®

SAP GUIThis is the application for the SAP Business Suite® and SAP S/4HANA®.

SAP LogonThis is the application that a user needs to start the SAP GUI for a particular system. It may also refer tothe process of logging in to SAP in Teamcenter via .

SAP Portal iView URLCan be used to show sap content in a browser window.

Session LogShows one log file for each Teamcenter session. Written if T4x transactions are executed

SSLSecure Sockets Layer.

Configuration Guide A-7© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 58: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

T

T4O_ROOTPlease see GS_ROOT

T4S 4-Tier Client (SAP Lite)The 4-Tier Client or SAP Lite is a stripped down GS. It´s only purpose is to open the SAP GUI on aTeamcenter 4-Tier Client.

T4xThe entire Teamcenter Gateway product family.

TAOThe ACE ORB is a open-source and standards-compliant real-time C++ implementation of CORBA basedupon the Adaptive Communication Environment (ACE).

TargetTypeNameThis is the T4x internal name for the transaction type. E.g. MaterialMaster orDocumentInfoRecord.

TCTeamcenter

TCLis a high-level, general-purpose, interpreted, dynamic programming language.

TCPCMTeamcenter Product Cost Management

TCPCM4STeamcenter Product Cost Management Gateway for SAP S/4HANA

TEMTeamcenter Environment Manager

Transaction CodeA Transaction Code is a quick access code for a Transaction in the SAP GUI:

A. Glossary

A-8 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 59: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Transaction LogThe Transaction Log is a T4x logfile on the BGS. It contains log information for a specific T4x transaction.

Transfer WindowThe Transfer Window triggers transactions via the Gateway Menu.

Transport PackageA file that contains functions that can be imported to SAP.

U

UOMUOM stands for Unit of Measure.

URIUnified Resource Identifier: a generalized from of a resource locator (URL) and resource name (URN),which just identifies a resource, but is not necessarily sufficient to locate (find) the resource. URIs areoften used to identify configurations in Java and other languages. See https://en.wikipedia.org/wiki/Uniform_Resource_Identifier for more details.

URLUnified Resource Locator: a string with a certain format, allowing to load a resource from a network.URLs are a specific form or URNs.

User Exit (SAP)A User Exit is a code for a program that is called if an object like an MaterialMaster has been changed orupdated. In the context of T4S it is often used to initiate the process to trigger a transfer from SAP toTeamcenter.

User LogThe User Log is a T4x logfile on the BGS. If you define a customized logchannel, the information iswritten into a User Log of that name.

V

Value SetA Value Set is the SAP term for a list of selectable values for a characteristic.

VaultThe Vault is a server where a SAP DocumentInfoRecord original is stored. A synonym is also Data Carrier.

Configuration Guide A-9© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 60: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

W

WBSWBS is an abbreviation for a SAP Work Breakdown Structure.

X

XMLExtensible Markup Language is designed to store and transport data in a format that is both human- andmachine-readable.

XRTstands for XML Rendering Template, also known as XML Rendering Stylesheet. These are XMLdocuments stored in datasets that define how parts of the Teamcenter user interface are rendered. Theyare used for the Rich Client as well as the Active Workspace.

Z

ZPTCThis is the short name for a Z-Table with the name /TESISPLM/ZPTC, used to trigger a transfer from SAP.

Z-Table"Z" is a well-known prefix name for custom tables in the SAP world. A special table used with is thetable /TESISPLM/ZPTC.

A. Glossary

A-10 Configuration Guide© 2019 Siemens Product Lifecycle Management Software, Inc.

Page 61: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually
Page 62: Teamcenter Product Cost Management Gateway for SAP S ... · Storing SAP logon information for Manual logon TCPCM4S Configuration Since all information about the logon is entered manually

Siemens Industry Software

HeadquartersGranite Park One5800 Granite ParkwaySuite 600Plano, TX 75024USA+1 972 987 3000

AmericasGranite Park One5800 Granite ParkwaySuite 600Plano, TX 75024USA+1 314 264 8499

EuropeStephenson HouseSir William Siemens SquareFrimley, CamberleySurrey, GU16 8QD+44 (0) 1276 413200

Asia-PacificSuites 4301-4302, 43/FAIA Kowloon Tower, Landmark East100 How Ming StreetKwun Tong, KowloonHong Kong+852 2230 3308

About Siemens PLM SoftwareSiemens PLM Software, a business unit ofthe Siemens Industry Automation Division,is a leading global provider of productlifecycle management (PLM) software andservices with 7 million licensed seats and71,000 customers worldwide.Headquartered in Plano, Texas, SiemensPLM Software works collaboratively withcompanies to deliver open solutions thathelp them turn more ideas into successfulproducts. For more information onSiemens PLM Software products andservices, visit www.siemens.com/plm.

© 2019 Siemens Product LifecycleManagement Software Inc. Siemens, theSiemens logo and SIMATIC IT are registeredtrademarks of Siemens AG. Camstar, D-Cubed, Femap, Fibersim, Geolus, I-deas, JT,NX, Omneo, Parasolid, Solid Edge,Syncrofit, Teamcenter and Tecnomatix aretrademarks or registered trademarks ofSiemens Product Lifecycle ManagementSoftware Inc. or its subsidiaries in theUnited States and in other countries. Allother trademarks, registered trademarks orservice marks belong to their respectiveholders.