1

Good morning fellow programmers,

I'm trying to read a table from a "distant" system in SAP (ABAP).
Using the RFC_READ_TABLE function returns the fields table properly, but not the data.

data: options type table of rfc_db_opt with header line.
data: fields type table of rfc_db_fld with header line.
data: data type table of tab512 with header line.

CALL FUNCTION 'RFC_READ_TABLE'
DESTINATION xxxx        "" Name of rfc connection
  EXPORTING
     query_table   = 'BUT100'  ""Just for testing purposes""
 TABLES
     options = options  "" contains filters etc.
     fields = fields    "" contains table structure
     data = data        "" contains data of table

loop at data.
  write: data.
endloop.                "" This doesn't show anything either.

if I run this code in the debugger, I get the table fields, but the data table is always empty.
I'm pretty new to ABAP, so i thought maybe someone here got an idea, why my data table is empty as result?
I've also tried different tables than BUT100 but it's always the same result.

Thank you very much in advance!

Best Regards and stay healthy! ;)
Nico

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • 2
    When you try with other tables, do you ever get data? I tried directly in ``SE37`` in my system and I got all the data for ``BUT100`` table. Maybe you are just missing authorizations, check ``SU53`` transaction after running your test. ``RFC_READ_TABLE`` is often not accessible because of its obvious dangers (access to any database table content). – RaTiO Apr 06 '20 at 08:15
  • I think you're right, I've tried it directly over the SE37 with BUT100 and get more than enough data. So it's probably the access rights as you said. Thank you very much RaTiO! – NicoTriesToCode Apr 06 '20 at 08:28
  • Well it seems it's not a problem of permissions, according to a colleague who run a permission trace on the destination system. I'm out of ideas.. – NicoTriesToCode Apr 06 '20 at 09:50
  • I copied your code using ``DESTINATION 'NONE'`` (local execution) and it works for me. I can't think about anything else than authorizations. You can always try to debug – RaTiO Apr 06 '20 at 10:39
  • Yeah on local execution it works for us too, but not when we fill in a valid destination. Anyways thank you for your ideas! I'll commend here if we found a solution. – NicoTriesToCode Apr 06 '20 at 13:18
  • 1
    works for me as well locally, seems to be permissions issue – Suncatcher Apr 07 '20 at 15:05
  • Did you make sure that the RFC destination in `SM59` does a connection to the right "client"? (and to the right system? ;-)) By the way, you can debug in the target system if the connection user has a type allowed for GUI operations and if you have enough permissions (you may also possibly trigger the debug from the calling system). – Sandra Rossi Apr 07 '20 at 19:08
  • Thank you very much for your helpful answers everyone, the problem that I saw no data via the RFC connection was that there was actually no data in the table... :-D But I couldn't check it since I had no permissions to do so on the remote system... I'm a bit emberassed. Anyways a happy eastern for y'all and a nice weekend! – NicoTriesToCode Apr 09 '20 at 13:06
  • Turn the authorization trace on. You are very likely missing S_RFC auth. Trans St01 Set a filter to your user and select AUTH trace. test , turn trace off and look at what it recorded. The answer will be there. Or just ask the admin dude to check if thats too complicated or you dont have st01. – phil soady Apr 12 '20 at 12:27

0 Answers0