T4S4  19.1 C8408 A23185
Teamcenter Gateway for SAP S/4HANA API Reference
LOG file ATTACHMENTS handling of

Functions

 tpco_getListOfValues
 This function returns all occurring values for a certain key (without duplicates) as well as the number of absolute occurrences for each found value. More...
 
 tpco_getLogIndex
 This function returns the key attribute list of a specified log channel, matching the given patterns for key and value. More...
 
 tpco_removeLogIndex
 This function removes an attribute entry from the specified log channel. More...
 
 tpco_searchGlobLogIndex
 This function simply searches globally for all terms defined in searchlist within the whole log index. It returns a list of matching log index entries. More...
 
 tpco_searchLogIndex
 This function can search for several specific keys and values at once. It returns a list of matching log index entries, which can be used to get the corresponding log files. If the key is defined as “*” and the value is defined as “*”, all entries are returned. More...
 
 tpco_setLogIndex
 This function adds an attribute entry (key and value) to the index of the specified log channel. More...
 
 tpco_udpReadAttachment
 This function reads a logfile attachment. More...
 
 tpco_udpWriteAttachment
 This function writes a logfile attachment. More...
 
 tpco_udpWriteRemoteAttachment2
 This function writes a remote logfile attachment. More...
 

Detailed Description

Function Documentation

◆ tpco_getListOfValues()

tpco_getListOfValues

This function returns all occurring values for a certain key (without duplicates) as well as the number of absolute occurrences for each found value.

Parameters
keyAttribute key for which all existing values and number of occurrences should be returned.
rrangeThe result range of the corresponding searchresult (default [list 0 9])
rsortdsort direction of the result list. The sortkey is absolute number of occurrences.
loglistprevious result of any search to be searched, if the loglist is not provided, all index entries will be searched.
Returns
TCL-list {<total # of values>

<occurrences>

<occurrences> ..}

1  tpco_getListOfValues -key transaction -rsortd decreasing
2 
3 output:
4 9 CHANGE_HID 278 MODIFY 278 DELETE 278 EXPORT 278 CHANGE 278 REMOVE 278 KILL 278 READ 277 WRITE 277

◆ tpco_getLogIndex()

tpco_getLogIndex

This function returns the key attribute list of a specified log channel, matching the given patterns for key and value.

Parameters
logchannelstring of the log channel
keypatternpattern to match the key of the attribute as string
valuepatternpattern to match the value of the attribute
Returns
Tcl Dict or {ERROR MESSAGE}
<KEY>
1 foreach {key value} [tpco_getLogIndex -logchannel /tmp/test/default.log -keypattern * -valuepattern *] {puts "$key => $value"}
2 
3 output:
4 ITEMID => 47110815
5 LOGNAME => /tmp/test/default.log
6 CTIME => 1422864704
7 MTIME => 1422864704

◆ tpco_removeLogIndex()

tpco_removeLogIndex

This function removes an attribute entry from the specified log channel.

Parameters
logchannelstring of the log channel
keythe name for the key
Returns
none

◆ tpco_searchGlobLogIndex()

tpco_searchGlobLogIndex

This function simply searches globally for all terms defined in searchlist within the whole log index. It returns a list of matching log index entries.

Parameters
searchlistList of search terms as strings
rrangeThe result range of the corresponding searchresult (default [list 0 9])
rsortsort key and direction for the searchresult. (default CTIME decreasing)
linkthe logical link between the search patterns (default OR)
casedefines whether this search should be case-sensitive or not
true: to search case-sensitive
false: to ignore any case (DEFAULT)
keylovAttribute key for which all existing values and number of occurrences should be returned.
klovrangeThe result range of the corresponding result for keylov (default [list 0 9])
Returns
TCL-list {<total # of hits> <log channel>=""> <log channel>=""> ...} - without KeyOfValue if the param keylov is set then the last element of the result list is the result of the KeyOfValue function TCL-list {<total # of hits> <log channel>=""> <log channel>=""> ... {<key of value result}} - with KeyOfValue
1 foreach index [tpco_searchGlobLogIndex -searchlist [list BOM] -rrange [list 0 5] -rsort [list CTIME decreasing] -case true -link OR] {puts $index}
2 
3 output:
4 120
5 /trans/20150126/023454510266_QHT!9XhaaaNQCAAAAAAAAAAAAA_DIR.log
6 /trans/20150126/082460978229_QHT\]9XhweweNQCAAAAAAAAAAAAA_DIR.log
7 /trans/20150126/119506296832_QHT,9XhWWNQCAAAAAAAAAAAAA_DIR.log
8 /trans/20150126/086874764172_QHTV9XhFGNQCAAAAAAAAAAAAA_DIR.log
9 /trans/20150126/077811290638_QHT^9XhndnsdNQCAAAAAAAAAAAAA_DIR.log

◆ tpco_searchLogIndex()

tpco_searchLogIndex

This function can search for several specific keys and values at once. It returns a list of matching log index entries, which can be used to get the corresponding log files. If the key is defined as “*” and the value is defined as “*”, all entries are returned.

Parameters
patterntcl dictionary containing any number of key-value-pairs, where each value con-sists of a list, where the first entry represents the submitted data type and the second value contains the searched value pattern.
e.g. [ <key1> {<type1> <valuepattern1>} <key2> {<type2> <valuepattern2>} …]
key pattern to match the key of an attribute as string
type data type of the valuepattern (STR - string, STRLIST – a list of strings, UINTRNAGE – a range of interger values e.g. [list 4711 9192])
valuepattern: pattern to be searched for in the according key, needs to match the re-quirements of the previously defined data type.
rrangeThe result range of the corresponding searchresult (default [list 0 9])
rsortsort key and direction for the searchresult. (default CTIME decreasing)
linkthe logical link between the search patterns (default OR)
casedefines whether this search should be case-sensitive or no
true: to search case-sensitive
false: to ignore any case (DEFAULT)
keylovAttribute key for which all existing values and number of occurrences should be returned.
klovrangeThe result range of the corresponding result for keylov (default [list 0 9])
Returns
TCL-list {<total # of hits> <log channel>=""> <log channel>=""> ...} - without KeyOfValue if the param keylov is set then the last element of the result list is the result of the KeyOfValue function TCL-list {<total # of hits> <log channel>=""> <log channel>=""> ... {<key of="" value="" result>="">}} - with KeyOfValue
1 tpco_searchLogIndex -pattern [list [list ITEMID [list STR *1108*]] [list * [list STR BOM]]]
2 
3 output:
4 121 /tmp/test/default.log /trans/20150126/069677646163_QHTK9XhwdnsdNQCAAAAAAAAAAAAA_DIR.log {/trans/20150126/074506290720_QHT\"9XhASNQCAAAAAAAAAAAAA_DIR.log} /trans/20150126/038192107819_QHT69XhRRRNQCAAAAAAAAAAAAA_DIR.log /trans/20150126/102872432881_QHTM9XhndnsdNQCAAAAAAAAAAAAA_DIR.log {/trans/20150126/065757690448_QHT\"9XhFGNQCAAAAAAAAAAAAA_DIR.log} /trans/20150126/025663203363_QHTM9XhWWNQCAAAAAAAAAAAAA_DIR.log /trans/20150126/117993730389_QHT19XhweweNQCAAAAAAAAAAAAA_DIR.log /trans/20150126/106310332126_QHTO9XhaaaNQCAAAAAAAAAAAAA_DIR.log

◆ tpco_setLogIndex()

tpco_setLogIndex

This function adds an attribute entry (key and value) to the index of the specified log channel.

Parameters
logchannelstring of the log channel
keythe name for the key
valuevalue for the previously defined key to be set
modeoverwrite: The data will be overwritten (default setting)
exclusive: if this entry has been defined before nothing will happen, else it will be exclusively set once to the index
append: the data will be appended, regardless if the entry does already exist or not
Returns
none
1 tpco_setLogIndex -logchannel /tmp/test/default.log -key ITEMID -value 47110815 -mode overwrite

Referenced by T4X::TRANSLOG::startTransactionLog(), T4X::TRANSLOG::stopTransactionLog(), and T4X::BATCHJOB::TOOLBOX::writeTcUser2LogIndex().

◆ tpco_udpReadAttachment()

tpco_udpReadAttachment

This function reads a logfile attachment.

tpco_udpReadAttachment works only in the BGS enviroment. For external usage, use the ::LOGSRV::readAttachment function.

Parameters
idthe attachment ID
Returns
Tcl list {SUCCESS {MTYPE NAME} DATA} or {ERROR MESSAGE}
1 ::ProxyGen::createClientFor "BGS" 10 0 0 ::LOGSRV::readAttachment ::_readat
2 puts [_readat 50055204000000A3]
3 
4 output:
5 SUCCESS {text/xml XML-TEST} {<testtag>hello attachment</testtag>}

◆ tpco_udpWriteAttachment()

tpco_udpWriteAttachment

This function writes a logfile attachment.

tpco_udpWriteAttachment works only in the BGS enviroment. For external usage, use the tpco_udpWriteRemoteAttachment2 function. The download URL for the attachment is :: http(s)://<bgs-server>:<port>/dcx/attach?<attachment-id>.

Parameters
namename of the attachment
mtypeMIME type of the attachment
datacontent of the attachment
Returns
Tcl list {SUCCESS ID} or {ERROR MESSAGE}
To convert the attachment ID to an HTTP link, use TPHAP::setAttaLink.

◆ tpco_udpWriteRemoteAttachment2()

tpco_udpWriteRemoteAttachment2

This function writes a remote logfile attachment.

The download URL for the attachment is :: http(s)://<bgs-server>:<port>/dcx/attach?<attachment-id>.

Parameters
mtypeMIME type of the attachment
namename of the attachment
datacontent of the attachment
Returns
Tcl list ID or {ERROR MESSAGE}
To convert the attachment ID to an HTTP link, use TPHAP::setAttaLink.
1 set xml "<testtag>hello attachment</testtag>"
2 puts [tpco_udpWriteRemoteAttachment2 "text/xml" "XML-TEST" $xml]
3 
4 output:
5 50055204000000A3

Referenced by T4X::CORE::writeLogLineWithAttachment2BGS().