Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with RFC call from VBA

Status
Not open for further replies.

pkailas

Programmer
Jun 10, 2002
555
US
I have a client that needs to have me query their SAP system from within an application that uses VBA. I have successfully written the portion that logs onto their SAP. I just have no experience with the syntax to use their custom RFC that they have provided me. I only know this much.

the import parameters and order:

TEMPLATE
STRAS
PSTLZ
PFACH

Then there are 2 returned values

MESSAGE
LIFNR

Here's what I have so far.

Dim sapConnection As Object 'Connection object
Dim theFunc As Object 'Function object
Dim functionCtrl As SAPFunctions

Set functionCtrl = New SAPFunctions
Set sapConnection = functionCtrl.Connection

sapConnection.ApplicationServer = "x.x.x.x"
sapConnection.client = "###"
sapConnection.Language = "EN"
sapConnection.user = "xxxxx"
sapConnection.Password = "xxxxx"

If sapConnection.logon(0, True) <> True Then
MsgBox "failed"
exit sub
end if

Set theFunc = functionCtrl.Add("Z_NK_RFC_VENDOR_LOOKUP")


From here I'm completely lost. How do I send the field values that I have such as the TEMPLATE or (PSTLZ and PFACH).

What this query is to do is return a vendor number and a message such as (Valid Vendor) when sent either a Document Type or a PO Box and Zipcode.

Thanks in advance.

_______
I love small animals, especially with a good brown gravy....
 
Would've thought this would be dependant on the SAP / ABAP program syntax - not really a VBA question as VBA will not define the syntax that needs to be used...

Looks to be some useful syntax examples using:

pass parameters to a control function in SAP

in google...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top