on 01-27-2010 10:15 AM
Hi,
I'm trying to call an RFC enabled function module from excel. My code in VB is:
Set theFunc = sapConn.Add("ZGETREVENUE")
theFunc.Exports("VBELN") = strSalesOrder
ResultsOk = theFunc.imports("OK_CODE")
Set objSalesOrder = theFunc.Tables("TBL_RETURN")
The table TBL_RETURN is coming back fine but the return code OK_CODE is always 0. Can someone point out what I'm doing wrong?
Thanks,
Gill
The guy who wrote it fixed the code. He wasn't calling the RFC before checking the return code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Gill
Try calling theFunc.Call function before calling theFunc.imports.
theFunc.Call will execute the function module.
Regards,
Dinesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry Gill, Dinesh is right.
The call method returns a true/false condition (true indicates a correct execution)
The code should look something like
Set theFunc = sapConn.Add("ZGETREVENUE")
theFunc.Exports("VBELN") = strSalesOrder
If theFunc.Call Then
ResultsOk = theFunc.imports("OK_CODE")
Set objSalesOrder = theFunc.Tables("TBL_RETURN")
else
msgbox "Call error"
end if
Cheers,
Michael
Hello Gill, can you post your RFC's code? There doesn't seem to be anything wrong with your VB code
Cheers
Michael
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.