on 08-30-2013 4:38 AM
Hi all,
Let say the script
session.Info().Transaction <- this gives you the transaction code. How about name?
Eg. SU3 - Maintain User Own Data
Possible? I search through the API could not find any.
Cheers
Sato
Hello Eric,
as far as I know is the text of the transaction not part of the SAP GUI and I don't know also a method to get them.
Here is another way to get the text direct from the table TSTCT of the transaction, inside an SAP GUI Script:
'-Begin-----------------------------------------------------------------
'-Directives----------------------------------------------------------
Option Explicit
'-Constants-----------------------------------------------------------
Const RFC_OK = 0
'-Function GetTACText-------------------------------------------------
Function GetTACText(TAC, Language)
'-Variables-------------------------------------------------------
Dim SAP, hRFC, rc, hFuncDesc, hFunc, hTable, RowCount, i, Row
Dim hRow, charBuffer, charField
Set SAP = CreateObject("COMNWRFC")
If IsObject(SAP) Then
hRFC = SAP.RfcOpenConnection("ASHOST=ABAP, SYSNR=00, " & _
"CLIENT=001, USER=BCUSER")
If hRFC Then
hFuncDesc = SAP.RfcGetFunctionDesc(hRFC, "RFC_READ_TABLE")
If hFuncDesc Then
hFunc = SAP.RfcCreateFunction(hFuncDesc)
If hFunc Then
rc = SAP.RfcSetChars(hFunc, "QUERY_TABLE", "TSTCT")
rc = SAP.RfcSetChars(hFunc, "DELIMITER", "~")
If SAP.RfcGetTable(hFunc, "OPTIONS", hTable) = RFC_OK Then
hRow = SAP.RfcAppendNewRow(hTable)
rc = SAP.RfcSetChars(hRow, "TEXT", _
"TCODE = '" & TAC & "' AND SPRSL = '" & Language & "'")
End If
If SAP.RfcInvoke(hRFC, hFunc) = RFC_OK Then
If SAP.RfcGetTable(hFunc, "DATA", hTable) = RFC_OK Then
rc = SAP.RfcGetRowCount(hTable, RowCount)
rc = SAP.RfcMoveToFirstRow(hTable)
For i = 1 To RowCount
Row = SAP.RfcGetCurrentRow(hTable)
rc = SAP.RfcGetChars(Row, "WA", charBuffer, 512)
charField = Split(charBuffer, "~")
GetTACText = charField(2)
Next
End If
End If
rc = SAP.RfcDestroyFunction(hFunc)
End If
End If
rc = SAP.RfcCloseConnection(hRFC)
End If
Set SAP = Nothing
End If
End Function
'-Main----------------------------------------------------------------
MsgBox "TACText for SU03 = " & GetTACText("SU03", "E")
'-End-------------------------------------------------------------------
The example shows how to get the transaction text from SU03 in English language.
I use CCo to get an access to the table.
Cheers
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.