2012 May 15 8:33 PM
Hi, anyone has a sample code to call a custom RFC that returns table structure?
The RFC expect parameters to pinpoint the record and return it in a structure.
*----
*Local Interface:
'FUNCTION zfori_web_pgto_parceiros.
'*"----------------------------------------------------------------------
'*"*"Interface local:
'*" IMPORTING
'*" VALUE(I_LIFNR) TYPE LIFNR
'*" VALUE(I_DATAINICIO) TYPE DATE OPTIONAL
'*" VALUE(I_DATAFIM) TYPE DATE OPTIONAL
'*" TABLES
'*" T_PAGTO_PARCEIRO STRUCTURE ZSTORI_PAGTO_PARCEIRO_WEB
...
...
etc
-- final function
t_pagto_parceiro[] = t_saida[].
ENDFUNCTION.
in se37 run work fine
Here's my vb code, but it return zero entries (I'm sure it should return records).
-
***Login Process Here***
Set objFunc = objSAPLogon.Add("zfori_web_pgto_parceiros")
Set objtblparceiro = objFunc.Tables("T_PAGTO_PARCEIRO")
With objFunc
.Exports("I_LIFNR") = "1064425"
End With
If Not objFunc.Call Then
Debug.Print objFunc.Exception
Exit Sub
End If
Debug.Print objtblparceiro.RowCount ==> 0
.
2012 May 16 6:00 AM
HI,
Pass LIFNR with leading zeros.That is the reason for empty records.
Thanks
Naresh
2012 May 15 10:49 PM
I'm not going to ask why you're using VB6 instead of VB.NET, since I'm sure you have your reasons. I see two possibilities. Capitalize the function module (just in case), and set the objtblparceiro AFTER the function is called, not before. Let me know if that works.
2012 May 16 12:17 AM
Marcelo,
I tried my application using lower case for the Function Module name and it is working OK.
Did you remember to set your Function Module to be Remote Enabled?
Maybe the FM is not being called because of authority restrictions. Are you sure you have proper authority to call remote functions? We just recently starting using vb to get remote functions and we needed to update the authority roles. You will need object S_RFC with: Activity = 16, Name of RFC = Function Group (from your Function Module), Type of RFC = FUGR
Hope this helps.
2012 May 16 3:53 AM
Hope this helps.
‘ Log into SAP
If sapConnection.logon(0, False) <> True Then
MsgBox “No connection to R/3!”
Exit Sub ‘End program
End If
‘ Call the Read RFC
Set theFunc = functionCtrl.Add(”YMAINT_TABLE”)
‘ Exporting table name
theFunc.exports(”TABLENAME”) = table_name
‘ Prepare Data sheet for data load
returnFunc = theFunc.Call
exception = theFunc.exception
‘ Map the data to cells
If returnFunc = True Then
Dim objtable As Object
Set objtable = theFunc.tables.Item(”DATA”)
End If
2012 May 16 5:09 AM
Hi,
Check if there is any leading zeros.I faced the same problem a long back.
Regards,
Madhu.
2012 May 16 2:48 PM
2012 May 16 6:00 AM
HI,
Pass LIFNR with leading zeros.That is the reason for empty records.
Thanks
Naresh
2012 May 16 6:13 AM
please look into the thread..http://scn.sap.com/thread/50275