Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Call RFC that return structure using VB

Former Member
0 Likes
575

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:

  • IMPORTING

  • VALUE(CUSTOMER) LIKE KNA1-KUNNR

  • VALUE(MATERIAL) LIKE MARA-MATNR

  • VALUE(POSTING_DATEFR) LIKE BKPF-BUDAT

  • VALUE(POSTING_DATETO) LIKE BKPF-BUDAT

  • TABLES

  • SALES_VOLUME STRUCTURE ZRRPS_SALES

*----


Here's my vb code, but it return zero entries (I'm sure it should return records).

-


***Login Process Here***

Set objFunc = objSAPLogon.Add("Z_CUSTOM_SALES_DATA")

Set objSALES = objFunc.Tables("SALES_VOLUME")

With objFunc

.Exports("CUSTOMER") = "1234567"

.Exports("MATERIAL") = "1234"

.Exports("POSTING_DATEFR") = "10012005"

.Exports("POSTING_DATETO") = "10312005"

End With

If Not objFunc.Call Then

Debug.Print objFunc.Exception

Exit Sub

End If

Debug.Print objSALES.RowCount ==> 0

-


From here, I dont know what to do next. Am I missing something? Please help.

Thanks in advance!

/Noel

5 REPLIES 5
Read only

andreas_mann3
Active Contributor
0 Likes
521

are you sure that your date format mmddyyyy is correct.

must'nt it be yyyymmdd?

A.

Read only

0 Likes
521

Yes, the RFC developer told me to use this format mmddyyyy.

I think the Exports portion is not working, and I dont know why. I tried remarking the Exports portion and it gives the same result, zero entries.

Thanks!

Read only

Former Member
0 Likes
521

Hi,

the field Customer has 10 Characters and Material has 18 Characters.

Try your call with according leading zeros.

Regards Gerd

Read only

0 Likes
521

Yes you're correct! I already resolved this by supplying the leading zeros and separators for the two date fields.

Thanks!

Read only

Former Member
0 Likes
521

I just supplied the leading zeros and separators for the date fields and it works!