# ## # #=================================================== # # \copyright 2014-2019 # # Siemens Product Lifecycle Management Software Inc. # # All Rights Reserved. # #=================================================== # # # # \brief T4S / Generic Object Mapping # # # # \file t4s_genobj_mapping_template.sd # # # # \note For the data exchange between Teamcenter and T4S the internal TCL dictionary \c ::TcData is used. # # It contains specific attributes of the Teamcenter object to be transferred # # and additional information about the current transaction. # # For the data exchange between T4S and SAP the internal TCL array \c ::SAPDat is used.\n # # Teamcenter attributes can be read from \c ::TcData with function \c ::T4X::TC::MAPPING::FieldMapping.\n # # Teamcenter attributes can be written to \c ::TcData with function \c ::T4X::TC::MAPPING::storeReverseMappingAttribute.\n # # # # \pre For the "Generic Object" transfer the following preferences are used: # # \li \c T4S_CTCTypeList : list of allowed Teamcenter object types # # \li \c T4S_CTCMapping4<ObjectType> : list of Teamcenter data types to read attributes from # # \li \c T4S_CTCMapping2<ObjectType> : list of Teamcenter data types to write back during reverse mapping # # \li \c T4S_CTCFieldMapping2<DataType> : list of Teamcenter attributes to write back during reverse mapping (optional) #=========================================================================== #Date Author Change History #06-June-2023 High Court Raja D NGD-1903 - Intital Creation #=========================================================================== namespace eval ::T4S::CTC::CUSTOM::MAPPING { namespace export TC_Object2SAP_Object namespace export SAP_Object2TC_Object namespace export getObjectInfo namespace export performSapTransfer namespace export callCustomerRuleHandler # --------------------------------------------------------------------- ## # Method: ::T4S::CTC::CUSTOM::MAPPING::TC_Object2SAP_Object # \brief Customer specific object mapping function template for CTC. # \param TransactionId unique ID for the transfer transaction # \param TargetTypeName specified transaction target type name # \param ItemType # \param ItemRevisionType # # \param args not used # # \return MappingStatus used by the following transfer function. # The following values are valid: # - OK T4S will continue with the next transfer step # - REVERSEMAPPINGONLY T4S will skip the transfer to SAP and will just do the reverse mapping # - SKIPPED T4S will skip the transfer to SAP # - ERROR T4S will stop transfer and raise an error # # proc TC_Object2SAP_Object { TransactionId TargetTypeName ItemType ItemRevisionType args } { # set ::errorCode "NONE" set ::errorInfo "" set Status "OK" set FunctionName "[lindex [info level 0] 0]" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "$FunctionName -> Starting SCC/CTC Creation process in SAP" # Preparing the input data for the RFC call for creating SCC/CTC in SAP tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "$FunctionName -> Prepare input data for SCC/CTC Creation in SAP" set Form "$ItemRevisionType" set Program "$Form:GY9_SAPRFCInpFormAttmntsRel:GY9ProductSKURevision:GY9HasProductMatrix:Prg0ProgramPlan" set Item "$Form:GY9_SAPRFCInpFormAttmntsRel:GY9ProductSKURevision:items_tag:GY9ProductSKU" set wftype [acGetWorkflowType] #tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTER"::T4S::CTC::CUSTOM::MAPPING::TC_Object2SAP_Object starts with ItemRev $ItemRev" if {($wftype == "NEW")} { set ::SAPDat(PPM:XYCSCCHDR_01:DOCTYPE) "01" ; # Document Type } elseif {($wftype == "UPDATE")} { set ::SAPDat(PPM:XYCSCCHDR_01:DOCTYPE) "02" ; # Document Type } set Dict [dict create] dict set NetworkDict "APAC" "FPR" dict set NetworkDict "EMEA" "FPR" dict set NetworkDict "LA" "FPR" dict set NetworkDict "NA" "FPR" puts "NetworkDict >$NetworkDict<" set OwningBusinessRegion [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9OwningBusinessRegion"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "OwningBusinessRegion is $OwningBusinessRegion" foreach NetworkDictKey [dict keys $NetworkDict] { if {[string compare $NetworkDictKey $OwningBusinessRegion] == 0} { set Network [dict get $NetworkDict $NetworkDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Network is $Network" set ::SAPDat(PPM:XYCSCCHDR_01:NETWORK) $Network ; # Network } } set Dict [dict create] dict set DocumentCatDict "APAC" "A14" dict set DocumentCatDict "EMEA" "A14" dict set DocumentCatDict "LA" "A17" dict set DocumentCatDict "NA" "A20" puts "DocumentCatDict >$DocumentCatDict<" foreach DocumentCatDictKey [dict keys $DocumentCatDict] { if {[string compare $DocumentCatDictKey $OwningBusinessRegion] == 0} { set DocumentCat [dict get $DocumentCatDict $DocumentCatDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DocumentCat is $DocumentCat" set ::SAPDat(PPM:XYCSCCHDR_01:DOCCAT) $DocumentCat ; # Document Category } } set user_id [binary format H* $::TcData(WorkflowJob:owning_user)] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "user value status is $user_id" set ::SAPDat(PPM:XYCSCCHDR_01:ORUSER) "ZA82638" ; # Originator User set ::SAPDat(PPM:XYCSCCHDR_01:SPECWR) "ZA82638" ; # Spec Writer set ::SAPDat(PPM:XYCSCCHDR_01:REFERENCE) "TC-PPM Add to Line" ; # Reference set Dict [dict create] dict set DevelopmentGroupDict "Consumer" "All-Terrain" "PMT" dict set DevelopmentGroupDict "Consumer" "Cargo/Ultra Light Truck" "LTH" dict set DevelopmentGroupDict "Consumer" "Commuter Touring,High Performance,Ultra High Performance" "PAR" dict set DevelopmentGroupDict "Consumer" "Light Truck/SUV" "LTR" dict set DevelopmentGroupDict "Aviation" "Retread" "LTR" dict set DevelopmentGroupDict "Medium Truck" "" "" dict set DevelopmentGroupDict "Medium Truck" "" "" dict set DevelopmentGroupDict "Medium Truck" "" "" dict set DevelopmentGroupDict "Medium Truck" "" "" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DevelopmentGroupDict >$DevelopmentGroupDict<" set PBU [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9PBU"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "PBU is $PBU" set ProductCategory [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9ProductCategory"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ProductCategory is $ProductCategory" if {([string length $PBU] >0) && ([string length $ProductCategory] >0) } { foreach DevelopmentGroupDictKey [dict keys $DevelopmentGroupDict] { if {[string compare $DevelopmentGroupDictKey $PBU] == 0} { set DocumentCat [dict get $DevelopmentGroupDict $DevelopmentGroupDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DocumentCat is $DocumentCat" foreach Innerkey [dict keys $DocumentCat] { set InnerkeySS [split $Innerkey ","] if {[llength InnerkeySS] > 0} { foreach {newKey} $InnerkeySS { if {[string compare $newKey $ProductCategory] == 0} { set DevelopmentGroup [dict get $DocumentCat $Innerkey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DevelopmentGroup is $DevelopmentGroup" set ::SAPDat(PPM:XYCSCCHDR_01:LABOR) $DevelopmentGroup ; # Development Group } } } } } } } #set EffDat [clock format $now -format "%y-%m-%d %H:%M:%S"][format "%s.%s.%s" $Year $Month $Day] set Year [clock format [clock seconds] -format "%Y"] set Month [clock format [clock seconds] -format "%m"] set Date [clock format [clock seconds] -format "%d"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Date value is $Year $Month $Date" set EffDat [format "%4s.%2s.%2s" $Year $Month $Date] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "EffDat value is $EffDat" set ::SAPDat(PPM:XYCSCCHDR_01:EFFDAT) $EffDat ; # Effective Date set DocumentDesc [::T4X::TC::MAPPING::FieldMapping "$Program" "object_desc"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DocumentDesc is $DocumentDesc" if {([string length $DocumentDesc] >0) } { set ::SAPDat(PPM:XYCSCCHDR_01:DOCDES) $DocumentDesc } set GroupMember "$Program:gy9TechnicalProjectManager:GroupMember" set TechProjectManager [::T4X::TC::MAPPING::FieldMapping "$GroupMember" "user_name"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TechProjectManager is $TechProjectManager" if {([string length $TechProjectManager] >0) } { set ::SAPDat(PPM:XYCSCCHDR_01:SCCTPL) $TechProjectManager; # Technical Project Leader } set ::SAPDat(PPM:XYCSCCHDR_01:SCCNOT) "X" ; # SCC Notify # set ::SAPDat(PPM:XYCSCCHDR_01:DOCDES) "CBJS-BJZJJZ | SUMMER UHP SUV 2024-GOODYEAR" ; # Document Description set ::SAPDat(PPM:XYCSCCHDR_01:SCCREAS) "Test" ; # Reason for Specification Change Control # set ::SAPDat(PPM:XYCSCCHDR_01:SCCTPL) "NGI3076" ; # Technical Project Leader set ::SAPDat(PPM:XYCSCCHDR_01:SCCIMRL) "X" ; # Immediate Release of SCC #set TechProjectManagertest [lindex [tpco_formatHEX16 [lindex $TechProjectManager 1]] 0] # set TechProjectManagertest [binary format H* "676847415143694f354168556e4241414141414141414141414141"] # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TechProjectManagertest value is $TechProjectManagertest" #set SKUPlantFormsTag [ITK::GRM_list_secondary_objects_only $ItemRev $RelationTypeTag] # set Owner "$ItemRevisionType:owning_user:User" #set techGroup [::T4X::TC::MAPPING::FieldMapping "$Techproject" "GroupMember"] #tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "techGroup is $techGroup" #set techuser [::T4X::TC::MAPPING::FieldMapping "$techGroup" "user_name"] #set ::SAPDat(PPM:XYCSCCHDR_01:SCCTPL) "$techuser" ; # Technical Project Leader #tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Technical Project Leader is $techuser" ::T4X::TC::MAPPING::printTcData $TransactionId set FormTag $::TcData(ItemInfo:ObjectTagString) set index 0 set Connection [::ITK::connect2TcDB] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::ITK::connect2TcDB returns >$Connection<" if { $Connection != "0" } { set sRcMsg "NO Connection to Teamcenter" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "$sRcMsg" } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Form tag value is $FormTag" set ItkStatusform [::ITK::GRM_list_secondary_objects_only_by_name $FormTag "GY9_SAPRFCInpFormAttmntsRel"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ItkStatusform is $ItkStatusform" set actualVal "001" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "actualVal is $actualVal" if {[lindex $ItkStatusform 0] == 0 && [llength $ItkStatusform] > 1} { set RelatedObjects [lindex $ItkStatusform 1] #set RelObjLength [llength $RelatedObjects] set RelObjLength [expr {[llength $RelatedObjects] - 1}] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "RelObjLength is $RelObjLength" foreach RelObj [lrange $RelatedObjects 0 end] { #set RelObj [lindex $RelatedObjects $indx2] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "RelationObj is $RelObj" set ItemRev $RelObj #set ItemRev "$ItemRevisionType:GY9_SAPRFCInpFormAttmntsRel:GY9ProductSKURevision" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ItemRev:$ItemRev" set ItkStatusform1 [ITK::WSOM_ask_object_type $ItemRev] set SKURevType [lindex $ItkStatusform1 1] set SKURevisionType [tpco_formatHEX16 $SKURevType] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SKURevisionType is $SKURevisionType" #set PlantForm "$SKURevisionType:GY9HasPlant:GY9SKUPlantForm" set PlantForm "$ItemRevisionType:GY9_SAPRFCInpFormAttmntsRel:GY9ProductSKURevision:GY9HasPlant:GY9SKUPlantForm" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "PlantForm returns >$PlantForm<" set SKUPlantFormsTag [::T4X::TC::MAPPING::findObjectList "$PlantForm" "gy9TireProducingPlant"] if {([string length $SKUPlantFormsTag] >0)} { set plantstat [lindex $SKUPlantFormsTag 0] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::ITK::SKUPlantForm Tag returns >$plantstat<" } set ItkPlantform [::ITK::GRM_list_secondary_objects_only_by_name $ItemRev "GY9HasPlant"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ItkPlantform is $ItkPlantform" if {[lindex $ItkPlantform 0] == 0 && [llength $ItkPlantform] > 1} { set PlantObjects [lindex $ItkPlantform 1] set plantLen [expr {[llength $PlantObjects] - 1}] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "plantLen is $plantLen" foreach SKUPlantForm [lrange $PlantObjects 0 end] { #set DevSize [::T4X::TC::MAPPING::FieldMapping "$ItemRev" "gy9IsDevSize"] set DevSize [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9IsDevSize"] 1]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DevSize is $DevSize" #set SKUPlantForm [lindex $PlantObjects $indx] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SKUPlantForm is $SKUPlantForm" set ctcIndex 0 if { $DevSize eq "1" } { set ctcCount 2 } else { set ctcCount 1 } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ctcCount is $ctcCount" for {set newindx 1} {$newindx <= $ctcCount} {incr newindx} { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "newindx is $newindx" set DocItem $actualVal tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DocItem is $DocItem" set ::SAPDat(PPM:XYCSCCITEM:ITEM:$index) $DocItem; incr actualVal #set SKUPlantForm [lindex $SKUPlantFormsTag $indx] set TireProducingPlant [::T4X::TC::MAPPING::getObjectAttributeValue "$SKUPlantForm" "$PlantForm" "gy9TireProducingPlant"] if {[string length $TireProducingPlant] > 0} { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Actual TireProducingPlant is $TireProducingPlant" set newvalue [regexp {([A-Z,a-z]*).([A-Z,a-z]*).([0-9]+)} $TireProducingPlant TireProdPlant] set TireProducingPlantt [string map {"(" ""} $TireProdPlant] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Modified TireProducingPlant is $TireProducingPlantt" # XYCSCCAUTHPLNTS->Communication Structure for Plants authorized for Production. set ::SAPDat(PPM:XYCSCCAUTHPLNTS:ITEM:$index) $DocItem ; # Document Line Item set ::SAPDat(PPM:XYCSCCAUTHPLNTS:WERKS:$index) $TireProducingPlantt ; # Plant if {($TireProducingPlantt eq "N510") || ($TireProducingPlantt eq "N509") } { set ::SAPDat(PPM:XYCSCCITEM:MAPLELEAF:$index) "Y" ; # Maple Leaf Safety Mark [Y/N] } else { set ::SAPDat(PPM:XYCSCCITEM:MAPLELEAF:$index) "N" ; # Maple Leaf Safety Mark [Y/N] } } else { set Status "ERROR" lappend Status "Tire Producing Plant Value is not filled in Plant Form" tpwrite "::T4S::CTC::CUSTOM::IMPORT::selectTC_Object ERROR - Tire Producing Plant Value is not filled in Plant Form" } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "index is $index" # set prod_hier [::T4X::TC::MAPPING::FieldMapping "$ItemRev" "gy9_ProdHierSubGrp"] # set ::SAPDat(PPM:XYCSCCITEM:PRODH:0) $prod_hier ; # Product hierarchy if { $ctcIndex eq 0 } { set ::SAPDat(PPM:XYCSCCITEM:PRODSTATUS:$index) "SA" ; # Product Status set TireClass [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9TireClass"] if {[string length $TireClass] > 0} { set newvalue [regexp {.[A-Z]+} $TireClass Tireclassind] set TireClassInd [string map {"(" ""} $Tireclassind] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireClassInd is $TireClassInd" set ::SAPDat(PPM:XYCSCCITEM:TIRECLASSIND:$index) $TireClassInd ; # Tire Class Indicator } } else { set ::SAPDat(PPM:XYCSCCITEM:PRODSTATUS:$index) "DE" ; # Product Status set ::SAPDat(PPM:XYCSCCITEM:TIRECLASSIND:$index) "FDEVL" ; # Tire Class Indicator tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireClassInd is FDEVL" } set ::SAPDat(PPM:XYCSCCITEM:PRODH:$index) "010100010002000208" ; # Product hierarchy set Brand "01" set ::SAPDat(PPM:XYCSCCITEM:KONDM:$index) $Brand ; # Brand tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Brand is $Brand" set Dict [dict create] dict set TrueBrandDict "Avon" "D1" dict set TrueBrandDict "Cooper" "DD" dict set TrueBrandDict "Debica" "82" dict set TrueBrandDict "Diplomat" "C6" dict set TrueBrandDict "Dunlop" "44" dict set TrueBrandDict "ESA" "C7" dict set TrueBrandDict "Fulda" "37" dict set TrueBrandDict "Goodyear" "01" dict set TrueBrandDict "Kelly" "02" dict set TrueBrandDict "Mastercraft" "HM" dict set TrueBrandDict "Mickey Thompson" "BE" dict set TrueBrandDict "Motrio" "EL" dict set TrueBrandDict "Next Tread" "CP" dict set TrueBrandDict "Remington" "45" dict set TrueBrandDict "Roadmaster" "BL" dict set TrueBrandDict "Sava" "54" dict set TrueBrandDict "Starfire" "BM" dict set TrueBrandDict "Steelmark" "74" dict set TrueBrandDict "Tread Max" "HN" dict set TrueBrandDict "Unicircle" "CR" dict set TrueBrandDict "Voyager" "A1" dict set TrueBrandDict "Uniwing" "CQ" dict set TrueBrandDict "Multi-Mile" "04" dict set TrueBrandDict "Douglas" "31" dict set TrueBrandDict "MotoMaster" "32" dict set TrueBrandDict "Pacemark" "56" dict set TrueBrandDict "Arizonian" "60" dict set TrueBrandDict "Road Mark" "58" dict set TrueBrandDict "Lemans" "BB" dict set TrueBrandDict "***** Cepek" "BH" dict set TrueBrandDict "Triangle" "FH" set TrueBrand [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9TrueBrand"] 1]] if {[string length $TrueBrand] > 0} { puts "TrueBrandDict >$TrueBrandDict<" foreach TrueBrandDictKey [dict keys $TrueBrandDict] { if {[string compare $TrueBrandDictKey $TrueBrand] == 0} { set TrueBrandVal [dict get $TrueBrandDict $TrueBrandDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TrueBrandVal is $TrueBrandVal" set ::SAPDat(PPM:XYCSCCITEM:TRUEBRAND:$index) $TrueBrandVal ; # True Brand } } } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TrueBrand is $TrueBrand" set TireSize [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9TireSize"] 1]] if {[string length $TireSize] > 0} { set ::SAPDat(PPM:XYCSCCITEM:SIZEDIMENSION:$index) $TireSize ; # Tire Size / Dimension } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireSize is $TireSize" set ExtTireLineName [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9TireLineName"] 1]] if {[string length $ExtTireLineName] > 0} { set ::SAPDat(PPM:XYCSCCITEM:TIRELINEXT:$index) $ExtTireLineName ; } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ExtTireLineName is $ExtTireLineName" set TubeOrTubeless [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9TubeType"] 1]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TubeOrTubeless is $TubeOrTubeless" if {$TubeOrTubeless eq "Tube Type"} { set ::SAPDat(PPM:XYCSCCITEM:TTTLIND:$index) "TT" ; # Tube / Tubeless Indicator tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TubeOrTubeless is TT" } if {$TubeOrTubeless eq "Tubeless"} { set ::SAPDat(PPM:XYCSCCITEM:TTTLIND:$index) "TL" ; # Tube / Tubeless Indicator tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TubeOrTubeless is TL" } set ::SAPDat(PPM:XYCSCCITEM:NUMPLIESCL:$index) "999" ; # Number of Plies at Centerline 1 tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Plies at Centerline is 999" set ::SAPDat(PPM:XYCSCCITEM:PLYFABRIC:$index) "OT" ; # Material of Plies at Centerline 1 tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Material of Plies is OT" set ::SAPDat(PPM:XYCSCCITEM:BELT1ACTUAL:$index) "999" ; # Belt 1 - Number tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Belt 1 - Number is 999" set ::SAPDat(PPM:XYCSCCITEM:BELT1FABRIC:$index) "OT" ; # Belt 1 - Material tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Belt 1 - Material is OT" set ::SAPDat(PPM:XYCSCCITEM:OVLFABRIC:$index) "OT" ; # Material of Overlay tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Material of Overlay is OT" set ::SAPDat(PPM:XYCSCCITEM:NUMOVL:$index) "999" ; # Number of Overlays tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Number of Overlays is 999" set ::SAPDat(PPM:XYCSCCITEM:NUMPLIES:$index) "999" ; # Number of Plies Actual tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Plies Actual is 999" set ::SAPDat(PPM:XYCSCCITEM:KFABRICTYPE:$index) "OT" ; # Fabric Type tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Actual Ply Material is OT" set BudgetGICA [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9BudgetGICA"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "BudgetGICA is $BudgetGICA" set BudgetGDCC [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9BudgetGICC"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "BudgetGDCC is $BudgetGDCC" set BudgetGICG [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9BudgetGICG"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "BudgetGICG is $BudgetGICG" set BudgetGICL [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9BudgetGICL"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "BudgetGICL is $BudgetGICL" set OwningTechnicalCenter [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9OwningTechnicalCenter"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "OwningTechnicalCenter is $OwningTechnicalCenter" if {[string length $OwningTechnicalCenter] > 0} { if {$OwningTechnicalCenter eq "GIC*A"} { set ::sap_result_array(XYCSCCITEM:ERDNUMBER:$index) $BudgetGICA ; # ARD / ERD Number } elseif {$OwningTechnicalCenter eq "GDC*C"} { set ::sap_result_array(XYCSCCITEM:ERDNUMBER:$index) $BudgetGDCC ; # ARD / ERD Number } elseif {$OwningTechnicalCenter eq "GIC*G"} { set ::sap_result_array(XYCSCCITEM:ERDNUMBER:$index) $BudgetGICG ; # ARD / ERD Number } elseif {$OwningTechnicalCenter eq "GIC*L"} { set ::sap_result_array(XYCSCCITEM:ERDNUMBER:$index) $BudgetGICL ; # ARD / ERD Number } } set RimFlange [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9RimFlangeProtector"] 1]] if {[string length $RimFlange] > 0} { if {$RimFlange eq "Yes"} { set ::SAPDat(PPM:XYCSCCITEM:RIMFLPRT:$index) "X" ; # Rim Flange Protector } else { set ::SAPDat(PPM:XYCSCCITEM:RIMFLPRT:$index) "" ; # Rim Flange Protector } } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Rim Flange Protector is $RimFlange" set Tirepositioncode [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9WheelPosition"] 1]] if {[string length $Tirepositioncode] > 0} { if {$Tirepositioncode eq "All"} { set ::SAPDat(PPM:XYCSCCITEM:POSITIONCODE:$index) "AP" ; # Tire/Wheel Position Code } } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Tire position code is $Tirepositioncode" set TrafficConvention [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9TrafficConvention"] 1]] if {[string length $TrafficConvention] > 0} { set ::SAPDat(PPM:XYCSCCITEM:TRAFSIDE:$index) $TrafficConvention ; # Traffic Convention } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TrafficConvention is $TrafficConvention" set Certified [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9Certified"] 1]] if {[string length $Certified] > 0} { if {$Certified eq "Yes"} { set ::SAPDat(PPM:XYCSCCITEM:CERTIFIED:$index) "X" ; # Certified + } else { set ::SAPDat(PPM:XYCSCCITEM:CERTIFIED:$index) "" ; # Certified + } } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Certified is $Certified" set ResponsibleTechCenter [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9OwningTechnicalCenter"] if {[string length $ResponsibleTechCenter] > 0} { if {$ResponsibleTechCenter eq "GIC*A"} { set ::SAPDat(PPM:XYCSCCITEM:TECHCTR:$index) "GTC*A" ; # Technical Center tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ResponsibleTechCenter is GTC*A" } elseif {$ResponsibleTechCenter eq "GDC*C"} { set ::SAPDat(PPM:XYCSCCITEM:TECHCTR:$index) "GDC*C" ; # Technical Center tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ResponsibleTechCenter is GDC*C" } elseif {$ResponsibleTechCenter eq "GIC*G"} { set ::SAPDat(PPM:XYCSCCITEM:TECHCTR:$index) "DDC*H" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ResponsibleTechCenter is DDC*H" } elseif {$ResponsibleTechCenter eq "GIC*L"} { set ::SAPDat(PPM:XYCSCCITEM:TECHCTR:$index) "GTC*L" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ResponsibleTechCenter is GTC*L" } } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ResponsibleTechCenter is $ResponsibleTechCenter" set AltLoadRange [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9LoadRange"] 1]] if {[string length $AltLoadRange] > 0} { set ::SAPDat(PPM:XYCSCCITEM:LOADRANGE:$index) $AltLoadRange ; # Load Range or Ply Rating } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "AltLoadRange is $AltLoadRange" set Dict [dict create] dict set DevGroupDict "Bias Passenger" "Aircraft,Aircraft High Performance,Bias Light Truck,Bias Off the Road/Grader,Terra,Motorcycle,Specialty,Bias Passenger,Radial Passenger,Bias Light/Med Truck/Sup Singl,Radial Off the Road,Radial Light Truck,Radial Medium Truck,Race" "PAB" dict set DevGroupDict "Radial Passenger" "All-Terrain" "PMT" dict set DevGroupDict "Radial Passenger" "Commuter Touring,High Performanc,Ultra High Perf,Retread" "PAR" dict set DevGroupDict "Bias Light Truck" "Aircraft,Aircraft High Performance,Bias Light Truck,Bias Off the Road/Grader,Terra,Motorcycle,Specialty,Bias Passenger,Radial Passenger,Bias Light/Med Truck/Sup Singl,Radial Off the Road,Radial Light Truck,Radial Medium Truck,Race" "LTB" dict set DevGroupDict "Radial Light Truck" "" "LTR" dict set DevGroupDict "Radial Light Truck" "Cargo/Ultra Light Truck" "LTH" dict set DevGroupDict "Bias Light/Med Truck/Sup Singl" "" "MTB" dict set DevGroupDict "Radial Medium Truck" "" "MTR" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DevGroupDict >$DevGroupDict<" set TireDesignCategoryCode [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9DesignCategory"] 1]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireDesignCategoryCode is $TireDesignCategoryCode" set ProductCategory [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9ProductCategory"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ProductCategory is $ProductCategory" if {([string length $TireDesignCategoryCode] > 0) && ([string length $ProductCategory] > 0)} { foreach DevGroupDictKey [dict keys $DevGroupDict] { if {[string compare $DevGroupDictKey $TireDesignCategoryCode] == 0} { set DocumentCat [dict get $DevGroupDict $DevGroupDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DocumentCat is $DocumentCat" foreach Innerkey [dict keys $DocumentCat] { set InnerkeySS [split $Innerkey ","] if {[llength InnerkeySS] > 0} { foreach {newKey} $InnerkeySS { if {[string compare $newKey $ProductCategory] == 0} { set DevelopmentGroup [dict get $DocumentCat $Innerkey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DevelopmentGroup is $DevelopmentGroup" set ::SAPDat(PPM:XYCSCCITEM:LABOR:$index) $DevelopmentGroup ; # Development Group } } } } } } } set Dict [dict create] dict set ConstructionTypeDict "Radial Passenger,Radial Light Truck,Radial Medium Truck" "RP" dict set ConstructionTypeDict "Bias Passenger,Bias Light Truck,Bias Medium Truck,Bias Light Trk/Med Trk/Super Singl" "BP" puts "ConstructionTypeDict >$ConstructionTypeDict<" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireDesignCategoryCode is $TireDesignCategoryCode" if {[string length $TireDesignCategoryCode] > 0} { foreach ConstructionTypeDictKey [dict keys $ConstructionTypeDict] { set ConstrTypeKey [split $ConstructionTypeDictKey ","] if {[llength ConstrTypeKey] > 0} { foreach {CTKey} $ConstrTypeKey { if {[string compare $CTKey $TireDesignCategoryCode] == 0} { set ConstructionType [dict get $ConstructionTypeDict $ConstructionTypeDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ConstructionType is $ConstructionType" set ::SAPDat(PPM:XYCSCCITEM:BIASRADIND:$index) $ConstructionType ; # Construction Type } } } } } set SingleLoadIndex [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9LoadIndex"] 1]] if {[string length $SingleLoadIndex] > 0} { set ::SAPDat(PPM:XYCSCCITEM:LOADINDEX1:$index) $SingleLoadIndex ; # Standard Load Index Single } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SingleLoadIndex is $SingleLoadIndex" set SpeedSymbol [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9SpeedSymbol"] 1]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SpeedSymbol is $SpeedSymbol" if {[string length $SpeedSymbol] > 0} { set ::SAPDat(PPM:XYCSCCITEM:SPEEDSYM1:$index) $SpeedSymbol ; # Speed Symbol #1 } set SWDNonSerial [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9SWType"] 1]] if {[string length $SWDNonSerial] > 0} { set ::SAPDat(PPM:XYCSCCITEM:NONSERDEC:$index) $SWDNonSerial ; # Non-Serial Sidewall Decoration } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SWDNonSerial is $SWDNonSerial" set ProjectType [::T4X::TC::MAPPING::FieldMapping "$Program" "gy9ProjectType"] set Dict [dict create] dict set CustTypeDict "OE" "OE" dict set CustTypeDict "New Replacement Tire Line" "RPL" dict set CustTypeDict "Line Extension" "RPL" puts "CustTypeDict >$CustTypeDict<" foreach CustTypeDictKey [dict keys $CustTypeDict] { if {[string compare $CustTypeDictKey $ProjectType] == 0} { set CustType [dict get $CustTypeDict $CustTypeDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "CustType is $CustType" set ::SAPDat(PPM:XYCSCCITEM:CUSTTYPE:$index) $CustType ; # Customer Type } } set ::SAPDat(PPM:XYCSCCITEM:MOLDDESIGNCD:$index) "?" ; # Mold Reference Code GY9HasProductMatrix set ::SAPDat(PPM:XYCSCCITEM:TREADDEPTH:$index) "999.000" ; # Tread Depth Non-Skid at Centerline set ::SAPDat(PPM:XYCSCCITEM:PRESIDX:$index) "N" ; # Pressure Indexed Symbol [Y/N] set ::SAPDat(PPM:XYCSCCITEM:EXTREAD:$index) "N" ; # Extra Tread Marking Symbol [Y/N] set ::SAPDat(PPM:XYCSCCITEM:MINING:$index) "N" ; # Mining and Logging Marking Symbol [Y/N] set ::SAPDat(PPM:XYCSCCITEM:MULTIPURP:$index) "N" ; # Multi Purpose Tire Marking Symbol [Y/N] set Regrooveable [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9Regrooveable"] 1]] if {[string length $Regrooveable] > 0} { set ::SAPDat(PPM:XYCSCCITEM:REGROOVABLE:$index) $Regrooveable ; # Regroovable Indicator [Y/N] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Regrooveable is $Regrooveable" set TractionTire [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9TractionTire"] 1]] if {[string length $TractionTire] > 0} { set ::SAPDat(PPM:XYCSCCITEM:TRACTION:$index) $TractionTire ; # Traction Symbol } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TractionTire is $TractionTire" set POR [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9POR"] 1]] if {[string length $POR] > 0} { set ::SAPDat(PPM:XYCSCCITEM:PORSYMBOL:$index) $POR ; # Professional Off the Road Symbol [Y/N] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "POR is $POR" set FreeRollingTire [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9FreeRollingTire"] 1]] if {[string length $FreeRollingTire] > 0} { set ::SAPDat(PPM:XYCSCCITEM:FREEROLL:$index) $FreeRollingTire ; # Free Rolling Tire Symbol [Y/N] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "FreeRollingTire is $FreeRollingTire" set Studdable [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9Studdable"] 1]] if {[string length $Studdable] > 0} { set ::SAPDat(PPM:XYCSCCITEM:STUDDABLE:$index) $Studdable ; # Studdable Tire Symbol [Y/N] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Studdable is $Studdable" set WinterTire [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9WinterTire"] 1]] if {[string length $WinterTire] > 0} { set ::SAPDat(PPM:XYCSCCITEM:YWINTER:$index) $WinterTire ; # Winter Testing Indentifier [Y/N] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "WinterTire is $WinterTire" set Snowflake [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy93PMS"] 1]] if {[string length $Snowflake] > 0} { set ::SAPDat(PPM:XYCSCCITEM:SNOWFLAKE:$index) $Snowflake ; # Mountain Snowflake Symbol [Y/N] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Snowflake is $Snowflake" set MudandSnow [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9MudandSnow"] 1]] if {[string length $MudandSnow] > 0} { set ::SAPDat(PPM:XYCSCCITEM:MUDSNOW:$index) $MudandSnow ; # Mud and Snow (M+S) Marking [Y/N] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "MudandSnow is $MudandSnow" set RunFlat [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9RunFlat"] 1]] if {[string length $RunFlat] > 0} { set ::SAPDat(PPM:XYCSCCITEM:RUNFLATIND:$index) $RunFlat ; # Run Flat Indicator } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "RunFlat is $RunFlat" set ExtendedMobilityTire [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "gy9ExtendedMobilityTire"] 1]] if {[string length $ExtendedMobilityTire] > 0} { set ::SAPDat(PPM:XYCSCCITEM:SNAILSYMBOL:$index) $ExtendedMobilityTire ; # Regulatory Extended Mobility Tire } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ExtendedMobilityTire is $ExtendedMobilityTire" # XYCSCCGOVTCERT->Communication Structure for Government Certifications. set ::SAPDat(PPM:XYCSCCGOVTCERT:ITEM:$index) $DocItem; # Document Line Item set ::SAPDat(PPM:XYCSCCGOVTCERT:QUALCODE:$index) "Y" ; # Government Certification 30 Characters set ::SAPDat(PPM:XYCSCCGOVTCERT:QUALTYPE:$index) "M02" ; # Type of Certification #set ::SAPDat(PPM:XYCSCCGOVTCERT:CTCNUMBER:$index) $CTCNumber ; # Corporate Tire Code Number #set ::SAPDat(PPM:XYCSCCGOVTCERT:QUALSTAT:$index) "Y" ; # Certification Status35372103600GDYR # set ::SAPDat(PPM:XYCSCCGOVTCERT:ITEM:$index) $DocItem; # Document Line Item # set ::SAPDat(PPM:XYCSCCGOVTCERT:QUALCODE:0) "Y" ; # Government Certification 30 Characters # set ::SAPDat(PPM:XYCSCCGOVTCERT:QUALTYPE:0) "M03" ; # Type of Certification set Dict [dict create] dict set MarketRegionDict "gy9EAMarket" "18,21" dict set MarketRegionDict "gy9AfricaMarket" "1" dict set MarketRegionDict "gy9GSOCountries" "47" dict set MarketRegionDict "gy9SaudiArabia" "65" dict set MarketRegionDict "gy9NAMarket" "52" dict set MarketRegionDict "gy9ArgentinaMarket" "4" dict set MarketRegionDict "gy9BrazilMarket" "9" dict set MarketRegionDict "gy9ColumbiaMarket" "14" dict set MarketRegionDict "gy9EcuadorMarket" "17" dict set MarketRegionDict "gy9UruguayMarket" "77" dict set MarketRegionDict "gy9LACountryNotListed" "42" dict set MarketRegionDict "gy9ChinaMarket" "13" dict set MarketRegionDict "gy9IndiaMarket" "33" dict set MarketRegionDict "gy9IndoneisaMarket" "ID" dict set MarketRegionDict "gy9MalaysiaMarket" "44" dict set MarketRegionDict "gy9PhillippinesMarket" "83" dict set MarketRegionDict "gy9SouthKoreaMarket" "40" dict set MarketRegionDict "gy9TaiwanMarket" "71" dict set MarketRegionDict "gy9ThailandMarket" "72" dict set MarketRegionDict "gy9AsiaCountryNotListed" "5" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "MarketRegionDict >$MarketRegionDict<" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "New Region Value" foreach MarketRegionDictKey [dict keys $MarketRegionDict] { set MarketRegionValue [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "$MarketRegionDictKey"] 1]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "MarketRegionValue is $MarketRegionValue" if {$MarketRegionValue eq 1} { set MarketRegionVal [dict get $MarketRegionDict $MarketRegionDictKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "MarketRegionVal is $MarketRegionVal" set MktRegion [split $MarketRegionVal ","] if {[llength $MktRegion] > 0} { foreach {MartketArea} $MktRegion { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "MartketArea is $MartketArea" set ::SAPDat(PPM:XYCSCCMKTAREA:ITEM:$index) $DocItem ; # Document Line Item set ::SAPDat(PPM:XYCSCCMKTAREA:MKTAREA:$index) $MartketArea; # Design Market } } } } set alltcdata [::T4X::TC::MAPPING::printTcData $TransactionId] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "tcdata value is $alltcdata" set SKUId [tpco_formatHEX16 [lindex [::ITK::getObjectPropertyByName $ItemRev "item_id"] 1]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SKUId is $SKUId" set ::SAPDat(PPM:XYCSCCPRDCODE:ITEM:$index) $DocItem ; # Document Line Item set ::SAPDat(PPM:XYCSCCPRDCODE:PRODCODE:$index) $SKUId ; # Product Code set ::SAPDat(PPM:XYCSCCPRDCODE:PTYPE:$index) "TCSKU" ; # Type of Product Code # return $Status ### Set all the Input fileds as per the client input incr index incr ctcIndex } } } # Actual Perform CALL # Set inputs. } } set disconnection [ITK::disconnectTcDB] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::TC_Object2SAP_Object Returns" return $Status } # --------------------------------------------------------------------- ## # Method: ::T4S::CTC::CUSTOM::MAPPING::SAP_Object2TC_Object # \brief Customer specific object reverse mapping function template for CTC. # \author kh, 20100305 # \param TransactionId unique ID for the transfer transaction # \param TargetTypeName specified transaction target type name # \param Status Transfer Status # The following values are valid: # - SKIPPED the transfer was skipped # - ERROR the transfer was stopped by an error # - UNKNOWN the transfer was stopped by an unknown error # - UPDATED_WITH_ERROR the transfer was stopped by an minor error in one of the additional transfer steps # - CREATED, CHANGED, UPDATED and some other values are used for a successful transfer # \param args not used # # \return MappingStatus used by the following Tc object update function. # The following values are valid: # - OK T4S will update the Tc object based on the reverse mapping # preferences and the reverse mapping buffer. # - SKIPPED T4S will skip the TcData object # - ERROR T4S will stop transfer and raise an error # # proc SAP_Object2TC_Object { TransactionId TargetTypeName Status ObjectKey args } { # set ::errorCode "NONE" set ::errorInfo "" set CTCStatus "OK" set ItemRevisionType $::TcData(ItemInfo:TypeName) set ItemRevTag $::TcData(ItemInfo:ObjectTagString) set ::ImportCTCMessages [dict create] set Conn "ERROR" set FunctionName "[lindex [info level 0] 0]" set SCCNumber "" # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::SAP_Object2TC_Object starts with $Status - $ObjectKey" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::SAP_Object2TC_Object targettype - $TargetTypeName" set Connection [::ITK::connect2TcDB] if {$Connection == 0} { foreach RowInfo [array names ::sap_result_array XYCSCCITEM:CTCNUMBER:*] { set Index [lindex [split $RowInfo :] end] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "bapi RESULT ARRAY sap_result_array is :: $::sap_result_array(XYCSCCITEM:CTCNUMBER:$Index)" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "bapi RESULT ARRAY customer type is :: $::sap_result_array(XYCSCCITEM:CUSTTYPE:$Index)" set Conn "OK" set TireClassInd $::sap_result_array(XYCSCCITEM:TIRECLASSIND:$Index) tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "tire class indicator value is $TireClassInd" set CTCNumber $::sap_result_array(XYCSCCITEM:CTCNUMBER:$Index) set Status 0 set CtcNumber1 [string range $CTCNumber 1 9] set ProductCodeType $::sap_result_array(XYCSCCPRDCODE:PTYPE:$Index) tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ProductCodeType is $ProductCodeType" if {$ProductCodeType eq "TCSKU"} { set ProductSKUCode $::sap_result_array(XYCSCCPRDCODE:PRODCODE:$Index) tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ProductSKUCode is $ProductSKUCode" } if {$TireClassInd ne "FDEVL"} { set indx 1 set Itemfind1 [::ITK::ITEM_find $ProductSKUCode] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Itemfind1 is $Itemfind1" set SKUItemRev [::ITK::ITEM_ask_latest_rev [lindex [lindex $Itemfind1 1] 0]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SKUItemRev---------- $SKUItemRev ---------" set SKUItemLatestRev [lindex $SKUItemRev 1] set PlantForm "$ItemRevisionType:GY9_SAPRFCInpFormAttmntsRel:GY9ProductSKURevision:GY9HasPlant:GY9SKUPlantForm" set SKUPlantFormsTag [::T4X::TC::MAPPING::findObjectList "$PlantForm" "object_tag"] set SKUPlantForm [lindex $SKUPlantFormsTag $indx] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SKUPlantForm is $SKUPlantForm" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SKUPlantFormsTag is $SKUPlantFormsTag" set SKULatestRevName [::T4X::TC::MAPPING::FieldMapping "$ItemRevisionType:GY9_SAPRFCInpFormAttmntsRel:GY9ProductSKURevision" "object_name"] if {[string length $SKULatestRevName] > 0} { set SKUName [split $SKULatestRevName "-"] set SKUNameCount [expr {[llength $SKUName] - 2}] set SCCNumber [lindex $SKUName $SKUNameCount] } set SKUPlantFormsTag [::ITK::GRM_list_secondary_objects_only_by_name $SKUItemLatestRev "GY9HasPlant"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "New SKUPlantFormsTag is $SKUPlantFormsTag" if {[lindex $SKUPlantFormsTag 0] == 0} { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireProducingPlant1111111111111" set SKUProductRevs [lindex $SKUPlantFormsTag 1] foreach HexItemInfo [lrange $SKUProductRevs 0 end] { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireProducingPlant22222222222222" set TireProducingPlant [lindex [::T4X::TC::MAPPING::getObjectAttributeValue $HexItemInfo $PlantForm "gy9TireProducingPlant"] 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireProducingPlant is $TireProducingPlant" set ItkStatus [::ITK::getObjectPropertyByName $HexItemInfo "gy9TireProducingPlant"] set TireProducingPlant [tpco_formatHEX16 [lindex $ItkStatus 1]] #set TireProducingPlant [::T4X::TC::MAPPING::getObjectAttributeValue "$skuform" "$PlantForm" "gy9TireProducingPlant"] if {[string length $TireProducingPlant] > 0} { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireProducingPlant is $TireProducingPlant" set newvalue [regexp {([A-Z,a-z]*).([A-Z,a-z]*).([0-9]+)} $TireProducingPlant TireProdPlant] set TireProducingPlantt [string map {"(" ""} $TireProdPlant] } else { set TireProducingPlantt "" } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "sap_result_array for plant values are :: $::sap_result_array(XYCSCCAUTHPLNTS:WERKS:$Index)" set CTCPlantValue $::sap_result_array(XYCSCCAUTHPLNTS:WERKS:$Index) tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "CTCPlantValue is $CTCPlantValue" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "CTCNumber value is : $CtcNumber1" if {$CTCPlantValue eq $TireProducingPlantt} { set Itemfind [::ITK::ITEM_find $CtcNumber1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Itemfind is $Itemfind" set itemrev [::ITK::ITEM_ask_latest_rev [lindex [lindex $Itemfind 1] 0]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "---------- $itemrev ---------" set latestrev [lindex $itemrev 1] if {[string length $latestrev] > 0} { set CTCStatus "OK" set relation [::ITK::GRM_create_relation_only_by_name $HexItemInfo $latestrev "GY9SKUPlantCTC"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "relation is $relation" if {[llength $relation] == 2 && [lindex $relation 0] == 0} { # ::ITK::AOM_refresh_lock "[lindex $relation 1]" ::ITK::AOM_save "[lindex $relation 1]" ::ITK::AOM_refresh_unlock "[lindex $relation 1]" set CTCRevTags [::ITK::GRM_list_secondary_objects_only_by_name $HexItemInfo "GY9SKUPlantCTC"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "New CTCRevTags is $CTCRevTags" if {[lindex $CTCRevTags 0] == 0} { set CTCRevs [lindex $CTCRevTags 1] foreach CTCItemLatestRev [lrange $CTCRevs 0 end] { set ctcrev "$ItemRevisionType:GY9_SAPRFCInpFormAttmntsRel:GY9ProductSKURevision:GY9HasPlant:GY9SKUPlantForm:GY9SKUPlantCTC:GY9_CTCItemRevision" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "++++++++++ Reverse mapping value CTCItemLatestRev is $CTCItemLatestRev" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "++++++++++ Reverse mapping value ctcrev is $ctcrev" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "++++++++++ Reverse mapping value '::sap_result_array(XYCSCCITEM:TTTLIND:$Index) is $::sap_result_array(XYCSCCITEM:TTTLIND:$Index)......++++++'" ::ITK::AOM_refresh_lock $CTCItemLatestRev ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_TubeOrTubeless $::sap_result_array(XYCSCCITEM:TTTLIND:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_ProdStatus $::sap_result_array(XYCSCCITEM:PRODSTATUS:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_TireClassInd $::sap_result_array(XYCSCCITEM:TIRECLASSIND:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_ProdHierSubGrp $::sap_result_array(XYCSCCITEM:PRODH:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_Brand $::sap_result_array(XYCSCCITEM:KONDM:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_TrueBrand $::sap_result_array(XYCSCCITEM:TRUEBRAND:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_TireSize $::sap_result_array(XYCSCCITEM:SIZEDIMENSION:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_ExtTLName $::sap_result_array(XYCSCCITEM:TIRELINEXT:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_CLType1Count $::sap_result_array(XYCSCCITEM:NUMPLIESCL:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_CLType1Material $::sap_result_array(XYCSCCITEM:PLYFABRIC:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_MatlType1Count $::sap_result_array(XYCSCCITEM:BELT1ACTUAL:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_MatlType1Material $::sap_result_array(XYCSCCITEM:BELT1FABRIC:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_Type1Material $::sap_result_array(XYCSCCITEM:OVLFABRIC:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_Type1Count $::sap_result_array(XYCSCCITEM:NUMOVL:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_ActualPlyCount $::sap_result_array(XYCSCCITEM:NUMPLIES:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_ActualPlyMaterial $::sap_result_array(XYCSCCITEM:KFABRICTYPE:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_ARDERDNumber $::sap_result_array(XYCSCCITEM:ERDNUMBER:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_TirePositionCode $::sap_result_array(XYCSCCITEM:POSITIONCODE:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_TrafficConvention $::sap_result_array(XYCSCCITEM:TRAFSIDE:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_LoadRange $::sap_result_array(XYCSCCITEM:LOADRANGE:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_DevGroup $::sap_result_array(XYCSCCITEM:LABOR:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_ConstrType $::sap_result_array(XYCSCCITEM:BIASRADIND:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_SingleLoadIndex $::sap_result_array(XYCSCCITEM:LOADINDEX1:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_SpeedSymbol $::sap_result_array(XYCSCCITEM:SPEEDSYM1:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_SWDNonSerial $::sap_result_array(XYCSCCITEM:NONSERDEC:$Index) ::ITK::OBJECT_set_attribute_value2 $CTCItemLatestRev gy9_CustomerType $::sap_result_array(XYCSCCITEM:CUSTTYPE:$Index) foreach RowInfo [array names ::sap_result_array XYCSCCAUTHPLNTS:WERKS:*] { set index3 [lindex [split $RowInfo :] end] set ItkStatus [::ITK::TCTYPE_find_type "GY9_AuthorizedPlantTableRow"] if {[::ITK::isITK_ok $ItkStatus]} { set TableRowTagList {} set TypeTag [lindex $ItkStatus 1] set ItkStatus [::ITK::TCTYPE_construct_create_input $TypeTag gy9_AuthPlant $::sap_result_array(XYCSCCAUTHPLNTS:WERKS:$index3)] if {[::ITK::isITK_ok $ItkStatus]} { # ii) Create Table Row object # repeat steps I & ii above to create multiple rows. set createInputTag [lindex $ItkStatus 1] set ItkStatus [::ITK::TCTYPE_create_object $createInputTag] if {[::ITK::isITK_ok $ItkStatus]} { set newObjectTag [lindex $ItkStatus 1] # Iii) set table rows from create above + existing rows for the item set ItkStatus [::ITK::AOM_refresh_lock $CTCItemLatestRev] lappend TableRowTagList $newObjectTag set ItkStatus [::ITK::AOM_set_table_rows $CTCItemLatestRev gy9_AuthPlants {*}$TableRowTagList] puts "AOM_set_table_rows ItkStatus $ItkStatus" if {[::ITK::isITK_ok $ItkStatus]} { set ItkStatus [::ITK::AOM_save $CTCItemLatestRev] set ItkStatus [::ITK::AOM_refresh_unlock $CTCItemLatestRev] } else { tpwrite -mtype CONSOLE "::ITK::AOM_set_table_rows fails!" } } else { tpwrite -mtype CONSOLE "TCTYPE_create_object fails!" } } else { tpwrite -mtype CONSOLE "TCTYPE_construct_create_input created failed for table row!" } } else { tpwrite -mtype CONSOLE "Table row type not found!" } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "++++++++++ Reverse mapping value ::sap_result_array(XYCSCCAUTHPLNTS:CTCNUMBER:$index3) is $::sap_result_array(XYCSCCAUTHPLNTS:CTCNUMBER:$index3)" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "++++++++++ Reverse mapping value ::sap_result_array(XYCSCCAUTHPLNTS:WERKS:$index3) is $::sap_result_array(XYCSCCAUTHPLNTS:WERKS:$index3)" } foreach RowInfo [array names ::sap_result_array XYCSCCPRDCODE:CTCNUMBER:*] { set index4 [lindex [split $RowInfo :] end] set ItkStatus [::ITK::TCTYPE_find_type "GY9_ProductCodesTableRow"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "GY9_ProductCodesTableRow1 is $ItkStatus" if {[::ITK::isITK_ok $ItkStatus]} { set TableRowTagList {} tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TableRowTagList1 is $TableRowTagList" set TypeTag [lindex $ItkStatus 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TypeTag1 is $TypeTag" set ItkStatus [::ITK::TCTYPE_construct_create_input $TypeTag gy9_CodeType $::sap_result_array(XYCSCCPRDCODE:PTYPE:$index4) gy9_ProdCode $::sap_result_array(XYCSCCPRDCODE:PRODCODE:$index4)] if {[::ITK::isITK_ok $ItkStatus]} { # ii) Create Table Row object # repeat steps I & ii above to create multiple rows. set createInputTag [lindex $ItkStatus 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "createInputTag1 is $createInputTag" set ItkStatus [::ITK::TCTYPE_create_object $createInputTag] if {[::ITK::isITK_ok $ItkStatus]} { set newObjectTag [lindex $ItkStatus 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "newObjectTag1 is $newObjectTag" # Iii) set table rows from create above + existing rows for the item set ItkStatus [::ITK::AOM_refresh_lock $CTCItemLatestRev] lappend TableRowTagList $newObjectTag tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TableRowTagList1 is $TableRowTagList" set ItkStatus [::ITK::AOM_set_table_rows $CTCItemLatestRev gy9_ProdCodes {*}$TableRowTagList] puts "AOM_set_table_rows ItkStatus $ItkStatus" if {[::ITK::isITK_ok $ItkStatus]} { set ItkStatus [::ITK::AOM_save $CTCItemLatestRev] set ItkStatus [::ITK::AOM_refresh_unlock $CTCItemLatestRev] } else { tpwrite -mtype CONSOLE "::ITK::AOM_set_table_rows fails!" } } else { tpwrite -mtype CONSOLE "TCTYPE_create_object fails!" } } else { tpwrite -mtype CONSOLE "TCTYPE_construct_create_input created failed for table row!" } } else { tpwrite -mtype CONSOLE "Table row type not found!" } } #111111111111111111111111111111111111111111111111111111111111 foreach RowInfo [array names ::sap_result_array XYCSCCMKTAREA:MKTAREA:*] { set index5 [lindex [split $RowInfo :] end] set ItkStatus [::ITK::TCTYPE_find_type "GY9_MarketAreasTableRow"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "GY9_MarketAreasTableRow is $ItkStatus" if {[::ITK::isITK_ok $ItkStatus]} { set TableRowTagList {} tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TableRowTagList2 is $TableRowTagList" set TypeTag [lindex $ItkStatus 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TypeTag2 is $TypeTag" set ItkStatus [::ITK::TCTYPE_construct_create_input $TypeTag gy9_DesignMarket $::sap_result_array(XYCSCCMKTAREA:MKTAREA:$index5)] if {[::ITK::isITK_ok $ItkStatus]} { # ii) Create Table Row object # repeat steps I & ii above to create multiple rows. set createInputTag [lindex $ItkStatus 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "createInputTag2 is $createInputTag" set ItkStatus [::ITK::TCTYPE_create_object $createInputTag] if {[::ITK::isITK_ok $ItkStatus]} { set newObjectTag [lindex $ItkStatus 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "newObjectTag2 is $newObjectTag" # Iii) set table rows from create above + existing rows for the item set ItkStatus [::ITK::AOM_refresh_lock $CTCItemLatestRev] lappend TableRowTagList $newObjectTag tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TableRowTagList2 is $TableRowTagList" set ItkStatus [::ITK::AOM_set_table_rows $CTCItemLatestRev gy9_MarketAreas {*}$TableRowTagList] puts "AOM_set_table_rows ItkStatus $ItkStatus" if {[::ITK::isITK_ok $ItkStatus]} { set ItkStatus [::ITK::AOM_save $CTCItemLatestRev] set ItkStatus [::ITK::AOM_refresh_unlock $CTCItemLatestRev] } else { tpwrite -mtype CONSOLE "::ITK::AOM_set_table_rows fails!" } } else { tpwrite -mtype CONSOLE "TCTYPE_create_object fails!" } } else { tpwrite -mtype CONSOLE "TCTYPE_construct_create_input created failed for table row!" } } else { tpwrite -mtype CONSOLE "Table row type not found!" } } ::ITK::AOM_save $CTCItemLatestRev ::ITK::AOM_refresh_unlock $CTCItemLatestRev set DesignFormTags [::ITK::GRM_list_secondary_objects_only_by_name $CTCItemLatestRev "IMAN_specification"] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "DesignFormTags is $DesignFormTags" set DesignForm [lindex [lindex $DesignFormTags 1] 0] ::ITK::AOM_refresh_lock $DesignForm ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_MapleLeafSafetyMark $::sap_result_array(XYCSCCITEM:MAPLELEAF:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_MoldRefCode $::sap_result_array(XYCSCCITEM:MOLDDESIGNCD:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_AtCenterLine $::sap_result_array(XYCSCCITEM:TREADDEPTH:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_PressureIndexed $::sap_result_array(XYCSCCITEM:PRESIDX:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_ExtraTreadMarking $::sap_result_array(XYCSCCITEM:EXTREAD:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_MiningandLogging $::sap_result_array(XYCSCCITEM:MINING:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_MultiPurposeTire $::sap_result_array(XYCSCCITEM:MULTIPURP:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_Regroovable $::sap_result_array(XYCSCCITEM:REGROOVABLE:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_TractionSymbol $::sap_result_array(XYCSCCITEM:TRACTION:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_ProfOfftheRoad $::sap_result_array(XYCSCCITEM:PORSYMBOL:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_FreeRollingTire $::sap_result_array(XYCSCCITEM:FREEROLL:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_WthRimFlangeProt $::sap_result_array(XYCSCCITEM:RIMFLPRT:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_Certified $::sap_result_array(XYCSCCITEM:CERTIFIED:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_RespTechCenter $::sap_result_array(XYCSCCITEM:TECHCTR:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_Studdable $::sap_result_array(XYCSCCITEM:STUDDABLE:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_WinterTestingInd $::sap_result_array(XYCSCCITEM:YWINTER:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_MountainSnowflakeSymbol $::sap_result_array(XYCSCCITEM:SNOWFLAKE:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_MudSnowInd $::sap_result_array(XYCSCCITEM:MUDSNOW:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_RunFlatUse $::sap_result_array(XYCSCCITEM:RUNFLATIND:$Index) ::ITK::OBJECT_set_attribute_value2 $DesignForm gy9_SnailSymbol $::sap_result_array(XYCSCCITEM:SNAILSYMBOL:$Index) ::ITK::AOM_save $DesignForm ::ITK::AOM_refresh_unlock $DesignForm } } } else { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "ERROR: relation not created!" } set ErrorString "SCC/CTC Creation in SAP is failed for the following reason" #dict append ::ImportCTCMessages $CtcNumber1 $TireClassInd "Success" dict set ::ImportCTCMessages $CtcNumber1 $TireClassInd $ProductSKUCode $TireProducingPlant "Success" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> CTC imported Successfully for the following CTC $CtcNumber1!" } else { set CTCStatus "ERROR" lappend CTCStatus "CTC imported failed for following CTC $CtcNumber1" dict set ::ImportCTCMessages $CtcNumber1 $TireClassInd $ProductSKUCode $TireProducingPlant "Failed" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> CTC import failed for the following CTC $CtcNumber1!" } } } } } else { set Itemfind [::ITK::ITEM_find $CtcNumber1] set itemrevlen [lindex $Itemfind 1] if {[llength $itemrevlen] == 0} { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Itemfind is equal to null value" after 40000 set Itemfind [::ITK::ITEM_find $CtcNumber1] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Itemfind is $Itemfind" set itemrev [::ITK::ITEM_ask_latest_rev [lindex [lindex $Itemfind 1] 0]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "---------- $itemrev ---------" set latestrev [lindex $itemrev 1] if {[string length $latestrev] > 0} { set CTCStatus "OK" dict set ::ImportCTCMessages $CtcNumber1 $TireClassInd $ProductSKUCode $TireProducingPlant "Success" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> CTC imported Successfully for the following CTC $CtcNumber1!" } else { set CTCStatus "ERROR" dict set ::ImportCTCMessages $CtcNumber1 $TireClassInd $ProductSKUCode $TireProducingPlant "Failed" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> CTC import failed for the following CTC $CtcNumber1!" } } } } else { set CTCStatus "ERROR" lappend CTCStatus "NO CONNECTION TO TC" tpwrite "::T4S::CTC::CUSTOM::IMPORT::selectTC_Object ERROR - NO CONNECTION TO TC" } if {$Conn eq "OK"} { #Get Email of the owning user for sending notifications if {[info exists ::TcData(WorkflowJob:owning_user:PersonAttribute:PA9)]} { set Email [tpco_formatHEX16 $::TcData(WorkflowJob:owning_user:PersonAttribute:PA9)] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Email = >$Email<" } #set mailBody "SCC/CTC creation in SAP was successful<br><br> set sccmailbody "<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:60%;text-align:left\"><tbody><tr><th>SCC Number</th><th>Program ID</th></tr><tr><td>$::sap_result_array(XDOCNO)</td><td>$SCCNumber</td></tr></tbody></table><br><br>" set mailBody "<table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width:100%;text-align:left\"><tbody><tr><th>CTC Number</th><th>SKU ID</th><th>Tire Class Indicator</th><th>Plant Code</th><th>Status</th></tr>" if {[string length $::ImportCTCMessages] >0} { foreach ImportCTCKey [dict keys $::ImportCTCMessages] { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ImportCTCKeyImportCTCKey is $ImportCTCKey" set CTCKey [dict get $::ImportCTCMessages $ImportCTCKey] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "setCTCKey is $CTCKey" foreach TireClass [dict keys $CTCKey] { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "TireClass is $TireClass" set TireClassInd [dict get $CTCKey $TireClass] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "setTireClassInd is $TireClassInd" foreach SkuId [dict keys $TireClassInd] { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "SkuId is $SkuId" set plant [dict get $TireClassInd $SkuId] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "setplant is $plant" foreach plantcode [dict keys $plant] { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "plantcode is $plantcode" set codee [dict get $plant $plantcode] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "setcodee is $codee" append mailBody "<tr><td>$ImportCTCKey</td><td>$SkuId</td><td>$TireClass</td><td>$plantcode</td><td>$codee</td></tr>" } } } } set AwcUrl "" set ItkStatus [ITK::PREF_ask_char_values site [tpco_scanHEX16 "ActiveWorkspaceHosting.URL"]] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "awc url status is $ItkStatus" if {[::ITK::isITK_ok $ItkStatus]} { set PrefValueList [lindex $ItkStatus 1] set HexUrl [lindex $PrefValueList 0] set URL [binary format H* $HexUrl] } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::TcData(Workflow:RootTaskTag) is $::TcData(Workflow:RootTaskTag)" if {[string length $::TcData(Workflow:RootTaskTag)] > 0} { set ItkStatus [ITK::POM_tag_to_uid $::TcData(Workflow:RootTaskTag)] set RetCode [lindex $ItkStatus 0] set objTag [lindex $ItkStatus 1] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::IMPORT::cleanUp ITK Status $RetCode and $objTag" set Uid ""; if {[::ITK::isITK_ok $ItkStatus]} { set Uid [lindex $ItkStatus 1] } set AwcUrl "$URL/#com.siemens.splm.clientfx.tcui.xrt.showObject;uid=$Uid" } append mailBody "</tbody></table>" ::EMail::sendhtmlmail $Email [email protected] gysmtpnotls.goodyear.com 25 "<h3>SCC/CTC creation in SAP was successful</h3><br>Following is the SCC Information,<br>$sccmailbody<br><br>Following are the CTC Import Status,<br>$mailBody <br><br> Active Workspace: $AwcUrl" "" "TC: Info , SCC/CTC Creation in SAP" "" "" } } ::ITK::disconnectTcDB tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::SAP_Object2TC_Object Returns" return $Status } # --------------------------------------------------------------------- ## # Method: ::T4S::CTC::CUSTOM::MAPPING::getObjectInfo # \brief Customer specific Mapping function to retrieve the object information from SAP # # \author kh, 20100305 # \param TransactionId unique ID for the transfer transaction # \param TargetTypeName specified transaction target type name # \param ObjectKey # \param args not used # \return list of status and object key # # proc getObjectInfo { TransactionId TargetTypeName ObjectKey args } { # set ::errorCode "NONE" set ::errorInfo "" set Status "OK" set ItemRev $::TcData(ItemInfo:TypeName) set ItemRevTag $::TcData(ItemInfo:ObjectTagString) # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::getObjectInfo starts" if {$TargetTypeName eq "CTC"} { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S: matches" foreach RowInfo [array names ::sap_result_array XYCSCCITEM:CTCNUMBER:*] { set Index [lindex [split $RowInfo :] end] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "last execution sap_result_array is :: $::sap_result_array(XYCSCCITEM:CTCNUMBER:$Index)" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "last execution Index is :: $Index" set CTCNumber $::sap_result_array(XYCSCCITEM:CTCNUMBER:$Index) } } else { acPrintErrorMsg "targettype is not ctc" # # TODO # # } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::getObjectInfo returns with >$Status<" return $Status } # --------------------------------------------------------------------- ## # Method: ::T4S::CTC::CUSTOM::MAPPING::performSapTransfer # \brief Customer specific function to call SAP # # \author kh, 20100305 # \param TransactionId unique ID for the transfer transaction # \param TargetTypeName specified transaction target type name # \return StatusDict dict structure with the following element: # - Status OK|ERROR # - OBJECT_KEY object key of the resulting object in the external system # - ErrorMessage last error message # - NoOfMessages 0 or n (optional if more that one error messages needs to be returned) # - LogMessageMessage(1 .. n) (optional if more that one error messages needs to be returned) # - LogMessageSeverity(1 .. n) (optional if more that one error messages needs to be returned) # # proc performSapTransfer { TransactionId TargetTypeName args } { # set ::errorCode "NONE" set ::errorInfo "" set Status "OK" dict set StatusDict Status "OK" dict set StatusDict OBJECT_KEY "" dict set StatusDict ErrorMessage "" set ::FailedCTCErrors [dict create 0 ""] set ::ErrorNum 0 set FunctionName "[lindex [info level 0] 0]" # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "$FunctionName starts" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "$FunctionName -> RFC input Array Size = [array size ::SAPDat]" # Check for SAP connection set SAPVERSION [::TPSAP::getReleaseInfo] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "$FunctionName -> SAPVERSION = $SAPVERSION" if {([array size ::SAPDat] > 0) && ($SAPVERSION ne "UNKNOWNRELEASE")} { dict set SAPInDataDict SAPFunction Y_SCC_CREATE_01 dict set SAPInDataDict SAPInDataArray ::SAPDat dict set SAPInDataDict SAPOutDataArray ::sap_result_array dict set SAPInDataDict Pattern PPM dict set SAPInDataDict Commit false dict set SAPInDataDict CaloInit false dict set SAPInDataDict UseSAPGui false dict set SAPInDataDict UseSAPCallback false dict set SAPInDataDict VerifyDataKeys false dict set SAPInDataDict VerifyDataValues false dict set SAPInDataDict VerifyErrors true dict set SAPInDataDict CloseConnection false # Call. set SAPOutDataDict [::TPSAP::performSapCall $SAPInDataDict] # Get outputs. if { [dict get $SAPOutDataDict Status] eq "OK" } { # ## Loop through the complete detail and pring it to understand the output. tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "ctc number created is11111 " tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "document number is $::sap_result_array(XDOCNO)" set CTCCreationStatus "FALSE" foreach RowInfo [array names ::sap_result_array XYMESSAGEINF:MSGID:*] { set Index [lindex [split $RowInfo :] end] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XSWCERROR:MSGID:$Index) is $::sap_result_array(XSWCERROR:MSGID:$Index)" ; # Message Class tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "sap_result_array(XSWCERROR:MSGTY:$Index) is $::sap_result_array(XSWCERROR:MSGTY:$Index)" ; # Message Type tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XSWCERROR:MSGNO:$Index) is $::sap_result_array(XSWCERROR:MSGNO:$Index)"; # Message Number tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XSWCERROR:MSGV1:$Index) is $::sap_result_array(XSWCERROR:MSGV1:$Index)" ; # Message Variable tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XSWCERROR:MSGV2:$Index) is $::sap_result_array(XSWCERROR:MSGV2:$Index)" ; # Message Variable tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XSWCERROR:MSGV3:$Index) is $::sap_result_array(XSWCERROR:MSGV3:$Index)" ; # Message Variable tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XSWCERROR:MSGV4:$Index) is $::sap_result_array(XSWCERROR:MSGV4:$Index)" ; # Message Variable tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XSWCERROR:ELEMENT:$Index) is $::sap_result_array(XSWCERROR:ELEMENT:$Index)" ; # Element tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XYMESSAGEINF:MSGTY:$Index) is $::sap_result_array(XYMESSAGEINF:MSGTY:$Index)" ; tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XYMESSAGEINF:MSGID:$Index) is $::sap_result_array(XYMESSAGEINF:MSGID:$Index)" ; tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XYMESSAGEINF:MSGNO:$Index) is $::sap_result_array(XYMESSAGEINF:MSGNO:$Index)" ; tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XYMESSAGEINF:MSSPC:$Index) is $::sap_result_array(XYMESSAGEINF:MSSPC:$Index)" ; tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::sap_result_array(XYMESSAGEINF:MSGTX:$Index) is $::sap_result_array(XYMESSAGEINF:MSGTX:$Index)" ; #If RFC call returns an Error Message then store it in an array for email notifications if { $::sap_result_array(XYMESSAGEINF:MSGTY:$Index) eq "E" } { set PreIndex [expr { $Index - 1}] set ErrorString "SCC/CTC Creation in SAP is failed for the following reason -> $::sap_result_array(XYMESSAGEINF:MSGTX:$Index)" dict append ::FailedCTCErrors $::ErrorNum $ErrorString tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> ERROR - $ErrorString" dict set StatusDict ErrorMessage "SCC/CTC creation in SAP is not successful due to different errors!" incr ::ErrorNum } elseif {($::sap_result_array(XYMESSAGEINF:MSGTY:$Index) eq "S") && ($::sap_result_array(XYMESSAGEINF:MSGID:$Index) eq "YSCC")} { set CTCCreationStatus "TRUE" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "$FunctionName -> SUCCESS - SCC/CTC creation is successful = $::sap_result_array(XYMESSAGEINF:MSGTX:$Index)" } } #foreach RowInfo [array names ::sap_result_array XYCSCCITEM:CTCNUMBER:*] { # set Index [lindex [split $RowInfo :] end] # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "bapi RESULT ARRAY sap_result_array is :: $::sap_result_array(XYCSCCITEM:CTCNUMBER:$Index)" # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "bapi RESULT ARRAY customer type is :: $::sap_result_array(XYCSCCITEM:CUSTTYPE:$Index)" #} if { $CTCCreationStatus eq "FALSE" } { dict set StatusDict Status "ERROR" dict set StatusDict OBJECT_KEY "" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> SCC/CTC creation in SAP is not successful due to different errors!" } else { dict set StatusDict Status "OK" dict set StatusDict OBJECT_KEY "" dict set StatusDict ErrorMessage "" set ImportStatus [ImportTC_Object] } } else { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> RFC call execution failed, may be no connection to SAP!!!" dict set StatusDict Status "ERROR" dict set StatusDict OBJECT_KEY "" dict set StatusDict ErrorMessage "RFC call execution failed, may be no connection to SAP!!!" } } else { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype ERROR "$FunctionName -> CTC creation in SAP is not triggered due to different errors!" dict set StatusDict Status "ERROR" dict set StatusDict OBJECT_KEY "" dict set StatusDict ErrorMessage "CTC creation in SAP is not triggered due to different errors!" } #Check if the Error Array has any errors in it , if yes then update it to the Workflow Initiator via email notification if { $::ErrorNum > 0 } { #Get Email of the owning user for sending notifications if {[info exists ::TcData(WorkflowJob:owning_user:PersonAttribute:PA9)]} { set Email [tpco_formatHEX16 $::TcData(WorkflowJob:owning_user:PersonAttribute:PA9)] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Email = >$Email<" } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "***Final Error List -> [dict values $::FailedCTCErrors] *** number is $::ErrorNum" #Concatenate the Errors into a string for email notification foreach {Key Value} $::FailedCTCErrors { append FailedCTCErrorList "<br>Error $Key: $Value" } #Trigger email notification for notifying the failure reasons to the workflow initiator tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "***Final Error List Final -> $FailedCTCErrorList ***" ::EMail::sendhtmlmail $Email [email protected] gysmtpnotls.goodyear.com 25 "SCC/CTC creation in SAP was not successful due to below errors. <br>$FailedCTCErrorList" "" "TC: Error , SCC/CTC Creation in SAP" "" "" } else { tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "StatusDict is $StatusDict" # foreach StatusDictKey [dict keys $StatusDict] { # foreach {StatKey} $StatusDictKey { # if {[string compare $StatKey "Status"] == 0} { # set StatusKey [dict get $StatusDict $StatusDictKey] # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "StatusKey is $StatusKey" # if {$StatusKey eq "OK"} { # #Get Email of the owning user for sending notifications # if {[info exists ::TcData(WorkflowJob:owning_user:PersonAttribute:PA9)]} { # set Email [tpco_formatHEX16 $::TcData(WorkflowJob:owning_user:PersonAttribute:PA9)] # tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "Email = >$Email<" # } # ::EMail::sendhtmlmail $Email [email protected] gysmtpnotls.goodyear.com 25 "SCC/CTC creation in SAP was successful" "" "TC: Info , SCC/CTC Creation in SAP" "" "" # } # } # } # } } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::performSapTransfer returns with >$StatusDict<" return $StatusDict } # --------------------------------------------------------------------- ## # Method: ::T4S::CTC::CUSTOM::IMPORT::createTC_Object # \brief Customer specific function for the creation of the Tc object based on a given objectId. # # \author Vishal Shitole # \param Function Import function name, supports using same procedures and same namespace for different customer imports # \param ObjectKey object key # \param AdditionalInfo additional information # \return # # # ## proc ImportTC_Object {args} { # Reset some internal variables set ::errorCode "NONE" set ::errorInfo "" # Define default return code set rc "ERROR" set Connection [::ITK::connect2TcDB] foreach RowInfo2 [array names ::sap_result_array XYCSCCITEM:CTCNUMBER:*] { set Index2 [lindex [split $RowInfo2 :] end] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "index value is : $Index2" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "sap_result_array is :: $::sap_result_array(XYCSCCITEM:CTCNUMBER:$Index2)" set CTCNumber $::sap_result_array(XYCSCCITEM:CTCNUMBER:$Index2) # Write information to session log tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "createTC_Object starts with $CTCNumber" # Define the basic data of item set NewItemType "GY9_CTCItem" set NewItemId [string range $CTCNumber 1 9] set NewItemName [string range $CTCNumber 1 9] set NewItemRevisionId "00" # Create item without support of multi field keys set rc [::T4X::CUSTOM::MAPPING::TOOLBOX::createTC_Object $NewItemId $NewItemName $NewItemRevisionId $NewItemType] # Write return code to session log tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "createTC_Object returns $rc" } set disconnection [ITK::disconnectTcDB] return $rc } # --------------------------------------------------------------------- ## # Method: ::T4S::CTC::CUSTOM::MAPPING::callCustomerRuleHandler # \brief Customer specific object RuleHandler function template # # # \author kh, 25.10.2005 # \param TransactionId unique ID for the transfer transaction # \param TargetTypeName specified transaction target type name # \param Action Work flow action # \param RuleName specified rule name in the work flow arguments # named "-user_rule". If the argument is not specified the value # is "Default" # \param ItemType # \param ItemRevisionType # # \param args not used # # \return EPM_nogo or EPM_go # # proc callCustomerRuleHandler {TransactionId Action RuleName ItemType ItemRevisionType args} { set ::errorCode "NONE" set ::errorInfo "" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::callCustomerRuleHandler Starts with $TransactionId $Action $RuleName $ItemType $ItemRevisionType" set Decision "EPM_nogo" set Status "OK" # Here you can add your test conditions (see the other mapping files for examples): set Decision "EPM_go" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "::T4S::CTC::CUSTOM::MAPPING::callCustomerRuleHandler returns $Decision" return $Decision } proc acGetWorkflowType {args} { if {$::TcData(GatewayMode) == "Workflow"} { set wftype [dict get [::T4X::TC::MAPPING::getWorkflowArgumentValue2 "-WORKFLOW_TYPE" UPPERCASE] ArgumentValue] if {$wftype != ""} { return $wftype} else {return "UNKNOWN"} } else { return "NOT_A_WF" } } proc acPrintErrorMsg {subject args} { #acLog "**** ERROR MESSAGE ****" #acLog "***********************" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "subj: $subject" set hostname [string toupper [info hostname]] set subject "$hostname: $subject" if {[info exists ::TcData(SiteIdName)]} { set siteid "$::TcData(SiteIdName)" } else { set siteid " "} set sMailOrg "T4S on [info hostname]" set msg "During a TC to SAP transfer, the following error was returned ($siteid) :\n\n\n\n" # if {[info exists ::TcData(WorkflowJob:owning_user:PersonAttribute:PA9)]} { set MailAddr "[email protected]" set ::ToMailIdList "[email protected]" set ::FromMailId $MailAddr ::EMail::sendmail $::ToMailIdList $::FromMailId "gysmtpnotls.goodyear.com" 25 "Test" "" "subject" "" #::EMail::sendhtmlmail $UserEmail [email protected] gysmtpnotls.goodyear.com #set ::MailServerHost "[email protected]" set ::MailServerHost "gysmtpnotls.goodyear.com" set msg $subject set rc2 [::T4X::CORE::sendMail2BGS2 $::ToMailIdList $::FromMailId $::MailServerHost 25 $msg "$sMailOrg" $subject "TP-CM" TEXT high ] #::EMail::sendhtmlmail [email protected] gysmtpnotls.goodyear.com 25 "GENERICEQUIPMENT $ObjectKey is imported successfully to TC." tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "rc2 is : $rc2" if {[string length $MailAddr] > 0} { #set rc [::T4X::CORE::sendMail2BGS2 $MailAddr $::FromMailId $::MailServerHost 0 $msg "$sMailOrg" $subject "TP-CM" TEXT high ] set rc [::T4X::CORE::sendMail2BGS2 $::ToMailIdList $::FromMailId $::MailServerHost 25 $msg "$sMailOrg" $subject "TP-CM" TEXT high ] tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "rc is : $rc" } } tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "mail server host : $::MailServerHost" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "mail to MailAddr: $MailAddr" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "mail content : $msg" tpwrite -logchannel [::PL4X::CORE::getSessionLogChannel] -mtype INTERN "***********************" return "OK" } }
Write, Run & Share TCL code online using OneCompiler's TCL online compiler for free. It's one of the robust, feature-rich online compilers for TCL language, running the latest TCL version 8.6. Getting started with the OneCompiler's TCL editor is easy and fast. The editor shows sample boilerplate code when you choose language as TCL and start coding.
OneCompiler's TCL online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample TCL program which takes name as input and prints hello message with your name.
set name [gets stdin]
puts "Hello $name"
Tool Command Language(TCL) is a general purpose scripting language which is commonly used for GUIs and for testing. Everything is by default string in TCL. It was created by John Osterhout in 1989.
Variable is a identifier which is used to hold the value. set
is used to create variables.
set name onecompiler
When ever you want to perform a set of operations based on a condition IF-ELSE is used.
if(conditional-expression) {
#code
} else {
#code
}
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
Switch is an alternative to If-Else-If ladder.
switch(conditional-expression) {
value1 {
# code
}
value1 {
# code
}
...
default {
# code
}
For loop is used to iterate a set of statements based on a condition.
for{start}{test}{next}{
# code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition) {
# code
}
Array is a collection of similar data which is stored in continuous memory addresses. Array values can be fetched using index. Index starts from 0 to size-1.
set ArrayName(Index) value
Procedure is a sub-routine which contains set of statements. Uusually procedures are required when multiple calls are made to same set of statements. Procedures increases re-usuability and modularity.
proc procedureName {arguments} {
# code
}