09-07-2008 2:13 AM
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.
09-07-2008 3:04 AM
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.
09-07-2008 3:09 AM
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.
09-07-2008 3:23 AM
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.
09-07-2008 3:30 AM
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.
09-07-2008 4:46 AM
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
09-07-2008 4:49 AM
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.
09-07-2008 5:46 AM
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!
09-07-2008 6:11 AM
Hi Michael Stewart,
Table T000 contains the Clients Information
Best regards,
raam
09-07-2008 7:21 AM
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.