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: 

Calling a remote function that will give me a list of all the table in SAP

Former Member
0 Kudos

I am attempting to write a .Net application for my project that will connect with SAP and pull data from any table. I was wondering if anyone knows if there is a function I can call remotely that will give me a list of all the table in SAP, and their descriptions.

Thank you all for your time.

9 REPLIES 9

former_member188685
Active Contributor
0 Kudos

if you want to read the table information why you need the Tables list.

i am not sure of the Function, but you may have to choose some custom function which reads the DD02L table and get you the TABLES list.

But for reading There is a function RFC_READ_TABLE it gives the data of a specified table.

Former Member
0 Kudos

Ok, I see that now. The reason I want the table list is so that I can allow the user to select a table from the table list and then use the read table function to display it's data.

Let me give this a try then. Thank you very much for your help.

0 Kudos

This Function gives VRSTC_GET_TABLE_LIST all tables, and it is also RFC. you can try this for reading the Table list.

But it gives a Big list do you need all of them.

Former Member
0 Kudos

Yes I would like them all. I will do my best in incorporate that function along with attempting to read the table DD02L like you suggested Vijay.

One doubt I am having, and please excuse my ignorance. I am a novice at this and I hope my questions are not too basic. From a lot of what I read, it seems that the RFC_READ_TABLE, reads data one at a time, but I believe you must provide the field names that are to be read. Is that true, and if so is there another function to get the table definitions so that I might loop through the column names and pass to read table function.

Thanks a bunch.

0 Kudos

Hi Micheal,

You get all the fields present in the table, you need not specify the fields names.

We need to just specify the table name.

Best regards,

raam

0 Kudos

This takes 2 parameters

OPTION " is used pass the where condition i.e Selection criteria

FIELDS "To select the fields from table (say i have 20 fields in table, i want only 10 fields then you can try this)

This is ABAP side coding..,

data: lt_options type table of rfc_db_opt,
        lt_fields  type table of rfc_db_fld,
        lt_data    type table of tab512,
        l_offset   type i,
        l_len      type i,
        ls_flight  type sflight.
 
  field-symbols: <ls_fields> type rfc_db_fld,
                 <ls_data>   type tab512,
                 <l_field>   type any.
 
 
options-text = ' '. " Where condtions you can pass to the options parameter
append options to lt_options.
 
  call function 'RFC_READ_TABLE'
           destination bwsystem-rfcdest
    exporting
      query_table                = 'SFLIGHT'
    tables
      options                    = lt_options
      fields                     = lt_fields
      data                       = lt_data
    exceptions
      table_not_available        = 1
      table_without_data         = 2
      option_not_valid           = 3
      field_not_valid            = 4
      not_authorized             = 5
      data_buffer_exceeded       = 6
      others                     = 7
            .
  if sy-subrc  0.
* some error
    exit.
  endif.
  loop at lt_data assigning <ls_data>.
 
    loop at lt_fields assigning <ls_fields>.
      l_offset = <ls_fields>-offset.
      l_len = <ls_fields>-length.
 
      assign component <ls_fields>-fieldname of structure
                                ls_flight to <l_field>.
 
      if sy-subrc eq 0.
        <l_field> = <ls_data>+l_offset(l_len).
        "Reading the columns one by one...here
      endif.
 
    endloop.

endloop.

Former Member
0 Kudos

Here is a bit of a off topic question. In attempting to put together a .Net app that can read tables from SAP, I would like to present the user a list of SAP Clients to choose from. I am assuming I can simply reference some file from the SAPGUI logon pad installation folder that populates the available clients / message servers when someone launches the logon pad. Do you have any idea which file I can reference for that data, or where I might find some advice on this?

You are the men Reddy and Vijay!

0 Kudos

Hi Michael Stewart,

Table T000 contains the Clients Information

Best regards,

raam

0 Kudos

all the clients information of a server will be in table t000. but no client information will be inside the Installation folder up to my knowledge. But you can get messager server details etc from saplogon.ini file.