on 04-16-2012 2:51 PM
Hello Everybody,
I am new to this community and have started to make a connection between Excel and SAP. I want to run ME2M command in Excel from SAP but I get an error in vba which says:
Run time Error '1001'
SAP remote function call when I clikc on help bottun in VBA it gives me this message:
Cannot find the wdtfuncs.hlp file. Do you want to try to find it yourself?
I do not nnow how to get rid of this error. Can s.omeone help me? Thanks
This is the code I use :
Public Sub rfc_call_transaction()
Dim Functions As Object
Dim RfcCallTransaction As Object
Dim Messages As Object
Dim BdcTable As Object
'On error resume next
' Create the Function control (that is, the high-level Functions collection):
Set Functions = CreateObject("SAP.Functions")
' Set the rest of Connection object values:
Functions.Connection.System = "00"
Functions.Connection.client = "20"
Functions.Connection.user = "123456"
Functions.Connection.Password = "123"
Functions.Connection.Language = "EN"
'sapConnection.ApplicationServer = "7100.1.5.1033" 'TSP
'sapConnection.SystemNumber = "00"
'sapConnection.codepage = "1100"
If Functions.Connection.Logon(0, False) <> True Then
Exit Sub
End If
' Retrieve the Function object (the Connection object must be set up before Function objects can be created):
Set RfcCallTransaction = Functions.Add("RFC_CALL_TRANSACTION")
' Set the export parameters (here, get all customers whose names start with J):
RfcCallTransaction.exports("TRANCODE") = "ME2M"
RfcCallTransaction.exports("UPDMODE") = "S"
Set BdcTable = RfcCallTransaction.Tables("BDCTABLE")
' Set the tables parameter and add the data for the call transaction
add_bdcdata BdcTable, "SAPLSETB", "230", "X", "", ""
add_bdcdata BdcTable, "", "", "", "BDC_CURSOR", "DATABROWSE-TABLENAME"
add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "=ANZE"
add_bdcdata BdcTable, "", "", "", "DATABROWSE-TABLENAME", "KNA1"
add_bdcdata BdcTable, "/1BCDWB/DBKNA1", "1000", "X", "", ""
add_bdcdata BdcTable, "", "", "", "BDC_CURSOR", "MAX_SEL"
add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "=ONLI"
add_bdcdata BdcTable, "", "", "", "LIST_BRE", "250"
add_bdcdata BdcTable, "", "", "", "MAX_SEL", "5"
add_bdcdata BdcTable, "SAPMSSY0", "120", "X", "", ""
add_bdcdata BdcTable, "", "", "", "BDC_CURSOR", "01/02/1962"
add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "=%EX"
add_bdcdata BdcTable, "/1BCDWB/DBKNA1", "1000", "X", "", ""
add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "/EE"
add_bdcdata BdcTable, "", "", "", "BDC_CURSOR", "I1-LOW"
add_bdcdata BdcTable, "SAPLSETB", "230", "X", "", ""
add_bdcdata BdcTable, "", "", "", "BDC_OKCODE", "/EBACK"
add_bdcdata BdcTable, "", "", "", "BDC_CURSOR", "DATABROWSE-TABLENAME"
' Call the function (if the result is false, then display a message):
If RfcCallTransaction.Call = True Then
Set Messages = RfcCallTransaction.imports("MESSG")
MsgBox Messages.Value("MSGTX")
Else
MsgBox " Call Failed! error: " ' + GetCustomers.Exception
End If
Functions.Connection.Logoff
End Sub
Hi,
What is the SAP Version that you're working with. FM RFC_CALL_TRANSACTION does not exist since 4.6c (from what i know)
Andrei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What you told me is the SAP GUI version. I wanted to know if the SAP system you're trying to connect to is ECC or R/3 4.6 or 4.7
I am not sure but i think the problem is because the FM does not exist in the SAP System.
If you can access the SAP system try to see if FM RFC_CALL_TRANSACTION exists (tcode se37).
If it does not exist use FM RFC_CALL_TRANSACTION_USING.
For RFC_CALL_TRANSACTION_USING you have the following parameters:
IMPORT:
EXPORT
TABLES
Also i don't see where you set the Hostname parameter. Did you not set it or is it hidden on this forum post?
BR,
Andrei Sosea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.