VBA: Call FM SAPWL_STATREC_READ_REMOTE failed

20 pts.
Tags:
Microsoft Excel
SAP
VBA
Hi Experts, We monitor the response time of different SAP and Customer programs before and after any release change. We use the workload statistics in transaction STAD and export the data into Excel manually. We would to automate this process by using Excel VBA Script and download the workload statistics from SAP. We found that the function module "SAPWL_STATREC_READ_REMOTE" gives us the best results we need. Our problem is that we get an export error before executing/calling the RFC (see logfile). My questions: - How can we define Export and Import Parameters for this FM? - And if FM succeeds how to use the results in import table? Notes: In SAP there is no short dumps and no entries in syslog found! Best Thanks for your suggestion!
---------------------------------------->START VBA CODE<-
Sub call_sap_rf()

Dim R3 As Object
Dim R3Func As Object
Dim returnValue As Boolean
Dim impParam1 As Object, impParam2 As Object, impParam3 As Object, impParam4 As Object, impParam5 As Object
Dim impParam6 As Object, impParam7 As Object, impParam8 As Object, impParam9 As Object, impParam10 As Object
Dim impParam11 As Object, impParam12 As Object, impParam13 As Object, impParam14 As Object, impParam15 As Object
Dim impParam16 As Object, impParam17 As Object, impParam18 As Object, impParam19 As Object, impParam20 As Object
Dim impParam21 As Object

Set R3 = CreateObject("SAP.Functions")
R3.LogLevel = 9
R3.LogFileName = "trace.txt"

With R3.Connection
.System = "SRD"
.ApplicationServer = "demo01.box"
.SystemNumber = "00"
.client = "000"
.Language = "EN"
.User = "basis"
.Password = "Basis_1"
.CodePage = "1100"
End With

If R3.Connection.Logon(0, True) <> True Then
End
Else
' SAP connection is activ => call function module
Set R3Func = R3.Add("SAPWL_STATREC_READ_REMOTE")

' Export only not optional parameters
R3Func.Exports("READ_START_DATE") = "17082016"
R3Func.Exports("READ_START_TIME") = "00:00:00"
R3Func.Exports("READ_END_DATE") = "17082016"
R3Func.Exports("READ_END_TIME") = "00:10:00"

returnValue = R3Func.Call
If returnValue = False Then
MsgBox ("ERROR: " & R3Func.Exception)
' script aborts always here without exception messages!
Else
' R3Func return ok!
Set impParam1 = R3Func.Imports("RECORDS_READ")
Set impParam2 = R3Func.Imports("EOF_REACHED")
Set impParam3 = R3Func.Imports("NORMAL_RECORDS")
Set impParam4 = R3Func.Imports("BTC_STEP_RECORDS")
Set impParam5 = R3Func.Imports("TABLE_RECORDS")
Set impParam6 = R3Func.Imports("RFC_CLIENT_RECORDS")
Set impParam7 = R3Func.Imports("RFC_SERVER_RECORDS")
Set impParam8 = R3Func.Imports("RFC_CLIENT_DEST_RECORDS")
Set impParam9 = R3Func.Imports("RFC_SERVER_DEST_RECORDS")
Set impParam10 = R3Func.Imports("RFC_TIMEINT_RECORDS")
Set impParam11 = R3Func.Imports("SPOOL_PRINT_RECORDS")
Set impParam12 = R3Func.Imports("SPOOL_ACTIVITY_RECORDS")
Set impParam13 = R3Func.Imports("DB_PROCEDURE_RECORDS")
Set impParam14 = R3Func.Imports("ADM_MESSAGE_RECORDS")
Set impParam15 = R3Func.Imports("CLIENT_INFO_RECORDS")
Set impParam16 = R3Func.Imports("HTTP_RECORDS")
Set impParam17 = R3Func.Imports("HTTP_CLIENT_RECORDS")
Set impParam18 = R3Func.Imports("HTTP_CLIENT_DEST_RECS")
Set impParam19 = R3Func.Imports("NORM_SUBRECORD_INDEX")
Set impParam20 = R3Func.Imports("NORMAL_RECORDS_KB")
Set impParam21 = R3Func.Imports("BTC_STEP_RECORDS_KB")

'continue with code
'...

End If
End If

R3.Connection.Logoff

End Sub
---------------------------------------->END VBA CODE<-
---------------------------------------->START LOGFILE<-
18.08.116  15:40:34.923 SAP Functions OCX Log file opened (trace.txt)
18.08.116  15:40:49.810 FunctionsCtrl::AddItem (SAPWL_STATREC_READ_REMOTE)
18.08.116  15:40:49.810 FunctionsCtrl::SetupConnection.
18.08.116  15:40:49.810 FunctionsCtrl::SetupConnection found R/3 release731
18.08.116  15:40:49.810 * FunctionsCtrl::CreateDefFunctions() Starting ...
18.08.116  15:40:49.810 CreateDefFunctions: Making tables.
18.08.116  15:40:49.810 MakeTable (pn=FIELDS tn=RFC_FIELDS)
18.08.116  15:40:49.951 MakeTable (pn=PARAMS tn=RFC_FUNINT)
18.08.116  15:40:50.34 * FunctionsCtrl::CreateDefFunctions() - Finished.
18.08.116  15:40:50.35 Packing Parameters for RFC_SYSTEM_INFO
Packing structure RFCSI_EXPORT.
18.08.116  15:40:50.35 *** Calling  RFC Function 'RFC_SYSTEM_INFO'
18.08.116  15:40:50.73 RFC CALL status = RFC_OK
18.08.116  15:40:50.73 Importing 1 parameters:
Structure: Type= 'RFC_FUNINT'.
18.08.116  15:40:50.73 Function call finished.
Host Charset Type is Non Unicode.
Host Integer Type is small.
PARAMETER: 'ADM_MESSAGE_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLADMRECS'
Creating Structure table name = SAPWLADMRECS parameter = ADM_MESSAGE_RECORDS
18.08.116  15:40:50.239 Structure::Create name= ADM_MESSAGE_RECORDS parameter name = ADM_MESSAGE_RECORDS
PARAMETER: 'BTC_STEP_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLBTCRECS'
Creating Structure table name = SAPWLBTCRECS parameter = BTC_STEP_RECORDS
18.08.116  15:40:50.387 Structure::Create name= BTC_STEP_RECORDS parameter name = BTC_STEP_RECORDS
PARAMETER: 'BTC_STEP_RECORDS_KB'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLBTCRECS_KB'
Creating Structure table name = SAPWLBTCRECS_KB parameter = BTC_STEP_RECORDS_KB
18.08.116  15:40:50.535 Structure::Create name= BTC_STEP_RECORDS_KB parameter name = BTC_STEP_RECORDS_KB
PARAMETER: 'CLIENT_INFO_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLCIFRECS'
Creating Structure table name = SAPWLCIFRECS parameter = CLIENT_INFO_RECORDS
18.08.116  15:40:50.667 Structure::Create name= CLIENT_INFO_RECORDS parameter name = CLIENT_INFO_RECORDS
PARAMETER: 'DB_PROCEDURE_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLDBPROCRECS'
Creating Structure table name = SAPWLDBPROCRECS parameter = DB_PROCEDURE_RECORDS
18.08.116  15:40:50.788 Structure::Create name= DB_PROCEDURE_RECORDS parameter name = DB_PROCEDURE_RECORDS
PARAMETER: 'EOF_REACHED'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLPFLAG'
Creating exporting Parameter length = 1 decimal length = 0 parameter = EOF_REACHED parameter type = SAPWLPFLAG exID = C text =
PARAMETER: 'HTTP_CLIENT_DEST_RECS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLHTTPCLDRECS'
Creating Structure table name = SAPWLHTTPCLDRECS parameter = HTTP_CLIENT_DEST_RECS
18.08.116  15:40:50.913 Structure::Create name= HTTP_CLIENT_DEST_RECS parameter name = HTTP_CLIENT_DEST_RECS
PARAMETER: 'HTTP_CLIENT_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLHTTPCLRECS'
Creating Structure table name = SAPWLHTTPCLRECS parameter = HTTP_CLIENT_RECORDS
18.08.116  15:40:51.36 Structure::Create name= HTTP_CLIENT_RECORDS parameter name = HTTP_CLIENT_RECORDS
PARAMETER: 'HTTP_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLHTPRECS'
Creating Structure table name = SAPWLHTPRECS parameter = HTTP_RECORDS
18.08.116  15:40:51.159 Structure::Create name= HTTP_RECORDS parameter name = HTTP_RECORDS
PARAMETER: 'NORMAL_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLNORMRECS'
Creating Structure table name = SAPWLNORMRECS parameter = NORMAL_RECORDS
18.08.116  15:40:51.307 Structure::Create name= NORMAL_RECORDS parameter name = NORMAL_RECORDS
PARAMETER: 'NORMAL_RECORDS_KB'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLNORMRECS_KB'
Creating Structure table name = SAPWLNORMRECS_KB parameter = NORMAL_RECORDS_KB
18.08.116  15:40:51.457 Structure::Create name= NORMAL_RECORDS_KB parameter name = NORMAL_RECORDS_KB
PARAMETER: 'NORM_SUBRECORD_INDEX'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLNORMSUBINDX'
Creating Structure table name = SAPWLNORMSUBINDX parameter = NORM_SUBRECORD_INDEX
18.08.116  15:40:51.590 Structure::Create name= NORM_SUBRECORD_INDEX parameter name = NORM_SUBRECORD_INDEX
PARAMETER: 'RECORDS_READ'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLSRIRN'
Creating exporting Parameter length = 4 decimal length = 0 parameter = RECORDS_READ parameter type = SAPWLSRIRN exID = I text = Number of records read
PARAMETER: 'RFC_CLIENT_DEST_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLRFCCLDRECS'
Creating Structure table name = SAPWLRFCCLDRECS parameter = RFC_CLIENT_DEST_RECORDS
18.08.116  15:40:51.718 Structure::Create name= RFC_CLIENT_DEST_RECORDS parameter name = RFC_CLIENT_DEST_RECORDS
PARAMETER: 'RFC_CLIENT_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLRFCCLRECS'
Creating Structure table name = SAPWLRFCCLRECS parameter = RFC_CLIENT_RECORDS
18.08.116  15:40:51.845 Structure::Create name= RFC_CLIENT_RECORDS parameter name = RFC_CLIENT_RECORDS
PARAMETER: 'RFC_SERVER_DEST_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLRFCSVDRECS'
Creating Structure table name = SAPWLRFCSVDRECS parameter = RFC_SERVER_DEST_RECORDS
18.08.116  15:40:51.973 Structure::Create name= RFC_SERVER_DEST_RECORDS parameter name = RFC_SERVER_DEST_RECORDS
PARAMETER: 'RFC_SERVER_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLRFCSVRECS'
Creating Structure table name = SAPWLRFCSVRECS parameter = RFC_SERVER_RECORDS
18.08.116  15:40:52.109 Structure::Create name= RFC_SERVER_RECORDS parameter name = RFC_SERVER_RECORDS
PARAMETER: 'RFC_TIMEINT_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLRFCTMINRECS'
Creating Structure table name = SAPWLRFCTMINRECS parameter = RFC_TIMEINT_RECORDS
18.08.116  15:40:52.235 Structure::Create name= RFC_TIMEINT_RECORDS parameter name = RFC_TIMEINT_RECORDS
PARAMETER: 'SPOOL_ACTIVITY_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLSPOACRECS'
Creating Structure table name = SAPWLSPOACRECS parameter = SPOOL_ACTIVITY_RECORDS
18.08.116  15:40:52.356 Structure::Create name= SPOOL_ACTIVITY_RECORDS parameter name = SPOOL_ACTIVITY_RECORDS
PARAMETER: 'SPOOL_PRINT_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLSPOPRECS'
Creating Structure table name = SAPWLSPOPRECS parameter = SPOOL_PRINT_RECORDS
18.08.116  15:40:52.486 Structure::Create name= SPOOL_PRINT_RECORDS parameter name = SPOOL_PRINT_RECORDS
PARAMETER: 'TABLE_RECORDS'; PARAMCLASS: 'E'
FIELDNAME: ' '; TABNAME: 'SAPWLTABRECS'
Creating Structure table name = SAPWLTABRECS parameter = TABLE_RECORDS
18.08.116  15:40:52.624 Structure::Create name= TABLE_RECORDS parameter name = TABLE_RECORDS
PARAMETER: 'NO_BUFFER_FLUSH'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SAPWLPFLAG'
Creating importing Parameter length = 1 decimal length = 0 parameter = NO_BUFFER_FLUSH parameter type = SAPWLPFLAG exID = C text =
PARAMETER: 'NO_OF_RECORDS'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SAPWLSRIRN'
Creating importing Parameter length = 4 decimal length = 0 parameter = NO_OF_RECORDS parameter type = SAPWLSRIRN exID = I text =
PARAMETER: 'READ_CLIENT'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SAPWLCLINT'
Creating importing Parameter length = 3 decimal length = 0 parameter = READ_CLIENT parameter type = SAPWLCLINT exID = C text =
PARAMETER: 'READ_END_DATE'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SYDATUM'
Creating importing Parameter length = 8 decimal length = 0 parameter = READ_END_DATE parameter type = SYDATUM exID = D text =
PARAMETER: 'READ_END_TIME'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SYUZEIT'
Creating importing Parameter length = 6 decimal length = 0 parameter = READ_END_TIME parameter type = SYUZEIT exID = T text =
PARAMETER: 'READ_EXCLUDE_USERNAME'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'XUBNAME'
Creating importing Parameter length = 12 decimal length = 0 parameter = READ_EXCLUDE_USERNAME parameter type = XUBNAME exID = C text =
PARAMETER: 'READ_START_DATE'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SYDATUM'
Creating importing Parameter length = 8 decimal length = 0 parameter = READ_START_DATE parameter type = SYDATUM exID = D text =
PARAMETER: 'READ_START_TIME'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SYUZEIT'
Creating importing Parameter length = 6 decimal length = 0 parameter = READ_START_TIME parameter type = SYUZEIT exID = T text =
PARAMETER: 'READ_USERNAME'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'XUBNAME'
Creating importing Parameter length = 12 decimal length = 0 parameter = READ_USERNAME parameter type = XUBNAME exID = C text =
PARAMETER: 'READ_WORKPROCESS'; PARAMCLASS: 'I'
FIELDNAME: ' '; TABNAME: 'SAPWLPWPNO'
Creating importing Parameter length = 2 decimal length = 0 parameter = READ_WORKPROCESS parameter type = SAPWLPWPNO exID = X text =
PARAMETER: 'ERROR_IN_READING_FUNCTION'; PARAMCLASS: 'X'
18.08.116  15:40:52.625 Function has exception: ERROR_IN_READING_FUNCTION
PARAMETER: 'FILE_PROBLEMS'; PARAMCLASS: 'X'
18.08.116  15:40:52.626 Function has exception: FILE_PROBLEMS
PARAMETER: 'WRONG_PARAMETER_COMBINATION'; PARAMCLASS: 'X'
18.08.116  15:40:52.626 Function has exception: WRONG_PARAMETER_COMBINATION
FunctionsCtrl::AddItem succeeds: SAPWL_STATREC_READ_REMOTE
18.08.116  15:40:55.564 Packing Parameters for SAPWL_STATREC_READ_REMOTE
Packing structure ADM_MESSAGE_RECORDS.
Packing structure BTC_STEP_RECORDS.
Packing structure BTC_STEP_RECORDS_KB.
Packing structure CLIENT_INFO_RECORDS.
Packing structure DB_PROCEDURE_RECORDS.
Packing Parameter EOF_REACHED.
Packing structure HTTP_CLIENT_DEST_RECS.
Packing structure HTTP_CLIENT_RECORDS.
Packing structure HTTP_RECORDS.
Packing structure NORMAL_RECORDS.
Packing structure NORMAL_RECORDS_KB.
Packing structure NORM_SUBRECORD_INDEX.
Packing Parameter RECORDS_READ.
Packing structure RFC_CLIENT_DEST_RECORDS.
Packing structure RFC_CLIENT_RECORDS.
Packing structure RFC_SERVER_DEST_RECORDS.
Packing structure RFC_SERVER_RECORDS.
Packing structure RFC_TIMEINT_RECORDS.
Packing structure SPOOL_ACTIVITY_RECORDS.
Packing structure SPOOL_PRINT_RECORDS.
Packing structure TABLE_RECORDS.
Packing Parameter NO_BUFFER_FLUSH.
Parameter NO_BUFFER_FLUSH (no pass): Not packed.
Packing Parameter NO_OF_RECORDS.
Parameter NO_OF_RECORDS (no pass): Not packed.
Packing Parameter READ_CLIENT.
Parameter READ_CLIENT (no pass): Not packed.
Packing Parameter READ_END_DATE.
Packing Parameter READ_END_TIME.
Packing Parameter READ_EXCLUDE_USERNAME.
Parameter READ_EXCLUDE_USERNAME (no pass): Not packed.
Packing Parameter READ_START_DATE.
Packing Parameter READ_START_TIME.
Packing Parameter READ_USERNAME.
Parameter READ_USERNAME (no pass): Not packed.
Packing Parameter READ_WORKPROCESS.
Parameter READ_WORKPROCESS (no pass): Not packed.
18.08.116  15:40:55.564 *** Calling  RFC Function 'SAPWL_STATREC_READ_REMOTE'
18.08.116  15:40:55.691 RFC CALL status =
18.08.116  15:40:55.691 RFC Error: SYSTEM_FAILURE
-Status:EXCEPTION SYSTEM_FAILURE RAISED
-Message:EXCEPTION SYSTEM_FAILURE RAISED
-Internal Status:
18.08.116  15:40:55.691 Function call finished.
---------------------------------------->END LOGFILE<-
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

further info in dev_rfc:
**** ERROR file opened at 20160818 154055 Mitteleuropäische Sommerzeit, SAP-REL 730,0,518 RFC-VER 3 1456876 MT-SL
T:10036 Error in program ‘EXCEL’: <* RfcReceive [5] : returns 19:RFC_INVALID_PARAMETER
T:10036 Error in program ‘EXCEL’: <* RfcCallReceive [5] : returns 19:RFC_INVALID_PARAMETER

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: