Application Development 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: 

SAP Data Transfer to Excel using Transaction Code

Former Member
0 Kudos

Hello,

I am trying to retrieve data from a transaction code in SAP using VBA in MS Excel. I understand that there is one way of doing this using SAP GUI scripting but is there another way using Remote Function Calls?

I was looking at RFC_CALL_TRANSACTION and RFC_CALL_TRANSACTION_USING. Does this accomplish what I need? For example, I have a transaction code called "TCODE" and I need to pass some arguments in such as a date range to generate data. Can I use RFC's or should I stick to GUI scripting?

So far, I can connect to SAP and retrieve specific table information but how can I execute a transaction code while passing in parameters.

Set obSAPFnCntrl = CreateObject("SAP.Functions")

Set obSAPConn = obSAPFnCntrl.Connection

With obSAPConn

  .System = "system"

  .User = "user"

  .Password = ""

  .Language = "EN"

  .Client = 750

End With

Set obSAPFnUserDetail = obSAPFnCntrl.Add("RFC_CALL_TRANSACTION")

'Set obSAPFnUserDetail = obSAPFnCntrl.Add("BAPI_USER_GET_DETAIL")

Thanks in advance!

4 REPLIES 4

Juwin
Active Contributor
0 Kudos

You can use this method to get data out of SAP, only if the function module returns it as a parameter.

For eg. BAPI_USER_GET_DETAIL has some return parameters, which will give you back user details. But, RFC_CALL_TRANSACTION isn't for meant for returning any data from SAP.

We may be able to better assist you if you can tell the Tcode, which you are trying to access.

Thanks,

Juwin

Former Member
0 Kudos

Hello,

Thanks for your reply Juwin. The transaction code that I am trying to access is CADO which displays time sheet data. I experimented with SAP GUI scripting but that won't work for me because I need to pass in a date range, personnel numbers and a layout before generating the excel spreadsheet. Any help is appreciated. Thanks!

Juwin
Active Contributor
0 Kudos

Unfortunately, I don't have any data for that in my system which would allow me to dig further.

I assume you are not a ABAPer, looking at your question. Am I right?

If so, do you have any ABAPers in your organization who can help you?

Thanks,

Juwin

former_member235395
Contributor
0 Kudos

Hi,

You can to use this BAPI: BAPI_EECATIMESHEET_GETWORKLIST. This BAPI is a RFC.

First, you need knows the parameters.